Commit Graph

26 Commits

Author SHA1 Message Date
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
20cee7d0bb Always disallow the use of non-deterministic functions in CHECK constraints,
even date/time functions that use the 'now' or similar keywords.  Provide
improved error messages when this requirement is not met.
Ticket [830277d9db6c3ba1]

FossilOrigin-Name: 2978b65ebe25eeabe543b67cb266308cceb20082a4ae71565d6d083d7c08bc9f
2019-10-30 18:50:08 +00:00
dan
9d30c8ff8f Minor fix for test file indexexpr1.test.
FossilOrigin-Name: 0ceab26f15c4c7039647cbccf8939dd5c36a60b70ffeefcd3b415c8d4d8351cd
2019-09-26 19:53:26 +00:00
drh
bffdd63633 When computing an expression value for an index-on-expression or a CHECK
constraint and the expressions uses a REAL table column, but the value of
that column is an integer (in other words, when it is using the 
store-real-as-integer optimization) be sure to promote the value to real
before evaluating the expression.  Ticket [57af00b6642ecd68].

FossilOrigin-Name: 0658c16e311393c8a347b1bd41fa5dbfd2e184aa75d84c011aa8dbac79b632e9
2019-09-02 00:58:44 +00:00
drh
14c865e859 Fix the sqliteExprImpliesExpr() routine so that it recognizes that
"(NULL IS FALSE) IS FALSE" doe not implie "NULL NOT NULL".
Ticket [9080b6227fabb466]

FossilOrigin-Name: da01ba4fa47c6508b31533ccd769e637af04bd37f51463372fbc6c848d892a4d
2019-08-10 15:06:03 +00:00
drh
06b3bd5b7a When an index is based on a text representation of a numeric column in the
original table, make sure the indexed value uses the canonical text 
representation of the numeric value in the table.
Proposed fix for ticket [343634942dd54ab57b70].

FossilOrigin-Name: 88e2ce916791d488076584f3795a89eb4277fcb812af9e4c2f383815d55ff6f1
2018-02-01 01:13:33 +00:00
drh
9eb8dbad4d Add another test case (found by OSSFuzz) for the problem fixed in
check-in [2846458a] and described by ticket [dc3f932f5a147771].
No changes to code.

FossilOrigin-Name: 4165fae920a1176c68bfaa1f2cfe17df7f8dd8793519d458b71e3e63670b5495
2018-01-03 01:47:30 +00:00
drh
4d795ef7e4 In the constraint resolution logic, be careful not to cache column values
in registers whose initialization might be bypassed by an OP_NoConflict opcode.
Fix for ticket [dc3f932f5a147771] reported by OSSFuzz.

FossilOrigin-Name: 2846458af5d029a8e4fdcc8f50873a44e57897bbfe6aee8a23a01ffc34c5579f
2018-01-02 18:11:11 +00:00
drh
4dd89d5a24 Sometimes a TK_COLUMN Expr node can have Expr.pTab==0 if it is a reference
to an expression column in an index on and expression.  Fix for ticket
[aa98619ad08ddcab].

FossilOrigin-Name: d0da791ba0edfb65186459345e43500d8364a086a5a1651d828fecc1a1dd1edb
2017-08-14 14:53:24 +00:00
mistachkin
07c3a1a358 Remove stray (and incomplete) comment from a test file. No changes to code.
FossilOrigin-Name: 8de20fc72a9b55fabd2444b2d73c88c65658430d6d182da9f0e2f3432373ab51
2017-07-21 20:31:31 +00:00
drh
6e97f8ec84 Combine the Parse.ckBase and Parse.iSelfTab fields into just Parse.iSelfTab.
This fixes a problem with date/time functions in check-constraints.  Add
some test cases for date/time functions in index expressions and check
constraints.

FossilOrigin-Name: 22eda0985ecd1f456c073e6ad735a8417f3ff1fb6aaad1640e1cec01e50c51d8
2017-07-20 13:17:08 +00:00
drh
3e34eabcdf Allow indexes to be created on date/time functions as long as the 'now'
date and the 'localtime' and 'utc' modifiers are not used.

