diff options
author | drh <drh@noemail.net> | 2019-12-22 18:06:49 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2019-12-22 18:06:49 +0000 |
commit | 9524a7ea9f7c693bd03f8a0df3fdea0d441473d1 (patch) | |
tree | b64bc8c685dbdb7ac3c1aab263e68224c749624a /src/expr.c | |
parent | 69843342de6612381c4388fa94c1e87909ec57f0 (diff) | |
download | sqlite-9524a7ea9f7c693bd03f8a0df3fdea0d441473d1.tar.gz sqlite-9524a7ea9f7c693bd03f8a0df3fdea0d441473d1.zip |
When parsing a CREATE TABLE from the sqlite_master table, delete the CHECK
constraints if there are any errors, since there might otherwise be attempts
to use those CHECK constraints if PRAGMA writable_schema=ON is set.
This undoes the fix in check-in [ea721b34477ab8b4] for a more general
solution.
FossilOrigin-Name: a982e6434cd66bfbe94d455f538bcbc4360b91572062d92acae6b77e9560e65d
Diffstat (limited to 'src/expr.c')
-rw-r--r-- | src/expr.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/expr.c b/src/expr.c index 21fa97d8e..9603ff45e 100644 --- a/src/expr.c +++ b/src/expr.c @@ -3649,11 +3649,6 @@ expr_code_doover: Table *pTab = pExpr->y.pTab; int iSrc; int iCol = pExpr->iColumn; - if( pTab==0 ){ - assert( CORRUPT_DB ); - sqlite3VdbeAddOp2(v, OP_Null, 0, target); - return target; - } assert( pTab!=0 ); assert( iCol>=XN_ROWID ); assert( iCol<pTab->nCol ); @@ -3722,10 +3717,9 @@ expr_code_doover: default: { /* Make NULL the default case so that if a bug causes an illegal ** Expr node to be passed into this function, it will be handled - ** sanely and not crash. This comes up, for example, if a corrupt - ** database schema is loaded using PRAGMA writable_schema=ON. */ - assert( op==TK_NULL || CORRUPT_DB ); - testcase( op!=TK_NULL ); + ** sanely and not crash. But keep the assert() to bring the problem + ** to the attention of the developers. */ + assert( op==TK_NULL ); sqlite3VdbeAddOp2(v, OP_Null, 0, target); return target; } @@ -3752,7 +3746,7 @@ expr_code_doover: sqlite3VdbeAddOp2(v, OP_Variable, pExpr->iColumn, target); if( pExpr->u.zToken[1]!=0 ){ const char *z = sqlite3VListNumToName(pParse->pVList, pExpr->iColumn); - assert( pExpr->u.zToken[0]=='?' || strcmp(pExpr->u.zToken, z)==0 ); + assert( pExpr->u.zToken[0]=='?' || (z && !strcmp(pExpr->u.zToken, z)) ); pParse->pVList[0] = 0; /* Indicate VList may no longer be enlarged */ sqlite3VdbeAppendP4(v, (char*)z, P4_STATIC); } |