Commit Graph

36 Commits

Author SHA1 Message Date
drh
d65b7e36ec Do not confuse the ">" operator with IS NOT NULL when checking to see if
a partial index is usable.
[forum:/forumpost/d813704d7c|Forum post d813704d7c].

FossilOrigin-Name: 8cc23931d61b7d78521acce93fc2603649c5813c7a0869cb2c1bde2c8c4e51b4
2021-05-29 23:07:59 +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
39b30a7d6b In sqlite3GenerateIndexKey(), do not attempt to reuse column values from
the previous index if the current index is a partial index as the partial
index test may have corrupted those values.  Ticket [a9efb42811fa41ee]

FossilOrigin-Name: 17e9f65814264de9c35bc5ba94e0a66fbbf1200c00d33ab9a19a0b6f92bc685a
2019-11-02 13:32:50 +00:00
drh
c7d12f4ad4 When we play games with COLLATE in order to commute an operator in the
WHERE clause processing, be sure not to use the commuted operator to qualify
a partial index, as insufficient COLLATE information is preserved to verify
that the expression will correctly qualify the index.
Ticket [767a8cbc6d20bd68]

FossilOrigin-Name: 5351e920f489562f959ab8a376ff720f845ea165e0cdc7c3a271aac53c2aa64a
2019-09-03 14:27:25 +00:00
drh
ae144a1c9f The expression "(X IS FALSE) IN (FALSE)" does not imply that X is NOT NULL.
Ticket [f8f472cbc77ba9c9]

FossilOrigin-Name: dd66134817ecbda01c59a05ad0d6ac44bee700ab10cd2119c869dd69af293fe2
2019-08-30 16:00:58 +00:00
drh
7a231b4973 The expression "(X IS FALSE) BETWEEN FALSE AND TRUE" does not implie that
X is not NULL.  Ticket [fba33c8b1df6a915]

FossilOrigin-Name: 057fb8b1809b8b9c8fff0fd0804153b9644f0545c23c6ddc4758bda3381094b9
2019-08-30 15:11:08 +00:00
drh
38cefc83c8 The expression "(x IS FALSE) IS FALSE" does not imply that X is not NULL.
Ticket [a6408d42b9f44462]

FossilOrigin-Name: 45ff2b1f2693bb0231a864a511bb82cf2a5945ab3d806a5bbaf1517ecb287883
2019-08-30 13:07:06 +00:00
drh
175b8f06f7 Remove support for STAT3. The sqlite_stat3 tables are ignored, if they
exist.  STAT4 continues to work as it always has, and as it is a superset of
STAT3 is the recommended replacement.

FossilOrigin-Name: 1e17ea2fd1df4ad49138c787c8fe3207dd0c25c93f9001d52a9b69f8c12e841c
2019-08-08 15:24:17 +00:00
dan
c6824c8d6c When considering partial indexes, do not assume that a "CASE x ..." expression implies "x IS NOT NULL".
FossilOrigin-Name: 1b24303220b7b4f59520176a0150fc619c668865450b4fdaa9ce4113a56e9687
2019-05-11 16:14:42 +00:00
dan
8f2b1e4c90 Do not assume that "x IS NOT ?" implies "x NOT NULL" when considering partial indexes. Fix for ticket [8025674847].
FossilOrigin-Name: 0ba6d709b50d92db1542f2ff30535a80184b00dadf759d51e5cae7a6e37b1764
2019-05-11 13:04:33 +00:00
drh
664d6d139e Fix the NOT NULL logic in the theorem prover that determines when a partial
index can be used.  Ticket [5c6955204c392ae763a95].

FossilOrigin-Name: c2e439bccc40825e211bfa9a88e6a251ff066ca7453d4e7cb5eab56ce7332635
2019-05-04 17:32:07 +00:00
drh
ce706c2cf3 New test case for ticket [1d958d90596593a77420e59].
FossilOrigin-Name: b7bf3c9832bde26b359f4d58ebcf7788c500586d311387d022192ed65a126252
2018-12-09 18:55:05 +00:00
drh
d4a4a36171 Do not use a partial index as a table scan in an IN operator.
Fix for ticket [1d958d90596593a77420e59].

FossilOrigin-Name: 15bc915dd7ae25bfdfbe357c3792db3639799e4d121c6b5b24297af2d6d7129e
2018-12-08 20:30:31 +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
a71c743aae Allow deterministic functions in the WHERE clause of a partial index.
FossilOrigin-Name: c6e9b9421805c904b20900b711fa0e51773aef3e
2016-10-03 18:13:23 +00:00
drh
8dc570b6af Prefer to use partial indexes for full table scans when that is possible.
FossilOrigin-Name: fe1874321ba31cec9ae65387920c33d8d0178ed8
2016-06-08 18:07:21 +00:00
drh
cf599b6ade Enhance the query planner so that it is able to use partial indexes that use
AND-connected terms in the WHERE clause.

FossilOrigin-Name: 065765902d2774d7432b9c00ea2efed26e0aaa5e
2015-08-07 20:57:00 +00:00
drh
72bc8208f0 When generating code for partial indexes, be sure not to modify the
index condition expression in the schema.