FossilOrigin-Name: 0a5e1c04d9d07bb7fd6546a9ddac1bf42b19ea19c2b79570aea6cd4226887a27
2017-07-19 19:48:40 +00:00
drh
13ac46eea2 Ensure that indexed expressions with collating sequences are handled
correctly.  Proposed fix for ticket [eb703ba7b50c1a5].

FossilOrigin-Name: 9689d04b8250139e32078b2aa9748edcc6231bcd
2017-02-11 13:51:23 +00:00
dan
90b2fe6b1e When handling ORDER BY expressions, do not assume all values of an indexed expressions are distinct. Fix for [4766f444].
FossilOrigin-Name: aebe429e52ffef026cb0803fb164339d61bd2e88
2016-10-10 14:34:00 +00:00
drh
48590fcb37 Make sure indexes on expressions skip over initial NULL values in the
index.  Fix for ticket [4baa464912129477f3c9]

FossilOrigin-Name: 71797ba431085f9ae381ed5ea6471967926f4043
2016-10-10 13:29:15 +00:00
drh
1c75c9d7f1 Ensure that the Expr objects that describe indexed expressions are not modified
by code generation.  Fix for an assert() problem found by Jon Metzman using AFL.

FossilOrigin-Name: 34073ce87d88a02313217023ae92e15939192cd9
2015-12-21 15:22:13 +00:00
drh
68391acd5f Fix PRAGMA integrity_check so that it works with a UNIQUE index over
expressions.

FossilOrigin-Name: 113181cec4db418b07640d6b1967923992efd71a
2015-09-25 20:49:16 +00:00
drh
dae26fe518 Enhance the query planner so that it is able to use indexed expressions
to help fulfill an ORDER BY clause.

FossilOrigin-Name: 668fc1ebaf426f9eed3ed7865e41f1023dafebfb
2015-09-24 18:47:59 +00:00
drh
c5de2d0a05 Make sure joins work correctly when both sides of the join are connected
using indexed expressions.

FossilOrigin-Name: c2fcb03299f2872d7f97a540ea145519f8b2e5cc
2015-09-24 12:19:17 +00:00
drh
7269443281 Correctly handle the case of a WHERE-clause term with indexed expressions on
both sides of the == sign.

FossilOrigin-Name: d9b716a6bd6145b2e7733c04d86227df777cd473
2015-09-24 11:26:45 +00:00
drh
e63e8a6c78 Fix a crash that can occur with a skip-scan on an index with
expressions when SQLITE_ENABLE_EXPLAIN_COMMENTS is defined.

FossilOrigin-Name: 25f34cb9b576a2d4250a06a7dbf88010b1c11675
2015-09-18 18:09:28 +00:00
drh
0b8d255c37 Omit all use of Expr nodes for TK_AS, as those nodes no longer served a useful
purpose and in fact interferred with the query planner.

FossilOrigin-Name: 7ab0b258eabfcfb7f1b0bd1b12e166d2f267823d
2015-09-05 22:36:07 +00:00
drh
8b57642259 Fix a bug in error reporting when a UNIQUE index on expressions fails its
uniqueness test.

FossilOrigin-Name: 5a2c0e90a1933545b4768d91d8f7c42c8f391019
2015-08-31 23:09:42 +00:00
drh
390b88a448 Case should not be significant when comparing function names.
FossilOrigin-Name: e2f1caf117b0a9632d52246717ab202852982339
2015-08-31 18:13:01 +00:00
drh
1d85e405e6 Make the distinction between truly deterministic functions and date/time
functions which only return the same answer for a single query.  Only truly
deterministic functions are allowed in indexes.  Add new expression index
test cases.

FossilOrigin-Name: c77554b5c42327106a7b90334e9cc3c07b007c76
2015-08-31 17:34:41 +00:00
drh
47991425cb Improved analysis and usage of indexed expressions in the query planner.
FossilOrigin-Name: f8893696387cba9d293a05a68dc38228077b3dc5
2015-08-31 15:58:06 +00:00