Commit Graph

6 Commits

Author SHA1 Message Date
drh
f84aeac274 Another fix to the indexed expressions in aggregate queries with GROUP BY
enhancement of ticket [99378177930f87bd] and implemented by
check-in [b9190d3da70c4171] to address a problem described by
[forum:/forumpost/f34e32d120|forum post f34e32d120],

FossilOrigin-Name: 5acc3ef83e16a9f2803981a6e61eca62fe177cac4eed1befe2ade3a5977a1eab
2023-04-18 14:13:54 +00:00
drh
89b3cbed67 Fix to check-in [b9190d3da70c4171] - the agg-with-indexed-expr optimization
requested by ticket [99378177930f87bd] - that can cause an incorrect answer
if an aggregate subquery has a GROUP BY clause, and that GROUP BY contains a
term that is not in the result set, and the outer query makes use of expression
indexes.  Problem reported by
[forum:/forumpost/a68313d054|forum post a68313d054].

FossilOrigin-Name: e06973876993926fd56181281d04b8dd504c689abf883fa21a5721cc1d478ea8
2023-03-04 15:36:51 +00:00
drh
1379b9f51a Improvement to the dbsqlfuzz fix of [f113eebdbe68246f].
FossilOrigin-Name: 79d62956f206cb2987891d4ba5985cece21fc8c8c1158f46c2951f65c0dcf4e8
2022-12-20 14:02:35 +00:00
drh
98164c3452 Do not use indexed expressions to replace the expression being indexed on a
RIGHT JOIN as that leads to problems, as shown by
dbsqlfuzz a644e70d7683a7ca59c71861a153c1dccf8850b9.

FossilOrigin-Name: f113eebdbe68246fd38d640b0cdf0fd73ab5d2abad9226274dfa2e41fe286bf0
2022-12-20 01:48:43 +00:00
drh
b669bb5e2b New test cases. Fix the logic so that it works for GROUP BY aggregates
that do not require sorting.

FossilOrigin-Name: ef6ebe7922f56c1584a005deedc85ca1070b4fe5082ada8bbf8d06df54f1c9ef
2022-11-24 13:19:25 +00:00
drh
9b80cb5f39 Add explanatory comment to the new optimization. And add a test case.
FossilOrigin-Name: e6c20f61de7d048eee65c8e74a3eb36760ab9747ebd1ab50e49642b777c10306
2022-11-24 01:40:20 +00:00