mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03: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:
@ -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
|
||||
|
Reference in New Issue
Block a user