1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Defer deleting subqueries in the compound-SELECT code generator until the

end of code generation, in order to avoid deleting expressions out from under
the aggregation function sanity checking assert()s that occur near the
end of SELECT code generation.  This fixes the assertion fault described by
[forum:/forumpost/cfcb4b461d|forum post cfcb4b461d].

FossilOrigin-Name: 600f1991e5c0a5d89cd8776a157b6fd72c7489791085876925e8dd7ab146fe1f
This commit is contained in:
drh
2021-08-21 16:42:58 +00:00
parent 8eaf6c620e
commit ce68b6bfeb
4 changed files with 24 additions and 10 deletions

View File

@ -646,6 +646,16 @@ do_execsql_test 14.2 {
SELECT min(a) FROM t14 WHERE b='2' AND a>'50';
} {100}
# 2021-08-21. https://sqlite.org/forum/forumpost/cfcb4b461d
#
reset_db
do_execsql_test 15.1 {
CREATE TABLE t1(a);
CREATE TABLE t2(b);
CREATE TABLE t3(c);
INSERT INTO t1 VALUES(0);
INSERT INTO t2 VALUES(5);
SELECT MIN((SELECT b FROM t2 UNION SELECT x FROM (SELECT x FROM (SELECT 1 AS x WHERE t1.a=1) UNION ALL SELECT c FROM t3))) FROM t1;
} {5}
finish_test