diff options
author | drh <> | 2023-03-24 20:35:56 +0000 |
---|---|---|
committer | drh <> | 2023-03-24 20:35:56 +0000 |
commit | b3ad5444d0a123ea0af7da9e158d2d0f49c9cd00 (patch) | |
tree | 4f053dc7e42a0d06067b07ddefabcfeefc5e3ead /test | |
parent | d23924d1ea4c9ffded38a73eb0f1b5cae52e22dc (diff) | |
download | sqlite-b3ad5444d0a123ea0af7da9e158d2d0f49c9cd00.tar.gz sqlite-b3ad5444d0a123ea0af7da9e158d2d0f49c9cd00.zip |
Fix the handling of indexed expressions in an outer query that appear as
corelated values inside an aggregate function within a subquery.
[forum:/forumpost/79cf371080|Forum post 79cf371080].
FossilOrigin-Name: d8259877eaa962e6f90675790d3770ef02bd1a5d86d319cd8c1834710df844c4
Diffstat (limited to 'test')
-rw-r--r-- | test/indexexpr2.test | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/indexexpr2.test b/test/indexexpr2.test index 8c1171e03..3cc030f86 100644 --- a/test/indexexpr2.test +++ b/test/indexexpr2.test @@ -372,4 +372,18 @@ foreach {tn expr} { " {1 1} } +# 2023-03-24 https://sqlite.org/forum/forumpost/79cf371080 +# +reset_db +do_execsql_test 9.0 { + CREATE TABLE t1(a INT, b INT); + CREATE INDEX t1x ON t1(a, abs(b)); + CREATE TABLE t2(c INT, d INT); + INSERT INTO t1(a,b) VALUES(4,4),(5,-5),(5,20),(6,6); + INSERT INTO t2(c,d) VALUES(100,1),(200,1),(300,2); + SELECT *, + (SELECT max(c+abs(b)) FROM t2 GROUP BY d ORDER BY d LIMIT 1) AS subq + FROM t1 WHERE a=5; +} {5 -5 205 5 20 220} + finish_test |