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

Fix an obscure problem allowing the propagate-constants optimization to improperly substitute a column of a sub-query with NONE affinity.

FossilOrigin-Name: d82725dcaec7437f37fc15dfb492b51a4f9dbbbcaea04e387d9471b7d291cde2
This commit is contained in:
dan
2025-04-10 14:53:32 +00:00
parent 8a6f89c845
commit 2d1c71abeb
4 changed files with 56 additions and 11 deletions

View File

@ -254,4 +254,44 @@ do_execsql_test 810 {
SELECT * FROM v0 LEFT JOIN t0 ON c3<NULL LEFT JOIN t1 ON 1 WHERE c2/0.1;
} {0.2 NULL NULL 0.2}
#-------------------------------------------------------------------------
# 2025-04-10 https://sqlite.org/forum/forumpost/0109bca824
reset_db
do_execsql_test 900 {
SELECT * FROM (SELECT 1.0 AS abc) WHERE abc=1;
} {1.0}
do_execsql_test 910 {
SELECT * FROM (SELECT 1.0 AS abc) WHERE abc LIKE '1.0';
} {1.0}
do_execsql_test 920 {
SELECT * FROM (SELECT 1.0 AS abc) WHERE abc=1 AND abc LIKE '1.0';
} {1.0}
do_execsql_test 930 {
CREATE TABLE IF NOT EXISTS t0 (c0 BLOB);
CREATE TABLE IF NOT EXISTS t1 (c0 INTEGER);
INSERT INTO t1 VALUES ('1');
INSERT INTO t0 VALUES (''), (''), ('2');
}
do_execsql_test 940 {
SELECT *
FROM (SELECT 0.0 AS col_0) as subQuery
LEFT JOIN t0 ON ((CASE ''
WHEN t0.c0 THEN subQuery.col_0
ELSE (t0.c0) END) LIKE (((((subQuery.col_0))))))
LEFT JOIN t1 ON ((subQuery.col_0) == (false));
} {0.0 {} 1 0.0 {} 1}
do_execsql_test 950 {
SELECT *
FROM (SELECT 0.0 AS col_0) as subQuery
LEFT JOIN t0 ON ((CASE ''
WHEN t0.c0 THEN subQuery.col_0
ELSE (t0.c0) END) LIKE (((((subQuery.col_0))))))
LEFT JOIN t1 ON ((subQuery.col_0) == (false)) WHERE t1.c0;
} {0.0 {} 1 0.0 {} 1}
finish_test