/ File History
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

History of src/whereexpr.c

2019-11-15
00:52
Fix table-valued functions so that they will work as the right table in a LEFT JOIN. Ticket [2ae0c599b735d59e] file: [39b6a538] check-in: [2c35d3f6] user: drh branch: trunk, size: 60054
2019-10-22
11:29
Previous check-in to fix [b47e3627ecaadbde] was incomplete. This check-in completes the fix and adds a test cases. file: [0705f608] check-in: [c7da1c01] user: drh branch: trunk, size: 59959
00:03
When flipping ("commuting") a comparison operator, set the new EP_Commuted bit rather than adding extra EP_Collate bits, to single later processing that the order of precedence for COLLATE operators is inverted. Fix for ticket [b47e3627ecaadbde] file: [ab3c687a] check-in: [90f7c477] user: drh branch: trunk, size: 59888
2019-09-16
18:19
Do not attempt the LIKE optimization for non-text columns and a pattern prefix of "-". Ticket [0f0428096f17252a] file: [05c283d2] check-in: [6fe0367f] user: drh branch: trunk, size: 61254
2019-09-03
14:27
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] file: [b3bbae19] check-in: [5351e920] user: drh branch: trunk, size: 61077
2019-08-22
16:38
Fix the likely(), unlikely(), and likelihood() functions so that they have no affinity, just like any other function. Ticket [7e07a3dbf5a8cd26] file: [2757afbd] check-in: [44578865] user: drh branch: trunk, size: 60699
2019-08-08
16:23
More legacy STAT3 code removed. file: [5cce1fd1] check-in: [845d2f17] user: drh branch: omit-stat3, size: 60681
15:24
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. file: [029222a0] check-in: [1e17ea2f] user: drh branch: omit-stat3, size: 60682
2019-06-14
12:28
Refactor the LIKE optimization decision logic so that it uses sqlite3AtoF() on both boundary keys to determine if the optimization can be used when the LHS is something that might not have TEXT affinity. Ticket [ce8717f0885af975]. See also [c94369cae9b561b1], [b043a54c3de54b28], [fd76310a5e843e07], and [158290c0abafde67]. file: [5e559bdd] check-in: [b4a9e09e] user: drh branch: trunk, size: 60700
2019-06-10
13:46
Do not attempt the LIKE optimization on a column with numeric affinity if the rhs of the operator begins with whitespace. Fix for ticket [fd76310a5e]. file: [d0683adb] check-in: [94b58ab0] user: dan branch: trunk, size: 60627
2019-05-08
23:53
This is part of the previous check-in that didn't get committed for some reason - probably because I failed to press the "Save" button on the text editor. file: [4219bdd5] check-in: [51d32173] user: drh branch: trunk, size: 60579
19:55
Fix another pattern for which the LIKE optimization does not work for a non-TEXT affinity. Case found by Manuel Rigger. file: [3a8abba6] check-in: [74020110] user: drh branch: trunk, size: 60565
2019-05-02
01:41
The "LIKE Optimization" (which converts a LIKE into a BETWEEN operator that is able to use an index) does not work and cannot be used if the collating sequence of the column is not TEXT and if the pattern starts with a "+" sign. This is another case of ticket [c94369cae9b561b1f996d005]. The new test case was discovered by Manuel Rigger. file: [7fedf990] check-in: [b043a54c] user: drh branch: trunk, size: 60562
2019-03-12
09:49
Fix a crash that could occur if the RHS of an IN expression is a correlated sub-query that refers to the outer query from within a window frame definition only. file: [90859652] check-in: [0524aaaf] user: dan branch: trunk, size: 60539
2018-12-14
18:11
Fix harmless compiler warnings. file: [36b47f72] check-in: [27221c69] user: drh branch: trunk, size: 60314
08:40
Possible fix for [d96eba87]. file: [b87a823b] check-in: [89a25abf] user: dan branch: tkt-d96eba87, size: 60314
2018-11-19
20:41
Fix a problem with virtual tables in shared schemas. file: [833b58f9] check-in: [84be9220] user: dan branch: reuse-schema1, size: 60146
2018-11-05
13:48
Disable the IS NOT NULL optimization when the IS NOT NULL operator is part of the ON clause of a LEFT JOIN. Fix for ticket [65eb38f6e46de8c75e188a17ec]. file: [0f496c57] check-in: [8d09ce5d] user: drh branch: branch-3.25, size: 60076
07:53
Disable the IS NOT NULL optimization when the IS NOT NULL operator is part of the ON clause of a LEFT JOIN. Fix for ticket [65eb38f6e46de8c75e188a17ec]. file: [491f0894] check-in: [af39661e] user: drh branch: trunk, size: 60142
2018-10-26
15:36
Prevent an == constraint specified using the table-valued-function argument syntax from being used to optimize any scan not related to the virtual table for which it was specified as an argument. file: [7660a584] check-in: [4d46685f] user: dan branch: trunk, size: 60099
2018-09-20
19:02
Combine the Expr.pTab and Expr.pWin fields into a union named "y". Add a new EP_WinFunc property that is only true if Expr.y.pWin is a valid pointer. This reduces the size of the Expr object by 8 bytes, reduces the overall amount of code, and shaves over 1 million cycles off of the speed test. file: [1b5a5a78] check-in: [ad130bb8] user: drh branch: trunk, size: 60047
2018-09-19
20:14
Reduce the size of Expr to 64-bytes. This works somewhat, but there are test failures. More importantly, the size reduction from 80- to 64-bytes has not lowered the schema memory usage, but it has made the code a little bigger and a little slower. So the initial evidence is that this Expr refactoring experiment is not working... file: [c88f2047] check-in: [24b0f66a] user: drh branch: expr-simplify, size: 60824
14:54
Reduce the size of Expr from 80 to 72 bytes moving the pRight field inside the "x" union. This is an incremental check-in that still has issues. file: [ba56a077] check-in: [147c61a6] user: drh branch: expr-simplify, size: 60639
2018-09-18
21:35
In the Expr object, the Expr.eX field determines what value is stored in the Expr.x union. This mostly works, but there are issues identified by valgrind. file: [c08b5afc] check-in: [8849a463] user: drh branch: expr-simplify, size: 60181
2018-09-10
12:40
Fix the LIKE optimization so that it is disabled when the LHS of the expression does not have TEXT affinity and the RHS is the pattern '/%' or the RHS begins with the escape character. Fix for ticket [c94369cae9b561b1f996d0054b]. file: [eb462ebe] check-in: [f191431d] user: drh branch: trunk, size: 60033
2018-08-27
17:13
Add support for the Geopoly extension to the R-Tree extension. This also involves adding the SQLITE_INDEX_CONSTRAINT_FUNCTION capability to the xFindFunction method of the sqlite3_module object, and to the sqlite3_index_info.aConstraint.op field in the xBestIndex implementation of virtual tables. file: [d87df2c0] check-in: [666133e3] user: drh branch: trunk, size: 59570
2018-08-23
14:54
Merge enhancements from trunk. file: [fc338d5b] check-in: [c446c884] user: drh branch: rtree-geopoly, size: 59519
2018-08-21
12:16
Fix various harmless warnings generated by static analysis tools. file: [94f181d1] check-in: [a04a0ea9] user: drh branch: trunk, size: 58100
2018-08-09
21:45
Fix the isLikeOrGlob() routine in the WHERE clause processing logic so that it avoids signed/unsigned character comparisons, as that can lead to an incorrect answer if the ESCAPE clause is an invalid UTF8 string. Problem found by OSSFuzz. file: [5a57a974] check-in: [4195a3f8] user: drh branch: trunk, size: 58049
2018-07-27
17:51
Only run the constant propagation optimization on joins since that is the only scenario where it is useful. This saves prepare time for the common case of a simple query. file: [dc34f0df] check-in: [598d6083] user: drh branch: propagate-const-opt, size: 58040
16:57
Constant propagation is now restricted to just the WHERE clause. The mechanism is changed to take affinity and collation into account. This seems to give correct answers. But the search for constant propagation costs 4 million cycles in the speed test. file: [7d30c744] check-in: [82c67efb] user: drh branch: propagate-const-opt, size: 58032
2018-07-02
15:03
Fix a crash caused by a LIKE pattern that consists of a single escape character. Problem found by OSSFuzz. file: [571618c6] check-in: [bb9bfc3a] user: dan branch: trunk, size: 58027
2018-06-11
01:30
Always initialize the WhereClause.hasOr field that was added by check-in [292724ffc4]. Error detected by OSSFuzz. file: [19cf35cd] check-in: [9faf4171] user: drh branch: trunk, size: 57790
2018-06-09
02:49
Performance improvement to sqlite3WhereExprUsage(). file: [6f022d6c] check-in: [fd093413] user: drh branch: trunk, size: 57772
00:09
Avoid invoking the whereLoopAddOr() routine in the query planner if there are no OR operators in the WHERE clause, thus speeding up query planning slightly. file: [d979cd59] check-in: [292724ff] user: drh branch: trunk, size: 57607
2018-05-26
18:03
Experimental change that allows overloaded functions to be analyzed by the xBestIndex method and used by the xFilter method of a virtual table. file: [a6994e3a] check-in: [a353b1d7] user: drh branch: vtab-func-constraint, size: 59012
2018-04-24
16:41
All the OR optimization to proceed even if the OR is also converted into an IN operator. file: [e90b2e76] check-in: [e252c654] user: drh branch: trunk, size: 57542
2018-02-18
17:50
Fix a memory leak in the processing of nested row values. This problem has existed every since row values support was added (version 3.15.0, 2016-10-14) but was only just now detected by OSSFuzz. file: [53532be6] check-in: [2df6bbf1] user: drh branch: trunk, size: 57604
2018-01-26
22:41
Fix the query planner so that it takes into account dependencies in the arguments to table-valued functions in subexpressions in the WHERE clause. Fix for ticket [80177f0c226ff54f6dd]. file: [22dbfd3b] check-in: [7daa6873] user: drh branch: trunk, size: 57603
2017-11-03
06:45
Fix harmless compiler warnings. file: [427ea8e9] check-in: [d088c5a3] user: mistachkin branch: trunk, size: 57475
2017-09-28
01:58
Add new routines to simplify dealing with collating sequences in expressions: sqlite3ExprNNCollSeq() and sqlite3ExprCollSeqMatch(). file: [afcac9cc] check-in: [490e488e] user: drh branch: trunk, size: 57467
2017-09-11
19:47
Refactor names of constants and functions associated with the auxiliary operators for xBestIndex. file: [4953ca4e] check-in: [0fb992af] user: drh branch: vtab-extra-ops, size: 57651
2017-09-09
19:41
Enhance the vtab interface to handle IS, !=, IS NOT, IS NULL and IS NOT NULL constraints. file: [ffc3c90f] check-in: [34c8e952] user: dan branch: vtab-extra-ops, size: 56680
2017-08-11
03:47
Simplification to the like optimization logic. Remove unnecessary branches. file: [fe1fe600] check-in: [9466d952] user: drh branch: trunk, size: 55246
2017-08-08
21:30
Fix a faulty signed/unsigned character comparison in the LIKE optimization logic. file: [1e55d791] check-in: [f4a4b149] user: drh branch: trunk, size: 55315
2017-07-27
20:24
Enhance the like optimization so that it works with an ESCAPE clause. file: [35d8b33a] check-in: [f5d330f4] user: drh branch: trunk, size: 55313
2017-07-10
15:26
Small performance optimization in sqlite3WhereExprUsage(). file: [bf983d2d] check-in: [38edc677] user: drh branch: defer-where-subqueries, size: 54287
15:17
Fix another problem on this branch. file: [16bb6355] check-in: [a4fc9811] user: dan branch: defer-where-subqueries, size: 54247
2017-06-28
18:07
Merge the in the latest enhancements from trunk. file: [fa51927c] check-in: [8f63c586] user: drh branch: partial-index-variables, size: 54087
2017-06-27
23:36
Add SQLITE_DBCONFIG_ENABLE_QPSG that forces the query planner stability guarantee. This is the fix for ticket [b9f010107724c] file: [61035ab3] check-in: [b82efd2a] user: drh branch: trunk, size: 54084
16:39
Fix a virtual table problem that can occur when the vtab is on the RHS of a LEFT JOIN and there is a MATCH constraint in the ON clause, or when the vtab is in a sub-query that is the RHS of a LEFT JOIN and there is a MATCH constraint in the WHERE clause of the sub-query. file: [837c4a74] check-in: [87b38166] user: dan branch: trunk, size: 54046
2017-06-26
14:46
Make sure sqlite3VdbeSetVarmask() is never invoked when QPSG is enabled. file: [1aac918f] check-in: [ebcfa73e] user: drh branch: enable-QPSG, size: 53967
2017-06-24
18:10
Consider the values bound to SQL variables when determining whether or not a partial index may be used. file: [5567f180] check-in: [7b59c353] user: dan branch: partial-index-variables, size: 53932
2017-05-25
00:08
The TK_IF_NULL_ROW expression node must be treated as a variable that references the table Expr.iTable. Proposed fix for ticket [7fde638e94287d2c]. file: [a2fe3811] check-in: [77fc2301] user: drh branch: trunk, size: 53929
2017-04-11
18:06
Smaller and faster implementation of exprMightBeIndexed(). file: [e913aaa7] check-in: [76cd611d] user: drh branch: trunk, size: 53864
2017-02-11
14:59
Fix indexes on expressions so that they can be actually used with a COLLATE clause. file: [130cdd1a] check-in: [e464b919] user: drh branch: trunk, size: 53524
2017-02-10
21:37
Enhance the LIKE optimization so that it works for arbitrary expressions on the LHS as long as the pattern on the RHS does not begin with a digit or a minus sign. file: [98010982] check-in: [158290c0] user: drh branch: trunk, size: 53520
2017-01-10
17:33
Throw an error if the ON clause of a LEFT JOIN references tables to the right of the ON clause. Fix for ticket [25e335f802dd]. file: [35ad0253] check-in: [c92ecff2] user: drh branch: trunk, size: 53184
15:08
Fix a potential assertion fault discovered by OSS-Fuzz. file: [24e452bc] check-in: [71c03b59] user: drh branch: trunk, size: 53060
2016-12-06
22:47
Performance improvement and size reduction in the Expr node allocator function sqlite3PExpr(). file: [87ecdf24] check-in: [2a81763e] user: drh branch: trunk, size: 53029
2016-11-20
12:00
Prevent a possible use-after-free bug in the query optimizer. file: [c19a84ac] check-in: [0a98c8d7] user: drh branch: trunk, size: 53053
2016-10-27
01:02
Make sure left-join markings are transferred to the virtual scalar subexpressions when decomposing a vector comparison in the ON clause of a LEFT JOIN. Fix for ticket [fef4bb4bd9185ec8f]. file: [a83d7015] check-in: [619f5cc7] user: drh branch: trunk, size: 52986
2016-10-03
14:44
Avoid unnecessary memset() calls in the query optimizer. file: [379d0017] check-in: [5bb7cde0] user: drh branch: trunk, size: 52945
2016-09-23
20:59
Use sqlite3ExprAlloc() instead of sqlite3PExpr() for leaf nodes in the expression tree, where appropriate. This is both smaller and faster. file: [3d8813ef] check-in: [afac0709] user: drh branch: trunk, size: 52932
2016-09-06
18:51
Fix corer cases of vector IN operators where the RHS is a compound SELECT that includes an ORDER BY clause. file: [e3db778e] check-in: [8329ac6f] user: drh branch: rowvalue, size: 52930
2016-09-05
12:02
Catch vector size mismatch problems during name resolution to avoid later problems. file: [c5ec87e2] check-in: [56562a03] user: drh branch: early-vector-size-check, size: 52823
09:44
Fix a crash that could occur under certain circumstances if the vectors on either side of a comparison operator were of a different size. file: [571597ac] check-in: [42670935] user: dan branch: rowvalue, size: 52973
2016-08-26
03:42
Comment improvements. Put ALWAYS and NEVER macros on three unreachable branches. file: [7f9ada86] check-in: [39761700] user: drh branch: rowvalue, size: 52881
2016-08-20
12:00
Improvements to the vector comparison splitter in exprAnalyze(). file: [aa54bf11] check-in: [a3ffd283] user: drh branch: rowvalue, size: 52791
00:51
Add support for vector assignments in the SET clause of an UPDATE statement. file: [706b539d] check-in: [f320d47d] user: drh branch: rowvalue, size: 52696
00:07
Change the way TK_SELECT_COLUMN is handled so that the subquery is only generated once even if part of the vector comparison is used for indexing and the other part is now. This change also is a pathway to vector assignment in UPDATE statements. file: [021469f1] check-in: [d8feea7d] user: drh branch: rowvalue, size: 52702
2016-08-19
19:58
Replace the magic number (-2) with its symbol XN_EXPR in the exprMightBeIndexed() routine. No logic changes. file: [bb22074c] check-in: [d4a5af69] user: drh branch: rowvalue, size: 53485
2016-08-11
12:31
Merge recent changes from trunk. file: [8d9903d1] check-in: [959677b9] user: drh branch: rowvalue, size: 53464
2016-08-10
20:02
Optimization to sqlite3WhereExprUsage(). file: [98ce9f3b] check-in: [95493058] user: drh branch: trunk, size: 50116
19:43
List of MATCH operator names in isMatchOfColumn() should be constant. file: [600e6c61] check-in: [7319d676] user: drh branch: trunk, size: 50057
2016-08-02
16:18
Add missing comments and make some code on this branch clearer. file: [4a8cefc7] check-in: [6937677c] user: dan branch: rowvalue, size: 53392
2016-08-01
16:37
Fix a problem with IN(...) constraints where the LHS is a sub-select that is an aggregate query. file: [3f5d76b5] check-in: [1f4dba87] user: dan branch: rowvalue, size: 52728
2016-07-30
16:39
Remove the EP_Vector expression flag. file: [82196ee8] check-in: [e9d9c6d4] user: dan branch: rowvalue, size: 52148
2016-07-29
20:58
Fix some issues with vector range constraints and the column cache. Also vector range constraints and rowid columns. file: [c63e0e48] check-in: [42607366] user: dan branch: rowvalue, size: 52186
18:12
Change the way "(a, b) = (SELECT *)" expressions are handled in where.c if there is an index on one of the columns only. file: [a58e878d] check-in: [4dfebff2] user: dan branch: rowvalue, size: 52050
2016-07-28
19:47
Fix further issues with multi-column IN(...) operators. Also some error handling cases surrounding row values. file: [bc85d04c] check-in: [cc3f6542] user: dan branch: rowvalue, size: 52002
2016-07-26
18:06
Fix where.c handling of "IN (SELECT ...)" expressions when the SELECT returns more than one result column. Also error handling for other row value constructor cases. file: [b896f8ff] check-in: [061b8006] user: dan branch: rowvalue, size: 51950
2016-07-09
20:23
Add some support for using row value constructors in certain parts of SQL expressions. There are many bugs on this branch. file: [d88ee6ce] check-in: [b2204215] user: dan branch: rowvalue, size: 51431
2016-06-28
22:27
Proposed fix for a problem in the query planner. file: [d7dcbf14] check-in: [a33d2356] user: drh branch: planner-fix, size: 50044
2016-05-28
18:53
Experimental change to allow virtual tables to take advantage of LIKE, REGEXP and GLOB terms that are part of OR expressions within WHERE clauses. file: [c32d4708] check-in: [242507b4] user: dan branch: vtab-experimental, size: 50176
2016-04-12
00:00
Performance improvements in sqlite3WhereExprUsage(). file: [eacc0e60] check-in: [fdf75239] user: drh branch: trunk, size: 50097
2016-04-08
21:35
Attempt to treat the arguments to a table-valued function as if they occur in the ON clause of a LEFT JOIN rather than in the WHERE clause. But this causes undesirable behavior with generate_series, as demonstrated by test cases. This is an incremental check-in pending further work. file: [2a0b17d8] check-in: [00ac73a0] user: drh branch: tabfunc-in-left-join, size: 50169
2016-02-19
14:10
Make sure WhereClause objects are fully initialized before use when planning OR queries. file: [fb87944b] check-in: [16205302] user: drh branch: trunk, size: 50065
2016-02-05
13:38
Add the slightly faster sqlite3DbMallocRawNN(db,n) routine for the majority cases where db is guaranteed to be not NULL. file: [de117970] check-in: [0a802e96] user: drh branch: oom-handling, size: 49951
01:55
Improvements to the way that OOM errors are processed. file: [85ee2de9] check-in: [c3ef0347] user: drh branch: oom-handling, size: 49947
2016-01-19
17:54
Fix two harmless compiler warnings about comparisons of dangling pointers. file: [197a448b] check-in: [86944f19] user: drh branch: trunk, size: 49985
2015-11-24
18:16
Fix a problem in whereexpr.c causing a crash while processing a user-function taht accepts zero arguments. file: [eebba834] check-in: [069e51b1] user: dan branch: vtab-like-operator, size: 49917
17:39
Add further tests and related fixes for GLOB/REGEXP/LIKE support in virtual tables. file: [17d62d8b] check-in: [c5e9fd0d] user: dan branch: vtab-like-operator, size: 49905
2015-11-23
21:09
Add experimental support for LIKE, GLOB and REGEXP to the virtual table interface. file: [12c6fa75] check-in: [277a5b40] user: dan branch: vtab-like-operator, size: 49706
2015-11-21
17:27
Fix over-length source code lines. No logic changes. file: [bd4877cd] check-in: [198d191b] user: drh branch: trunk, size: 49145
13:24
Do not allow table-valued function syntax on ordinary tables and views as those objects are not table-valued functions. Fix for ticket [73eba7ba5c7c0fc]. Problem found by libFuzzer. file: [fa36d793] check-in: [ff5716b8] user: drh branch: trunk, size: 49144
2015-10-08
02:44
Remove two unused lines of code - discovered by scan-build. file: [e63244ca] check-in: [77b707b7] user: drh branch: trunk, size: 49141
2015-08-31
15:58
Improved analysis and usage of indexed expressions in the query planner. file: [2473e435] check-in: [f8893696] user: drh branch: index-expr, size: 49192
2015-08-27
18:24
Activate the ability to use expressions in indexes in a query. There are some test failures, but mostly this seems to work. file: [990ed42b] check-in: [42f93f58] user: drh branch: index-expr, size: 47602
2015-08-21
17:14
Fix a corner-case bug in table-valued functions. Update the generate_series() virtual table to increase the performance estimate penalty for being underspecified. file: [1a308d1e] check-in: [552bc9cb] user: drh branch: trunk, size: 47356
2015-08-20
23:21
Fix corner-case memory management issues in table-valued functions. Change virtual table handling so that if xDestroy is missing the table is eponymous only even if xCreate is present. file: [f9dbd159] check-in: [774e6a14] user: drh branch: trunk, size: 47330
2015-08-19
17:11
A list of arguments following a table name translates into equality constraints against hidden columns in that table. file: [6332ade8] check-in: [40e12cfe] user: drh branch: table-valued-functions, size: 47328
2015-06-08
14:23
Split more subfunctions of where.c out into a new whereexpr.c source file, for improved maintainability. file: [9ce1c9cf] check-in: [46ef95c1] user: drh branch: view-optimization, size: 46061 Added