1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

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
This commit is contained in:
dan
2019-12-30 06:55:31 +00:00
parent 7b14b65d20
commit 2b6e670f73
5 changed files with 54 additions and 19 deletions

View File

@@ -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);