/ Check-in [1fad2092]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add SQLITE_DBCONFIG options LEGACY_ALTER_TABLE, NO_DQS_SCHEMA, and NO_DQS.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | new-dbconfig-options
Files: files | file ages | folders
SHA3-256: 1fad20925efa70d0c242e9cba8fa55456fb07a81229c1068da84c6e27d0c0be8
User & Date: drh 2019-06-14 21:25:25
Context
2019-06-17
13:56
Improved interface to double-quoted string literal enabling/disabling. Closed-Leaf check-in: 923cfd53 user: drh tags: new-dbconfig-options
2019-06-14
21:25
Add SQLITE_DBCONFIG options LEGACY_ALTER_TABLE, NO_DQS_SCHEMA, and NO_DQS. check-in: 1fad2092 user: drh tags: new-dbconfig-options
17:37
Deprecate the SQLITE_ALLOW_COVERING_INDEX_SCAN compile-time option when it is turned off. This probably will impact no-one. If it does, they will get an error message instructing them to contact developers, so that we can get feedback that somebody is actually using this feature. Start-time disabling of covering index scan is not affected. check-in: 23e49f99 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/main.c.

   841    841           { SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE,      SQLITE_NoCkptOnClose  },
   842    842           { SQLITE_DBCONFIG_ENABLE_QPSG,           SQLITE_EnableQPSG     },
   843    843           { SQLITE_DBCONFIG_TRIGGER_EQP,           SQLITE_TriggerEQP     },
   844    844           { SQLITE_DBCONFIG_RESET_DATABASE,        SQLITE_ResetDatabase  },
   845    845           { SQLITE_DBCONFIG_DEFENSIVE,             SQLITE_Defensive      },
   846    846           { SQLITE_DBCONFIG_WRITABLE_SCHEMA,       SQLITE_WriteSchema|
   847    847                                                    SQLITE_NoSchemaError  },
          848  +        { SQLITE_DBCONFIG_LEGACY_ALTER_TABLE,    SQLITE_LegacyAlter    },
          849  +        { SQLITE_DBCONFIG_NO_DQS_SCHEMA,         SQLITE_NoDQSSchema    },
          850  +        { SQLITE_DBCONFIG_NO_DQS,                SQLITE_NoDQS          },
   848    851         };
   849    852         unsigned int i;
   850    853         rc = SQLITE_ERROR; /* IMP: R-42790-23372 */
   851    854         for(i=0; i<ArraySize(aFlagOp); i++){
   852    855           if( aFlagOp[i].op==op ){
   853    856             int onoff = va_arg(ap, int);
   854    857             int *pRes = va_arg(ap, int*);
................................................................................
  3067   3070     db->aLimit[SQLITE_LIMIT_WORKER_THREADS] = SQLITE_DEFAULT_WORKER_THREADS;
  3068   3071     db->autoCommit = 1;
  3069   3072     db->nextAutovac = -1;
  3070   3073     db->szMmap = sqlite3GlobalConfig.szMmap;
  3071   3074     db->nextPagesize = 0;
  3072   3075     db->nMaxSorterMmap = 0x7FFFFFFF;
  3073   3076     db->flags |= SQLITE_ShortColNames | SQLITE_EnableTrigger | SQLITE_CacheSpill
         3077  +                 | SQLITE_NoDQSSchema
  3074   3078   #if !defined(SQLITE_DEFAULT_AUTOMATIC_INDEX) || SQLITE_DEFAULT_AUTOMATIC_INDEX
  3075   3079                    | SQLITE_AutoIndex
  3076   3080   #endif
  3077   3081   #if SQLITE_DEFAULT_CKPTFULLFSYNC
  3078   3082                    | SQLITE_CkptFullFSync
  3079   3083   #endif
  3080   3084   #if SQLITE_DEFAULT_FILE_FORMAT<4

Changes to src/resolve.c.

   473    473     **
   474    474     ** Because no reference was made to outer contexts, the pNC->nRef
   475    475     ** fields are not changed in any context.
   476    476     */
   477    477     if( cnt==0 && zTab==0 ){
   478    478       assert( pExpr->op==TK_ID );
   479    479       if( ExprHasProperty(pExpr,EP_DblQuoted) 
   480         -     && 0==(pTopNC->ncFlags&NC_NoDblQStr) 
          480  +     && 0==(pTopNC->ncFlags&NC_NoDblQStr)
          481  +     && 0==(db->flags & SQLITE_NoDQS)
   481    482       ){
   482    483         /* If a double-quoted identifier does not match any known column name,
   483    484         ** then treat it as a string.
   484    485         **
   485    486         ** This hack was added in the early days of SQLite in a misguided attempt
   486    487         ** to be compatible with MySQL 3.x, which used double-quotes for strings.
   487    488         ** I now sorely regret putting in this hack. The effect of this hack is
................................................................................
  1767   1768       sSrc.a[0].zName = pTab->zName;
  1768   1769       sSrc.a[0].pTab = pTab;
  1769   1770       sSrc.a[0].iCursor = -1;
  1770   1771     }
  1771   1772     sNC.pParse = pParse;
  1772   1773     sNC.pSrcList = &sSrc;
  1773   1774     sNC.ncFlags = type;
  1774         -  if( !pParse->db->init.busy && !sqlite3WritableSchema(pParse->db) ){
         1775  +  if( (pParse->db->flags & SQLITE_NoDQS)!=0
         1776  +   || (!pParse->db->init.busy
         1777  +        && !sqlite3WritableSchema(pParse->db)
         1778  +        && (pParse->db->flags & SQLITE_NoDQSSchema)!=0
         1779  +      )
         1780  +  ){
  1775   1781       sNC.ncFlags |= NC_NoDblQStr;
  1776   1782     }
  1777   1783     if( (rc = sqlite3ResolveExprNames(&sNC, pExpr))!=SQLITE_OK ) return rc;
  1778   1784     if( pList ) rc = sqlite3ResolveExprListNames(&sNC, pList);
  1779   1785     return rc;
  1780   1786   }

Changes to src/shell.c.in.

  7071   7071     }else
  7072   7072   
  7073   7073     if( c=='d' && n>=3 && strncmp(azArg[0], "dbconfig", n)==0 ){
  7074   7074       static const struct DbConfigChoices {
  7075   7075         const char *zName;
  7076   7076         int op;
  7077   7077       } aDbConfig[] = {
  7078         -        { "enable_fkey",      SQLITE_DBCONFIG_ENABLE_FKEY            },
  7079         -        { "enable_trigger",   SQLITE_DBCONFIG_ENABLE_TRIGGER         },
  7080         -        { "fts3_tokenizer",   SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER  },
  7081         -        { "load_extension",   SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION  },
  7082         -        { "no_ckpt_on_close", SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE       },
  7083         -        { "enable_qpsg",      SQLITE_DBCONFIG_ENABLE_QPSG            },
  7084         -        { "trigger_eqp",      SQLITE_DBCONFIG_TRIGGER_EQP            },
  7085         -        { "reset_database",   SQLITE_DBCONFIG_RESET_DATABASE         },
  7086         -        { "defensive",        SQLITE_DBCONFIG_DEFENSIVE              },
         7078  +        { "enable_fkey",        SQLITE_DBCONFIG_ENABLE_FKEY           },
         7079  +        { "enable_trigger",     SQLITE_DBCONFIG_ENABLE_TRIGGER        },
         7080  +        { "fts3_tokenizer",     SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER },
         7081  +        { "load_extension",     SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION },
         7082  +        { "no_ckpt_on_close",   SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE      },
         7083  +        { "enable_qpsg",        SQLITE_DBCONFIG_ENABLE_QPSG           },
         7084  +        { "trigger_eqp",        SQLITE_DBCONFIG_TRIGGER_EQP           },
         7085  +        { "reset_database",     SQLITE_DBCONFIG_RESET_DATABASE        },
         7086  +        { "defensive",          SQLITE_DBCONFIG_DEFENSIVE             },
         7087  +        { "wriable_schema",     SQLITE_DBCONFIG_WRITABLE_SCHEMA       },
         7088  +        { "legacy_alter_table", SQLITE_DBCONFIG_LEGACY_ALTER_TABLE    },
         7089  +        { "no_dqs_schema",      SQLITE_DBCONFIG_NO_DQS_SCHEMA         },
         7090  +        { "no_dqs",             SQLITE_DBCONFIG_NO_DQS                },
  7087   7091       };
  7088   7092       int ii, v;
  7089   7093       open_db(p, 0);
  7090   7094       for(ii=0; ii<ArraySize(aDbConfig); ii++){
  7091   7095         if( nArg>1 && strcmp(azArg[1], aDbConfig[ii].zName)!=0 ) continue;
  7092   7096         if( nArg>=3 ){
  7093   7097           sqlite3_db_config(p->db, aDbConfig[ii].op, booleanValue(azArg[2]), 0);

Changes to src/sqlite.h.in.

  2216   2216   ** to setting [PRAGMA writable_schema=ON] or [PRAGMA writable_schema=OFF].
  2217   2217   ** The first argument to this setting is an integer which is 0 to disable 
  2218   2218   ** the writable_schema, positive to enable writable_schema, or negative to
  2219   2219   ** leave the setting unchanged. The second parameter is a pointer to an
  2220   2220   ** integer into which is written 0 or 1 to indicate whether the writable_schema
  2221   2221   ** is enabled or disabled following this call.
  2222   2222   ** </dd>
         2223  +**
         2224  +** [[SQLITE_DBCONFIG_LEGACY_ALTER_TABLE]]
         2225  +** <dt>SQLITE_DBCONFIG_LEGACY_ALTER_TABLE</dt>
         2226  +** <dd>The SQLITE_DBCONFIG_LEGACY_ALTER_TABLE option activates or deactivates
         2227  +** the legacy behavior of the [ALTER TABLE RENAME] command such it
         2228  +** behaves as it did prior to [version 3.24.0] (2018-06-04).  See the
         2229  +** "Compatibility Notice" on the [ALTER TABLE RENAME documentation] for
         2230  +** additional information. This feature can also be turned on and off
         2231  +** using the [PRAGMA legacy_alter_table] statement.
         2232  +** </dd>
         2233  +**
         2234  +** [[SQLITE_DBCONFIG_NO_DQS_SCHEMA]]
         2235  +** <dt>SQLITE_DBCONFIG_NO_DQS_SCHEMA</td>
         2236  +** <dd>The SQLITE_DBCONFIG_NO_DQS_SCHEMA option activates or deactivates
         2237  +** the legacy [double-quoted string literal] misfeature for DDL statements.
         2238  +** </dd>
         2239  +**
         2240  +** [[SQLITE_DBCONFIG_NO_DQS]]
         2241  +** <dt>SQLITE_DBCONFIG_NO_DQS</td>
         2242  +** <dd>The SQLITE_DBCONFIG_NO_DQS option activates or deactivates
         2243  +** the legacy [double-quoted string literal] misfeature.  The
         2244  +** double-quoted string literal misfeature is on by default for
         2245  +** compatibility, though it might become off by default in some
         2246  +** future release of SQLite.
         2247  +** </dd>
  2223   2248   ** </dl>
  2224   2249   */
  2225   2250   #define SQLITE_DBCONFIG_MAINDBNAME            1000 /* const char* */
  2226   2251   #define SQLITE_DBCONFIG_LOOKASIDE             1001 /* void* int int */
  2227   2252   #define SQLITE_DBCONFIG_ENABLE_FKEY           1002 /* int int* */
  2228   2253   #define SQLITE_DBCONFIG_ENABLE_TRIGGER        1003 /* int int* */
  2229   2254   #define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004 /* int int* */
................................................................................
  2230   2255   #define SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005 /* int int* */
  2231   2256   #define SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE      1006 /* int int* */
  2232   2257   #define SQLITE_DBCONFIG_ENABLE_QPSG           1007 /* int int* */
  2233   2258   #define SQLITE_DBCONFIG_TRIGGER_EQP           1008 /* int int* */
  2234   2259   #define SQLITE_DBCONFIG_RESET_DATABASE        1009 /* int int* */
  2235   2260   #define SQLITE_DBCONFIG_DEFENSIVE             1010 /* int int* */
  2236   2261   #define SQLITE_DBCONFIG_WRITABLE_SCHEMA       1011 /* int int* */
  2237         -#define SQLITE_DBCONFIG_MAX                   1011 /* Largest DBCONFIG */
         2262  +#define SQLITE_DBCONFIG_LEGACY_ALTER_TABLE    1012 /* int int* */
         2263  +#define SQLITE_DBCONFIG_NO_DQS_SCHEMA         1013 /* int int* */
         2264  +#define SQLITE_DBCONFIG_NO_DQS                1014 /* int int* */
         2265  +#define SQLITE_DBCONFIG_MAX                   1014 /* Largest DBCONFIG */
  2238   2266   
  2239   2267   /*
  2240   2268   ** CAPI3REF: Enable Or Disable Extended Result Codes
  2241   2269   ** METHOD: sqlite3
  2242   2270   **
  2243   2271   ** ^The sqlite3_extended_result_codes() routine enables or disables the
  2244   2272   ** [extended result codes] feature of SQLite. ^The extended result

Changes to src/sqliteInt.h.

  1544   1544   #define SQLITE_Fts3Tokenizer  0x00400000  /* Enable fts3_tokenizer(2) */
  1545   1545   #define SQLITE_EnableQPSG     0x00800000  /* Query Planner Stability Guarantee*/
  1546   1546   #define SQLITE_TriggerEQP     0x01000000  /* Show trigger EXPLAIN QUERY PLAN */
  1547   1547   #define SQLITE_ResetDatabase  0x02000000  /* Reset the database */
  1548   1548   #define SQLITE_LegacyAlter    0x04000000  /* Legacy ALTER TABLE behaviour */
  1549   1549   #define SQLITE_NoSchemaError  0x08000000  /* Do not report schema parse errors*/
  1550   1550   #define SQLITE_Defensive      0x10000000  /* Input SQL is likely hostile */
         1551  +#define SQLITE_NoDQSSchema    0x20000000  /* No dbl-quote strings in CREATE */
         1552  +#define SQLITE_NoDQS          0x40000000  /* No double-quoted strings anywhere*/
  1551   1553   
  1552   1554   /* Flags used only if debugging */
  1553   1555   #define HI(X)  ((u64)(X)<<32)
  1554   1556   #ifdef SQLITE_DEBUG
  1555   1557   #define SQLITE_SqlTrace       HI(0x0001)  /* Debug print SQL as it executes */
  1556   1558   #define SQLITE_VdbeListing    HI(0x0002)  /* Debug listings of VDBE progs */
  1557   1559   #define SQLITE_VdbeTrace      HI(0x0004)  /* True to trace VDBE execution */

Changes to src/test1.c.

  7604   7604     int objc,
  7605   7605     Tcl_Obj *CONST objv[]
  7606   7606   ){
  7607   7607     static const struct {
  7608   7608       const char *zName;
  7609   7609       int eVal;
  7610   7610     } aSetting[] = {
  7611         -    { "FKEY",            SQLITE_DBCONFIG_ENABLE_FKEY },
  7612         -    { "TRIGGER",         SQLITE_DBCONFIG_ENABLE_TRIGGER },
  7613         -    { "FTS3_TOKENIZER",  SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER },
  7614         -    { "LOAD_EXTENSION",  SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION },
  7615         -    { "NO_CKPT_ON_CLOSE",SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE },
  7616         -    { "QPSG",            SQLITE_DBCONFIG_ENABLE_QPSG },
  7617         -    { "TRIGGER_EQP",     SQLITE_DBCONFIG_TRIGGER_EQP },
  7618         -    { "RESET_DB",        SQLITE_DBCONFIG_RESET_DATABASE },
  7619         -    { "DEFENSIVE",       SQLITE_DBCONFIG_DEFENSIVE },
         7611  +    { "FKEY",               SQLITE_DBCONFIG_ENABLE_FKEY },
         7612  +    { "TRIGGER",            SQLITE_DBCONFIG_ENABLE_TRIGGER },
         7613  +    { "FTS3_TOKENIZER",     SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER },
         7614  +    { "LOAD_EXTENSION",     SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION },
         7615  +    { "NO_CKPT_ON_CLOSE",   SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE },
         7616  +    { "QPSG",               SQLITE_DBCONFIG_ENABLE_QPSG },
         7617  +    { "TRIGGER_EQP",        SQLITE_DBCONFIG_TRIGGER_EQP },
         7618  +    { "RESET_DB",           SQLITE_DBCONFIG_RESET_DATABASE },
         7619  +    { "DEFENSIVE",          SQLITE_DBCONFIG_DEFENSIVE },
         7620  +    { "WRITABLE_SCHEMA",    SQLITE_DBCONFIG_WRITABLE_SCHEMA },
         7621  +    { "LEGACY_ALTER_TABLE", SQLITE_DBCONFIG_LEGACY_ALTER_TABLE },
         7622  +    { "NO_DQS_SCHEMA",      SQLITE_DBCONFIG_NO_DQS_SCHEMA },
         7623  +    { "NO_DQS",             SQLITE_DBCONFIG_NO_DQS },
  7620   7624     };
  7621   7625     int i;
  7622   7626     int v;
  7623   7627     const char *zSetting;
  7624   7628     sqlite3 *db;
  7625   7629   
  7626   7630     if( objc!=4 ){