aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/alter.c8
-rw-r--r--src/build.c1
-rw-r--r--src/sqliteInt.h3
3 files changed, 5 insertions, 7 deletions
diff --git a/src/alter.c b/src/alter.c
index 7b313dae4..9c5b46261 100644
--- a/src/alter.c
+++ b/src/alter.c
@@ -446,16 +446,16 @@ void sqlite3AlterFinishAddColumn(Parse *pParse, Token *pColDef){
renameReloadSchema(pParse, iDb, INITFLAG_AlterRename);
/* Verify that constraints are still satisfied */
- if( pParse->bDiscardCheck
+ if( pNew->pCheck!=0
|| (pCol->notNull && (pCol->colFlags & COLFLAG_GENERATED)!=0)
){
sqlite3NestedParse(pParse,
"SELECT CASE WHEN quick_check GLOB 'CHECK*'"
" THEN raise(ABORT,'CHECK constraint failed')"
- " WHEN quick_check GLOB 'NULL*'"
- " THEN raise(ABORT,'NOT NULL constraint failed')"
+ " ELSE raise(ABORT,'NOT NULL constraint failed')"
" END"
- " FROM pragma_quick_check(\"%w\",\"%w\")",
+ " FROM pragma_quick_check(\"%w\",\"%w\")"
+ " WHERE quick_check GLOB 'CHECK*' OR quick_check GLOB 'NULL*'",
zTab, zDb
);
}
diff --git a/src/build.c b/src/build.c
index c1dea15aa..4eca21a3f 100644
--- a/src/build.c
+++ b/src/build.c
@@ -1769,7 +1769,6 @@ void sqlite3AddCheckConstraint(
}else
#endif
{
- pParse->bDiscardCheck = 1;
sqlite3ExprDelete(pParse->db, pCheckExpr);
}
}
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index 420698830..651116aa9 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -3437,8 +3437,7 @@ struct Parse {
Vdbe *pVdbe; /* An engine for executing database bytecode */
int rc; /* Return code from execution */
u8 colNamesSet; /* TRUE after OP_ColumnName has been issued to pVdbe */
- u8 checkSchema : 1; /* Causes schema cookie check after an error */
- u8 bDiscardCheck :1; /* A CHECK constraint was discarded by the parser */
+ u8 checkSchema; /* Causes schema cookie check after an error */
u8 nested; /* Number of nested calls to the parser/code generator */
u8 nTempReg; /* Number of temporary registers in aTempReg[] */
u8 isMultiWrite; /* True if statement may modify/insert multiple rows */