1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-27 20:41:58 +03:00

Ensure the functions that appear to be constant are not factored out of

expression that originate on the right-hand side of a LEFT JOIN.
Ticket [6710d2f7a13a2997]

FossilOrigin-Name: 500c9152daaf11cf69d778aa8592175f6088337c6667c59af6df3a24cd81eb0e
This commit is contained in:
drh
2019-08-17 17:07:15 +00:00
parent cc3f3d1f05
commit 9e9a67adb0
4 changed files with 36 additions and 8 deletions

View File

@ -864,4 +864,19 @@ do_execsql_test join-16.100 {
WHERE (b IS NOT NULL)=0;
} {1 {}}
# 2019-08-17 ticket https://sqlite.org/src/tktview/6710d2f7a13a299728ab
# Ensure that constants that derive from the right-hand table of a LEFT JOIN
# are never factored out, since they are not really constant.
#
do_execsql_test join-17.100 {
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(x);
INSERT INTO t1(x) VALUES(0),(1);
SELECT * FROM t1 LEFT JOIN (SELECT abs(1) AS y FROM t1) ON x WHERE NOT(y='a');
} {1 1 1 1}
do_execsql_test join-17.110 {
SELECT * FROM t1 LEFT JOIN (SELECT abs(1)+2 AS y FROM t1) ON x
WHERE NOT(y='a');
} {1 3 1 3}
finish_test