mirror of
https://github.com/sqlite/sqlite.git
synced 2024-12-01 17:23:42 +01:00
In the query flattener when substituting expression Y in place of expression X,
if X is marked has having come from an ON or USING clause of a LEFT JOIN, then be sure that all subexpressions of Y, not just the root node of Y, are similarly marked. Otherwise, if Y is an AND operator, it will be split up during WHERE clause analysis and the subexpressions will not get the special treatment needed by LEFT JOIN ON/USING clauses. Fix for ticket [66e4b0e271c47145]. FossilOrigin-Name: 69f9eb7343a416c5ab426c8e1b9f0ae576544b4ccc5d87f5481c8ff884f696e1
This commit is contained in:
parent
1e6c58dee2
commit
af3711536b
16
manifest
16
manifest
@ -1,5 +1,5 @@
|
||||
C Better\sunderstanding\sof\ssavepoint\scode
|
||||
D 2020-09-30T09:17:53.809
|
||||
C In\sthe\squery\sflattener\swhen\ssubstituting\sexpression\sY\sin\splace\sof\sexpression\sX,\nif\sX\sis\smarked\shas\shaving\scome\sfrom\san\sON\sor\sUSING\sclause\sof\sa\sLEFT\sJOIN,\sthen\nbe\ssure\sthat\sall\ssubexpressions\sof\sY,\snot\sjust\sthe\sroot\snode\sof\sY,\sare\nsimilarly\smarked.\s\sOtherwise,\sif\sY\sis\san\sAND\soperator,\sit\swill\sbe\ssplit\sup\nduring\sWHERE\sclause\sanalysis\sand\sthe\ssubexpressions\swill\snot\sget\sthe\sspecial\ntreatment\sneeded\sby\sLEFT\sJOIN\sON/USING\sclauses.\nFix\sfor\sticket\s[66e4b0e271c47145].
|
||||
D 2020-09-30T15:36:03.192
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
@ -535,7 +535,7 @@ F src/printf.c 30e92b638fac71dcd85cdea1d12ecfae354c9adee2c71e8e1ae4727cde7c91ed
|
||||
F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
|
||||
F src/resolve.c 97b91fb25d86881ff20c9ad2ad98412c6c1bb5f7d6c9bb044db250cbc9cfcd4b
|
||||
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
|
||||
F src/select.c 6c3f7d60295f06ce7fa128bb23b1159648f0aa96a78c257af35dfef727ac63f1
|
||||
F src/select.c 0d9ce195bf062f45390c9f9fa0ab7402e26b57bee51b9f67b3034c32f9fc425a
|
||||
F src/shell.c.in 4e6ea7bf44ace40faf2b4214b7cb336fd15d22d2f7d04b70b5aa10a7716f7be7
|
||||
F src/sqlite.h.in cb9f0862e8d0f8691de95b18439ab60666f868c83bc65e3a17f0a0b44cc8f8a9
|
||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||
@ -1102,7 +1102,7 @@ F test/ioerr4.test f130fe9e71008577b342b8874d52984bd04ede2c
|
||||
F test/ioerr5.test 2edfa4fb0f896f733071303b42224df8bedd9da4
|
||||
F test/ioerr6.test a395a6ab144b26a9e3e21059a1ab6a7149cca65b
|
||||
F test/istrue.test 9619a2d77580f676048aaff7a16a0bcfea2b96c6c660dfaded2e53c873418899
|
||||
F test/join.test bca044589e94bb466e4c1e91fb6fecdc3f3326ca6b3f590f555f1958156eb321
|
||||
F test/join.test 25da4f53523a4aa17c893134b47fba6aa4799bb33350517b157785878290e238
|
||||
F test/join2.test 21fc30e54ab35ed66bf51b89cec18729205497f5cc43c83bc042f96a73721593
|
||||
F test/join3.test 6f0c774ff1ba0489e6c88a3e77b9d3528fb4fda0
|
||||
F test/join4.test 1a352e4e267114444c29266ce79e941af5885916
|
||||
@ -1880,7 +1880,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 43f7ddad800acf40917c5cc3d926640dbec17c34d5f1cbbb74bd80f44eeed0a5
|
||||
R b1f87b32877c4403d4ed1f228646d266
|
||||
U shearer
|
||||
Z 31a184db4475ad0cfaf0375a949ed5dd
|
||||
P ce6d8d621505f25e4fd43e7cf27445e1a2ddd58d79108d63499c2ae30cc9f610
|
||||
R ca5748dca083fba63e24d1a1feb3742c
|
||||
U drh
|
||||
Z e1c26467ce86b385fbc5e8735c1d70ec
|
||||
|
@ -1 +1 @@
|
||||
ce6d8d621505f25e4fd43e7cf27445e1a2ddd58d79108d63499c2ae30cc9f610
|
||||
69f9eb7343a416c5ab426c8e1b9f0ae576544b4ccc5d87f5481c8ff884f696e1
|
@ -3515,8 +3515,7 @@ static Expr *substExpr(
|
||||
ExprSetProperty(pNew, EP_CanBeNull);
|
||||
}
|
||||
if( pNew && ExprHasProperty(pExpr,EP_FromJoin) ){
|
||||
pNew->iRightJoinTable = pExpr->iRightJoinTable;
|
||||
ExprSetProperty(pNew, EP_FromJoin);
|
||||
sqlite3SetJoinExpr(pNew, pExpr->iRightJoinTable);
|
||||
}
|
||||
sqlite3ExprDelete(db, pExpr);
|
||||
pExpr = pNew;
|
||||
|
@ -1025,5 +1025,18 @@ do_execsql_test join-24.2 {
|
||||
SELECT * FROM t2 LEFT JOIN t1 ON a=0 WHERE (x='x' OR x IS NULL);
|
||||
} {1 {} {}}
|
||||
|
||||
finish_test
|
||||
# 2020-09-30 ticket 66e4b0e271c47145
|
||||
# The query flattener inserts an "expr AND expr" expression as a substitution
|
||||
# for the column of a view where that view column is part of an ON expression
|
||||
# of a LEFT JOIN.
|
||||
#
|
||||
reset_db
|
||||
do_execsql_test join-25.1 {
|
||||
CREATE TABLE t0(c0 INT);
|
||||
CREATE VIEW v0 AS SELECT (NULL AND 5) as c0 FROM t0;
|
||||
INSERT INTO t0(c0) VALUES (NULL);
|
||||
SELECT count(*) FROM v0 LEFT JOIN t0 ON v0.c0;
|
||||
} {1}
|
||||
|
||||
|
||||
finish_test
|
||||
|
Loading…
Reference in New Issue
Block a user