aboutsummaryrefslogtreecommitdiff
path: root/src/expr.c
diff options
context:
space:
mode:
authordan <dan@noemail.net>2019-12-30 06:55:31 +0000
committerdan <dan@noemail.net>2019-12-30 06:55:31 +0000
commit2b6e670f73ed38ac4df9144c9569fd76a302a7a8 (patch)
treed55c3d6d844d7fc53a189ad77983a9c82e30a996 /src/expr.c
parent7b14b65d20a2ba85bd90689772f605ba5a32bfed (diff)
downloadsqlite-2b6e670f73ed38ac4df9144c9569fd76a302a7a8.tar.gz
sqlite-2b6e670f73ed38ac4df9144c9569fd76a302a7a8.zip
In ALTER TABLE, rename columns and tables in expressions that are optimized out by the "AND 0" optimization. Doing this also fixes an otherwise harmless assert() failure.
FossilOrigin-Name: a9e0354c992b0287608ddd18fd35fe7e6102a8f293d6e6e1b3488644bcda8168
Diffstat (limited to 'src/expr.c')
-rw-r--r--src/expr.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/expr.c b/src/expr.c
index 76ffea3f1..e0a03d956 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -933,9 +933,11 @@ Expr *sqlite3ExprAnd(Parse *pParse, Expr *pLeft, Expr *pRight){
return pRight;
}else if( pRight==0 ){
return pLeft;
- }else if( ExprAlwaysFalse(pLeft) || ExprAlwaysFalse(pRight) ){
- sqlite3ExprUnmapAndDelete(pParse, pLeft);
- sqlite3ExprUnmapAndDelete(pParse, pRight);
+ }else if( (ExprAlwaysFalse(pLeft) || ExprAlwaysFalse(pRight))
+ && !IN_RENAME_OBJECT
+ ){
+ sqlite3ExprDelete(db, pLeft);
+ sqlite3ExprDelete(db, pRight);
return sqlite3Expr(db, TK_INTEGER, "0");
}else{
return sqlite3PExpr(pParse, TK_AND, pLeft, pRight);