SQLite

Artifact [6fe97ed8]
Login

Artifact 6fe97ed88bb8a8dc7355fc088308e4b9fa09f274:

Wiki page [StrictMode] by drh 2013-12-23 14:25:33.
D 2013-12-23T14:25:33.595
L StrictMode
N text/x-markdown
U drh
W 1589
SQLite strives to follow [Postel's Rule](http://en.wikipedia.org/wiki/Robustness_principle) which is to be very forgiving of unexpected or unusual inputs.  But some users complain that this reduces portability with other database engines. For example, programs that are originally written using SQLite might stop working when moved to PostgreSQL since PostgreSQL is much less forgiving of dodgy SQL. So the suggestion has been raised to add a new pragma:

        PRAGMA strict=ON;

This page is intended to collect ideas for new error conditions that would be enforced in strict mode, assuming that strict mode is someday implemented.

  1.  Require that string literals always using single-quotes.  Disable the
      logic (added for MySQL compatibility) that causes double-quoted text to
      be interpreted as string literals if the text cannot be resolved as an
      identifier.

  2.  Throw an error if a subquery used as an expression returns more than
      a single row.  (The default behavior is that the result is taken from
      the first row and all subsequent rows are silently ignored.)

  3.  Enforce NOT NULL on all PRIMARY KEY columns

  4.  In an aggregate query, do not allow input columns that are not in the
      GROUP BY clause to be used outside of arguments to aggregate functions.

  5.  Throw an error on division by zero.  (Default behavior is to return NULL.)

  6.  Throw an error in the date/time functions if the input parameters do not
      contain a well-formed data/time strings.  (Default behavior is to 
      return NULL.)
Z 808c7ba47b22b3bdfcff0f828ea475d0