When flattening a query, make sure iTable attribute of TK_IF_NULL_ROW
operators (that result from a prior flattening of a LEFT JOIN) are updated correctly. Fix for ticket [cad1ab4cb7b0fc344]. FossilOrigin-Name: 92c178507df553e4f1110342c8f9b11b3ee37989e1d634fcaccabf657befa22f
This commit is contained in:
parent
d4fb196531
commit
3f1e9e00e6
16
manifest
16
manifest
@ -1,5 +1,5 @@
|
||||
C Remove\sa\ssurplus\ssemicolon,\swhich\swas\sharmless\son\sgcc\sand\sclang\sbut\scaused\ncompile-time\serrors\son\smsvc.\s\sThis\sonly\scomes\sup\susing\sthe\sencryption\sextension.
|
||||
D 2017-05-23T00:32:56.371
|
||||
C When\sflattening\sa\squery,\smake\ssure\siTable\sattribute\sof\sTK_IF_NULL_ROW\noperators\s(that\sresult\sfrom\sa\sprior\sflattening\sof\sa\sLEFT\sJOIN)\sare\supdated\ncorrectly.\s\sFix\sfor\sticket\s[cad1ab4cb7b0fc344].
|
||||
D 2017-05-23T01:21:07.094
|
||||
F Makefile.in 1cc758ce3374a32425e4d130c2fe7b026b20de5b8843243de75f087c0a2661fb
|
||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||
F Makefile.msc 8eeb80162074004e906b53d7340a12a14c471a83743aab975947e95ce061efcc
|
||||
@ -404,7 +404,7 @@ F src/printf.c 8757834f1b54dae512fb25eb1acc8e94a0d15dd2290b58f2563f65973265adb2
|
||||
F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
|
||||
F src/resolve.c 3e518b962d932a997fae373366880fc028c75706
|
||||
F src/rowset.c 7b7e7e479212e65b723bf40128c7b36dc5afdfac
|
||||
F src/select.c d74b1cde1d9ca6d08bec50b60a5be19440273646bc8ae16648d748c38161d5b7
|
||||
F src/select.c c23168278b7d4bb63846e26c5298b8056e86bfbf0c78d964447ff1340fbc2893
|
||||
F src/shell.c 9235003e7269ca95e6357393cee03450e7e89ba74470e5ee698d3a8cb1a7deea
|
||||
F src/sqlite.h.in 8dd468837a4f6d76713e3a4cc65bea48095009038593d41040ab46c1b351197f
|
||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||
@ -471,7 +471,7 @@ F src/update.c c443935c652af9365e033f756550b5032d02e1b06eb2cb890ed7511ae0c051dc
|
||||
F src/utf.c 699001c79f28e48e9bcdf8a463da029ea660540c
|
||||
F src/util.c fc081ec6f63448dcd80d3dfad35baecfa104823254a815b081a4d9fe76e1db23
|
||||
F src/vacuum.c 1fe4555cd8c9b263afb85b5b4ee3a4a4181ad569
|
||||
F src/vdbe.c b24b9806db72ad02ca82263b4705150fe9a547508948ee9906b7e120d3710211
|
||||
F src/vdbe.c 70f1c27d3de7b3ea68d3ee2b7fbf407335b66f7483eb321201ffe53724f9c54e
|
||||
F src/vdbe.h f7d1456e28875c2dcb964056589b5b7149ab7edf39edeca801596a39bb3d3848
|
||||
F src/vdbeInt.h 1ecdacc1322fdd3241ec30c32a480e328a6f864e532dc53fae8e0ab68121aebf
|
||||
F src/vdbeapi.c dc904b3c5e459727993c2421e653e29d63223846d129fae98adc782b0a996481
|
||||
@ -907,7 +907,7 @@ F test/ioerr3.test d3cec5e1a11ad6d27527d0d38573fbff14c71bdd
|
||||
F test/ioerr4.test f130fe9e71008577b342b8874d52984bd04ede2c
|
||||
F test/ioerr5.test 2edfa4fb0f896f733071303b42224df8bedd9da4
|
||||
F test/ioerr6.test a395a6ab144b26a9e3e21059a1ab6a7149cca65b
|
||||
F test/join.test f9d4a28dec81c6e9dc21b73518e024d73b5ebf57
|
||||
F test/join.test 5cab75bb781a69f7d554fb2c522246a51c2f1b5f235ccda779b84ceb80868e1f
|
||||
F test/join2.test a48f723c5692e2cbb23a9297ac2720cb77d51a70
|
||||
F test/join3.test 6f0c774ff1ba0489e6c88a3e77b9d3528fb4fda0
|
||||
F test/join4.test 1a352e4e267114444c29266ce79e941af5885916
|
||||
@ -1581,7 +1581,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P 0bb23c48064cc64134697469f3f4d2d3610b9e6c7a0dc54a3c47a00bd6c2a860
|
||||
R ba2f3447a7885f738e0bf5d05a7100b4
|
||||
P 987a2b5537254b1fe843eb798d7eb7f04dbe1e32fb827cfb9e1e1ef6c2096759
|
||||
R 100b66a7a1130ad079ea91c9272ffbdb
|
||||
U drh
|
||||
Z b06ab39e7cb6adcc1c5e9519f3ada80a
|
||||
Z 25b29392e51a9df57e7d515b67380f72
|
||||
|
@ -1 +1 @@
|
||||
987a2b5537254b1fe843eb798d7eb7f04dbe1e32fb827cfb9e1e1ef6c2096759
|
||||
92c178507df553e4f1110342c8f9b11b3ee37989e1d634fcaccabf657befa22f
|
@ -3213,6 +3213,8 @@ static Expr *substExpr(
|
||||
pExpr = pNew;
|
||||
}
|
||||
}
|
||||
}else if( pExpr->op==TK_IF_NULL_ROW && pExpr->iTable==pSubst->iTable ){
|
||||
pExpr->iTable = pSubst->iNewTable;
|
||||
}else{
|
||||
pExpr->pLeft = substExpr(pSubst, pExpr->pLeft);
|
||||
pExpr->pRight = substExpr(pSubst, pExpr->pRight);
|
||||
|
@ -2441,6 +2441,7 @@ case OP_NotNull: { /* same as TK_NOTNULL, jump, in1 */
|
||||
*/
|
||||
case OP_IfNullRow: { /* jump */
|
||||
assert( pOp->p1>=0 && pOp->p1<p->nCursor );
|
||||
assert( p->apCsr[pOp->p1]!=0 );
|
||||
if( p->apCsr[pOp->p1]->nullRow ){
|
||||
sqlite3VdbeMemSetNull(aMem + pOp->p3);
|
||||
goto jump_to_p2;
|
||||
|
@ -1,4 +1,4 @@
|
||||
# 2002 May 24
|
||||
# 2002-05-24
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
@ -12,7 +12,6 @@
|
||||
#
|
||||
# This file implements tests for joins, including outer joins.
|
||||
#
|
||||
# $Id: join.test,v 1.27 2009/07/01 16:12:08 danielk1977 Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@ -712,5 +711,20 @@ do_execsql_test join-13.2 {
|
||||
SELECT * FROM aa LEFT JOIN bb, cc WHERE cc.c=aa.a;
|
||||
} {45 {} 45 45 {} 45}
|
||||
|
||||
# Verify that that iTable attributes the TK_IF_NULL_ROW operators in the
|
||||
# expression tree are correctly updated by the query flattener. This was
|
||||
# a bug discovered on 2017-05-22 by Mark Brand.
|
||||
#
|
||||
do_execsql_test join-14.1 {
|
||||
SELECT *
|
||||
FROM (SELECT 1 a) AS x
|
||||
LEFT JOIN (SELECT 1, * FROM (SELECT * FROM (SELECT 1)));
|
||||
} {1 1 1}
|
||||
do_execsql_test join-14.2 {
|
||||
SELECT *
|
||||
FROM (SELECT 1 a) AS x
|
||||
LEFT JOIN (SELECT 1, * FROM (SELECT * FROM (SELECT * FROM (SELECT 1)))) AS y
|
||||
JOIN (SELECT * FROM (SELECT 9)) AS z;
|
||||
} {1 1 1 9}
|
||||
|
||||
finish_test
|
||||
|
Loading…
Reference in New Issue
Block a user