Commit Graph

21 Commits

Author SHA1 Message Date
drh
39b07f1afc When translating arguments of aggregate functions into references to
expression indexes, make sure to only translate them for the current
aggregate when there are nested aggregates.
[forum/forumpost/409ebc7368|Forum post 409ebc7368].

FossilOrigin-Name: 898bfa1afd8260eaaf2aa6db94e74d99ebf4e8a6dc02cf21d20cd981393609a5
2023-04-03 23:49:00 +00:00
drh
555970bf83 When changing a COLLATE expression node into TK_AGG_COLUMN because the nodes
value is contained in an indexed expression, be sure to clear the
EP_Collate property from the expression node.  Fix for the assertion faults
reported by [forum:/forumpost/e45108732c|forum post e45108732c] and
[forum:/forumpost/44270909bb|forum post 44270909bb].

FossilOrigin-Name: cf6454ce26983b9c3ae924c44a802f3f760eaaae9547b40aee9e14e7b0c47cab
2023-04-03 17:46:14 +00:00
drh
b3ad5444d0 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
2023-03-24 20:35:56 +00:00
drh
8210233c7b Revise tests cases to align with the new EXPLAIN QUERY PLAN output.
FossilOrigin-Name: 50fbd532602d2c316813046ed6be8be2991c281eb5f295c4c28520a0de73862c
2021-03-20 15:11:29 +00:00
drh
66c48907a2 Remove the legacy_file_format PRAGMA. In its place, provide the
SQLITE_DBCONFIG_LEGACY_FILE_FORMAT option to sqlite3_db_config().
Fix for ticket [6484e6ce678fffab]

FossilOrigin-Name: 4d424f3047b48fc441475137f30a719d2f079390c86fe2617710ddfb05c5e240
2019-10-29 16:18:45 +00:00
dan
9d23ea74d4 Fix other problems similar to ticket [c0390363].
FossilOrigin-Name: 96ff2ba9c4bb71d5f7c6f359986a76a5364b7ac3e1a612441543a9eabecf31df
2019-08-29 19:34:29 +00:00
dan
1cd382e350 Avoid assuming that for "~ (? OR TRUE)" to be true, "?" must not be NULL, just as we do for "NOT (? OR TRUE)". Fix for ticket [c0390363].
FossilOrigin-Name: 84ae41fd2f50cb7c0c3f6522d0f94817e1bbf96eae5316279e3e32cee4e46e91
2019-08-29 15:06:35 +00:00
dan
7ed6c068f5 Fix a problem in [b5ca442a] causing an assert() to fail in REINDEX commands.
FossilOrigin-Name: a3e77c7776ab01dadb9d30d6067ac97e9d4b09ec54834558a5fa1ffed7b52c72
2019-05-21 16:32:41 +00:00
dan
ef14abbf8d Use a statement journal for all CREATE INDEX statements in case an indexed exprsesion throws an exception when it is evaluated. Fix for [b5ca442a].
FossilOrigin-Name: b8071d10cba8f6c19fb8d5df3877f72567dc6d6a94744a39cbc1f58b2e2f343b
2019-05-21 14:42:24 +00:00
dan
95d5a88058 Make indexes on CAST(...) expressions work.
FossilOrigin-Name: 3ef711d98fb239cf24472f124e7b36b0dde33355de5a2c9a3a978bbdd042a735
2019-01-28 18:08:59 +00:00
dan
7525b87b6c Posible fix for [d96eba87].
FossilOrigin-Name: 89a25abfcd069aebdf817890e5c27f46de3000fb858ae01029e4528f9d677567
2018-12-14 08:40:11 +00:00
dan
909f78cbd8 Update some test cases to account for SQLITE_OMIT_VIRTUAL_TABLE builds.
FossilOrigin-Name: b53a9a3dc6b0422a102b245451769b0cd8c0d67090fefabf7cb3a65137a73771
2018-11-28 11:49:46 +00:00
drh
9b84f03556 Add the new "explain" virtual table in ext/misc. Use this virtual table
for additional test cases for the optimization that avoids updating indexes
on expressions when none of the columns changed by the UPDATE are in the
expression.

FossilOrigin-Name: 2404304cc15eaeee2744cf3c8f9cac0a544631c4f1060c5a17a78b43ca86edf0
2018-09-16 16:18:01 +00:00
drh
e9816d82a7 Optimization: when doing an UPDATE on a table with indexes on an expression,
do not update the expression indexes if they do not refer to any of the
columns of the table being updated.

FossilOrigin-Name: a71b101635ed28a4c99734dabb20bd65ef1018c1d63ac143b7321cdb0fafa5d7
2018-09-15 21:38:48 +00:00
drh
b3f0276b9e Fix test cases so that they work with the new EXPLAIN QUERY PLAN output
format.  Only some of the cases have been fixed.  This is an incremental
check-in.

FossilOrigin-Name: 5f0e803e33aa557865d5fc830d9202d628de9a94c9757058ca48f1a560702cd3
2018-05-02 18:00:17 +00:00
drh
db8e68b4cd Indexes on expressions with a COLLATE clause are able to satisfy an ORDER BY
with the same COLLATE clause.

FossilOrigin-Name: 0413001843dce7c63659d39b329ca14cdcd54f4407922f51b2fb7659572a733e
2017-09-28 01:09:42 +00:00
drh
70739addc2 Fix recent test cases in test/indexepxr2.test so that they work even without
SQLITE_ENABLE_STAT4 and SQLITE_ENABLE_JSON1.

FossilOrigin-Name: 03f3cc03aaf233ad663d32a0200bfafee24a6c81f6a0ad14094ff014f880f00f
2017-09-04 00:19:29 +00:00
dan
62f6f51ae1 Only use indexes on expressions to optimize ORDER BY and GROUP BY if the
collation sequence matches. Possible fix for [e20dd54a].

FossilOrigin-Name: 37e1900880b70be6802eaf43b0e568fda709a1dd6083d8be11e5a7a7d1fda41a
2017-08-18 08:29:37 +00:00
drh
a690ff360b Change the error message text for SQLITE_ERROR to omit the part about
"missing database" as that meaning is now obsolete (since approx SQLite 2.0).

FossilOrigin-Name: 732f90d6327c5c6368fc8b4cc207bd644ef08e3ae6d2e7295258ab099deaba63
2017-07-07 19:43:23 +00:00
dan
39c9d3a367 Remove a NEVER macro for a condition that may be true as of [a47efb7c].
Problem reported by OSSFuzz.

FossilOrigin-Name: bdc50d8d127266d02b291f6bfcd4e35eb07994ce23987d6e3921124cd881929a
2017-04-21 17:03:32 +00:00
dan
b8d29c2f75 Fix a segfault that could occur if an indexed expression was used in a
comparison operation within the result-set of a SELECT statement.

FossilOrigin-Name: d6bb7c42ff6309ce168ccdcf03b4cdabfccfc9e2a911d254ac7dc4fea4aa2bc1
2017-04-11 11:52:25 +00:00