/ Check-in [3e1b55f3]
Login

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

Overview
Comment:A minor variation on check-in [1685610ef8e0dc] which (hopefully) makes the logic a little easier to follow. Also disallows the use of the double-quoted string hack in the query expression used for VACUUM INTO, which is not strictly required, but moves us toward the goal of disallowing the double-quoted string hack everywhere.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 3e1b55f3ab85710ed81574904718205c7370b5f0b5a41029e961486d2e3f37c7
User & Date: drh 2019-05-20 18:35:49
Context
2019-05-20
18:43
Improvements to the automatic compile-time selection of byte-order, as suggested on the mailing list by Seb Kemper. check-in: b7aad929 user: drh tags: trunk
18:35
A minor variation on check-in [1685610ef8e0dc] which (hopefully) makes the logic a little easier to follow. Also disallows the use of the double-quoted string hack in the query expression used for VACUUM INTO, which is not strictly required, but moves us toward the goal of disallowing the double-quoted string hack everywhere. check-in: 3e1b55f3 user: drh tags: trunk
17:14
Disallow string constants enclosed in double-quotes within new CREATE TABLE and CREATE INDEX statements. It is still possible to enclose column names in double-quotes, and existing database schemas that use double-quotes for strings can still be loaded. This addresses ticket [9b78184b]. check-in: 1685610e user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

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_NewSchema) 
          480  +     && 0==(pTopNC->ncFlags&NC_NoDblQStr) 
   481    481       ){
   482    482         /* If a double-quoted identifier does not match any known column name,
   483    483         ** then treat it as a string.
   484    484         **
   485    485         ** This hack was added in the early days of SQLite in a misguided attempt
   486    486         ** to be compatible with MySQL 3.x, which used double-quotes for strings.
   487    487         ** I now sorely regret putting in this hack. The effect of this hack is
................................................................................
  1767   1767       sSrc.a[0].zName = pTab->zName;
  1768   1768       sSrc.a[0].pTab = pTab;
  1769   1769       sSrc.a[0].iCursor = -1;
  1770   1770     }
  1771   1771     sNC.pParse = pParse;
  1772   1772     sNC.pSrcList = &sSrc;
  1773   1773     sNC.ncFlags = type;
  1774         -  if( pTab && !pParse->db->init.busy && !sqlite3WritableSchema(pParse->db) ){
  1775         -    sNC.ncFlags |= NC_NewSchema;
         1774  +  if( !pParse->db->init.busy && !sqlite3WritableSchema(pParse->db) ){
         1775  +    sNC.ncFlags |= NC_NoDblQStr;
  1776   1776     }
  1777   1777     if( (rc = sqlite3ResolveExprNames(&sNC, pExpr))!=SQLITE_OK ) return rc;
  1778   1778     if( pList ) rc = sqlite3ResolveExprListNames(&sNC, pList);
  1779   1779     return rc;
  1780   1780   }

Changes to src/sqliteInt.h.

  2789   2789   #define NC_UEList    0x0080  /* True if uNC.pEList is used */
  2790   2790   #define NC_UAggInfo  0x0100  /* True if uNC.pAggInfo is used */
  2791   2791   #define NC_UUpsert   0x0200  /* True if uNC.pUpsert is used */
  2792   2792   #define NC_MinMaxAgg 0x1000  /* min/max aggregates seen.  See note above */
  2793   2793   #define NC_Complex   0x2000  /* True if a function or subquery seen */
  2794   2794   #define NC_AllowWin  0x4000  /* Window functions are allowed here */
  2795   2795   #define NC_HasWin    0x8000  /* One or more window functions seen */
  2796         -#define NC_NewSchema 0x10000 /* Currently resolving self-refs for new object */
         2796  +#define NC_NoDblQStr 0x10000 /* Do not allow double-quoted string hack.
         2797  +                             ** Mnemonic: "NO DouBLe-Quoted STRings" */
  2797   2798   
  2798   2799   /*
  2799   2800   ** An instance of the following object describes a single ON CONFLICT
  2800   2801   ** clause in an upsert.
  2801   2802   **
  2802   2803   ** The pUpsertTarget field is only set if the ON CONFLICT clause includes
  2803   2804   ** conflict-target clause.  (In "ON CONFLICT(a,b)" the "(a,b)" is the