aboutsummaryrefslogtreecommitdiff
path: root/src/resolve.c
diff options
context:
space:
mode:
authordrh <>2022-04-15 19:49:28 +0000
committerdrh <>2022-04-15 19:49:28 +0000
commite62d9149a65bc5eefbdf69586f3cd6e3b6b6c59f (patch)
tree2867325729b69e904ea011bf488ed3d71b29680b /src/resolve.c
parentbb3c62a758d65bc4bf5f4eb10f4d48dc998a6602 (diff)
downloadsqlite-e62d9149a65bc5eefbdf69586f3cd6e3b6b6c59f.tar.gz
sqlite-e62d9149a65bc5eefbdf69586f3cd6e3b6b6c59f.zip
Avoid deleting substructure of the Expr node in lookupName() until after
the error message is generated. FossilOrigin-Name: b8e717663957dfd84e580bf21bc8e8881b33fdb94a2cc0c664a230e54d5e5076
Diffstat (limited to 'src/resolve.c')
-rw-r--r--src/resolve.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/resolve.c b/src/resolve.c
index 83a7c5028..204732850 100644
--- a/src/resolve.c
+++ b/src/resolve.c
@@ -663,15 +663,6 @@ static int lookupName(
}
}
- /* Remove any substructure from pExpr
- */
- if( !ExprHasProperty(pExpr,(EP_TokenOnly|EP_Leaf)) ){
- sqlite3ExprDelete(db, pExpr->pLeft);
- pExpr->pLeft = 0;
- sqlite3ExprDelete(db, pExpr->pRight);
- pExpr->pRight = 0;
- }
-
/*
** cnt==0 means there was not match.
** cnt>1 means there were two or more matches.
@@ -727,10 +718,16 @@ static int lookupName(
}
pExpr->op = eNewExprOp;
- ExprSetProperty(pExpr, EP_Leaf);
lookupname_end:
if( cnt==1 ){
assert( pNC!=0 );
+ if( !ExprHasProperty(pExpr,(EP_TokenOnly|EP_Leaf)) ){
+ sqlite3ExprDelete(db, pExpr->pLeft);
+ pExpr->pLeft = 0;
+ sqlite3ExprDelete(db, pExpr->pRight);
+ pExpr->pRight = 0;
+ ExprSetProperty(pExpr, EP_Leaf);
+ }
#ifndef SQLITE_OMIT_AUTHORIZATION
if( pParse->db->xAuth
&& (pExpr->op==TK_COLUMN || pExpr->op==TK_TRIGGER)