1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-09-09 21:09:38 +03:00

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].

FossilOrigin-Name: 1685610ef8e0dc9218b02461ceab14dc6114f4f5ef7fcda0da395094aff443e1
This commit is contained in:
dan
2019-05-20 17:14:25 +00:00
parent 8ac02a94ab
commit 0d92571d65
6 changed files with 75 additions and 14 deletions

View File

@@ -476,7 +476,9 @@ static int lookupName(
*/
if( cnt==0 && zTab==0 ){
assert( pExpr->op==TK_ID );
if( ExprHasProperty(pExpr,EP_DblQuoted) ){
if( ExprHasProperty(pExpr,EP_DblQuoted)
&& 0==(pTopNC->ncFlags&NC_NewSchema)
){
/* If a double-quoted identifier does not match any known column name,
** then treat it as a string.
**
@@ -1654,7 +1656,7 @@ int sqlite3ResolveExprNames(
NameContext *pNC, /* Namespace to resolve expressions in. */
Expr *pExpr /* The expression to be analyzed. */
){
u16 savedHasAgg;
int savedHasAgg;
Walker w;
if( pExpr==0 ) return SQLITE_OK;
@@ -1769,6 +1771,9 @@ int sqlite3ResolveSelfReference(
sNC.pParse = pParse;
sNC.pSrcList = &sSrc;
sNC.ncFlags = type;
if( pTab && !pParse->db->init.busy && !sqlite3WritableSchema(pParse->db) ){
sNC.ncFlags |= NC_NewSchema;
}
if( (rc = sqlite3ResolveExprNames(&sNC, pExpr))!=SQLITE_OK ) return rc;
if( pList ) rc = sqlite3ResolveExprListNames(&sNC, pList);
return rc;