1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Avoid deleting expression nodes in the flattener code, as they may be referenced by AggInfo objects further up the stack.

FossilOrigin-Name: cc1fffdeddf422404170fa163ab80372ae58b444d7012b2c164021b221709b3e
This commit is contained in:
dan
2020-06-13 21:24:40 +00:00
parent 74e0d96695
commit cd653a3266
4 changed files with 25 additions and 9 deletions

View File

@ -1,11 +1,11 @@
B fd5abb1a7b5a55127d5c0d5ff448020d8bccab44e4f5afe1eb88fc19578af735
C Identifiers\s"TRUE"\sand\s"FALSE"\scannot\stake\son\stheir\sboolean\sconstant\svalues\sif\nthey\sare\soperands\sof\sthe\s"."\soperator.
D 2020-06-13T03:18:21.016
C Avoid\sdeleting\sexpression\snodes\sin\sthe\sflattener\scode,\sas\sthey\smay\sbe\sreferenced\sby\sAggInfo\sobjects\sfurther\sup\sthe\sstack.
D 2020-06-13T21:24:40.551
F ext/fts3/fts3.c acc51e4378dd772251b31ead0ccd19070fc1774f6f6a55b11e00cb885e0f34bc
F src/btree.c fabc215bd1ebab0e48108e95e0f50531da9883156b95888f479f6c696db032ad
F src/expr.c 36bb737d2ca78ee9bd4fde46cf1e51a37e7e1b263e55fccfaef32922a19e9524
F src/global.c 0409ae635839e0bef26a69b68be64126ab6cba62ac19bd7694f1652e591c4c17
F src/select.c 929e1c0db3cb3d9f7d2304c6596868abcb6dfd7c2a0ac1bdf12a5a4432078ba4
F src/select.c 1a791ad41c35ec24217b8da877a4deb2a9e22a1dfae2bc46d68d9ad4e4bf8f40
F src/sqliteInt.h fe320867c4f48eeeca523062c5668508b3f9b88d65690d42610bd138a5fdb5c4
F src/test1.c e9f68f157f8fd027ee4c32c4b427f4eed274749bfb745427e2d954fa89d95ad3
F src/window.c 88a63e6948ea924b3cf9ad8aff5ea1fa53bebdb2f13340867205fda16ed0f19c
@ -13,8 +13,9 @@ F test/fts3corrupt2.test e318f0676e5e78d5a4b702637e2bb25265954c08a1b1e4aaf93c788
F test/fts3corrupt4.test e77b06926348eb45b71569f9dc45e5b19c984ca1b1ef6671367f4ca9d6eaa973
F test/fuzzdata8.db b87ae726c84c3f80d457642d7650724a76eb3d7b76258959d712cc4d926ddfc7
F test/istrue.test 06f92ea38750fa74df7dbbe6920205251c2310861fbbe23a3adfa918a2e2ba74
F test/select3.test c49fbb758903f3718e2de5aa4655eda4838131cbea24a86db908f8b6889aa68c
F test/window1.test 9d7f4990e5b36d95af93b189da4aa75216c6690ce95cced3c8b6d3234be51c2c
P 14a5cbddc887e23a684fabab1a213cce261bd6cffa0663d4f138b92d0b65b9c2
R ebfcb880c83916e081aacf3bd673aef2
U drh
Z f044363c3bc3fa94bf2e0fcb83823aba
P ad738286e2441b5e84d05366db3fcafabe66be766f21fe6c17f43a8fabab16fb
R 5e5118679cf69aa40cdce2d30c720aca
U dan
Z 711c877ed46b56919faaa443580ab634

View File

@ -1 +1 @@
ad738286e2441b5e84d05366db3fcafabe66be766f21fe6c17f43a8fabab16fb
cc1fffdeddf422404170fa163ab80372ae58b444d7012b2c164021b221709b3e

View File

@ -4115,7 +4115,13 @@ static int flattenSubquery(
if( isLeftJoin>0 ){
sqlite3SetJoinExpr(pWhere, iNewParent);
}
pParent->pWhere = sqlite3ExprAnd(pParse, pWhere, pParent->pWhere);
if( pWhere ){
if( pParent->pWhere ){
pParent->pWhere = sqlite3PExpr(pParse, TK_AND, pWhere, pParent->pWhere);
}else{
pParent->pWhere = pWhere;
}
}
if( db->mallocFailed==0 ){
SubstContext x;
x.pParse = pParse;

View File

@ -314,4 +314,13 @@ do_execsql_test select3-9.100 {
SELECT * FROM t0 GROUP BY c0;
} {1.0 1.0}
reset_db
do_execsql_test select3.10.100 {
CREATE TABLE t1(a, b);
CREATE TABLE t2(c, d);
SELECT max(t1.a),
(SELECT 'xyz' FROM (SELECT * FROM t2 WHERE 0) WHERE t1.b=1)
FROM t1;
} {{} {}}
finish_test