FossilOrigin-Name: e63d01c69c3e50f49ee3022a519c4f3e91f00520
2015-06-11 13:58:35 +00:00
dan
2a45cb5c0e Prevent partial indexes on the table on the left hand side of a LEFT JOIN from being incorrectly qualified by a constraint in the ON clause of the join. This relaxes the rule introduced by the previous commit (as the partial indexes on the table on the rhs of the LEFT JOIN may now be qualified by terms within the ON clause).
FossilOrigin-Name: 1d6fb43a576d335d2717e94d28385178c23c81a1
2015-02-24 20:10:49 +00:00
drh
e006a86643 More test cases to help ensure that partial indexes do not get used if their
qualifing constraint is inside the ON clause of a LEFT JOIN.

FossilOrigin-Name: c6399958a17e8b7c1798a9240fb06bffc774b332
2015-02-24 18:39:00 +00:00
dan
7de2a1faf6 Do not reduce the number of rows scanned at all for "IS NOT NULL" constraints. Fix a bug in calculating the number of rows visited by scans of partial indicies.
FossilOrigin-Name: a8ae93f0cffa116df0ba34d46a53f49d42dace41
2014-04-28 20:11:20 +00:00
drh
87744513e7 Make sure column cache elements are cleared correctly when jumping over
code for key generation in a partial index. 
Fix for ticket [2ea3e9fe6379fc3f6].

FossilOrigin-Name: 3122b8364082be783821da01d4af2af6a9586327
2014-04-13 19:15:49 +00:00
drh
f9c8ce3ced Standardize the error messages generated by constraint failures to a format
of "$TYPE constraint failed: $DETAIL".  This involves many changes to the
expected output of test cases.

FossilOrigin-Name: 54b221929744b1bcdbcc2030fef2e510618afd41
2013-11-05 13:33:55 +00:00
drh
5f33f37580 Make sure the count(*) optimization works correctly even when partial
indices are present.  Ticket [a5c8ed66cae].

FossilOrigin-Name: 9f2f4c0a50808910ad01c8c4352367f25747be08
2013-10-04 00:00:12 +00:00
drh
2f53b90665 Merge the STAT4 capability into trunk.
FossilOrigin-Name: a32af0abe5fa6d570604fa3534e8230d5b6042fc
2013-08-26 23:18:06 +00:00
dan
c3c16cbd61 Fix a couple of test scripts to work with DEFAULT_AUTOVACUUM and OMIT_VIRTUALTABLE.
FossilOrigin-Name: 356c6c59311eaf7d5633476f635e94a12b8b3924
2013-08-20 20:25:03 +00:00
dan
8ad169abb4 If ENABLE_STAT3 is defined but ENABLE_STAT4 is not, have ANALYZE create and populate the sqlite_stat3 table instead of sqlite_stat4.
FossilOrigin-Name: cca8bf4372ab7a0258aa5c9397818415c6cf0abf
2013-08-12 20:14:04 +00:00
dan
3d40759803 Merge latest trunk changes with this branch.
FossilOrigin-Name: 08f74c45ecf711a2373af578d44470add9082377
2013-08-07 18:42:27 +00:00
drh
9fe809c561 Fix a test case related to partial indices so that it works even if
STAT3 is disabled.

FossilOrigin-Name: 153c645025637bbff14dfce793e4b92210ded7e8
2013-08-06 19:18:17 +00:00
drh
1e7d43c977 Silently ignore database name qualifiers in CHECK constraints and in
partial index WHERE clauses.

FossilOrigin-Name: 2e8c845eb5011a2743dace333aa38383588f2080
2013-08-02 14:18:18 +00:00
drh
3bf0ac1709 Fix bug in the logic that determines the end of a CREATE INDEX statement.
Added a VACUUM test case that exposed the bug.

FossilOrigin-Name: 2e3df0bc900c01286d3ce32c2bbf9e5293973f9b
2013-08-01 16:02:40 +00:00
drh
66518ca71f More test cases and corresponding bug fixes.
FossilOrigin-Name: 0c8cfdfae215c95cf167f404a1d346690b28e972
2013-08-01 15:09:57 +00:00
drh
721dfcf544 Fix the ANALYZE command to work with partial indices.
FossilOrigin-Name: 60353124f4e965393ecd864019bdbca1999fb69e
2013-08-01 04:39:17 +00:00
drh
8a9789b6c1 Test cases and bug fixes for the partial index logic.
FossilOrigin-Name: 6b73ae7c123801787c8994113cbeb87ee96ba653
2013-08-01 03:36:59 +00:00
drh
3780be115a Resolve names in CREATE INDEX WHERE clauses and detect errors. Disallow
expressions that contain variables, subqueries, or functions.
The expression is still not used for anything, however.
still unused.

FossilOrigin-Name: f2aa7842c8b9df24294f09e2bde27b3f08c455c7
2013-07-31 19:05:22 +00:00
drh
1fe0537e51 Here begins an experimental branch for exploring the idea of a partial index.
This check-in is able to parse a WHERE clause on a CREATE INDEX statement, but
does not actually do anythingn with that WHERE clause yet.

FossilOrigin-Name: 6794b2dcb48b3507caccfc7867fc185818cf8291
2013-07-31 18:12:26 +00:00