mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-12 13:01:09 +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:
@@ -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;
|
||||
|
||||
@@ -2766,7 +2766,7 @@ struct NameContext {
|
||||
NameContext *pNext; /* Next outer name context. NULL for outermost */
|
||||
int nRef; /* Number of names resolved by this context */
|
||||
int nErr; /* Number of errors encountered while resolving names */
|
||||
u16 ncFlags; /* Zero or more NC_* flags defined below */
|
||||
int ncFlags; /* Zero or more NC_* flags defined below */
|
||||
Select *pWinSelect; /* SELECT statement for any window functions */
|
||||
};
|
||||
|
||||
@@ -2793,6 +2793,7 @@ struct NameContext {
|
||||
#define NC_Complex 0x2000 /* True if a function or subquery seen */
|
||||
#define NC_AllowWin 0x4000 /* Window functions are allowed here */
|
||||
#define NC_HasWin 0x8000 /* One or more window functions seen */
|
||||
#define NC_NewSchema 0x10000 /* Currently resolving self-refs for new object */
|
||||
|
||||
/*
|
||||
** An instance of the following object describes a single ON CONFLICT
|
||||
|
||||
Reference in New Issue
Block a user