aboutsummaryrefslogtreecommitdiff
path: root/src/expr.c
Commit message (Collapse)AuthorAge
...
* Address various harmless compiler warnings fromdrh2023-06-16
| | | | | [forum:/forumpost/d526da8ee4|forum post d526da8ee4]. FossilOrigin-Name: 365caf2f97e8f15842f52536e8d05d359e9d6e863182e020ce14a9a9f27ee057
* Improved sqlite3_error_offset() values for bare column errors on '*' anddrh2023-06-13
| | | | | 'table.*' expressions in SELECT statements. FossilOrigin-Name: 118fe600876686273f85d0a080a21267e83c11826365f3220336b1bd39562518
* Fix straggler misspellings and tidy the custom dictionary. Also include ↵larrybr2023-06-07
|\ | | | | | | | | pickups from [forum:/info/c61fb09afd|forum post c61fb09afd]. FossilOrigin-Name: 8c291d99946eb32b20b743921202f9c7cfb716268ff526817b27adbb7942e40b
* | Add a C-source spell-checking facility. make misspell (on Nix)larrybr2023-06-07
|/ | | FossilOrigin-Name: 26c1bb4bd9e9f56613c3aa87407a7f562fd4ebde5bfd6dece02078001d9a45f8
* Restore the LEFT JOIN strength reduction that was partially lost indrh2023-06-02
| | | | | [d747afda5683ca5f] when strength reduction was generalized to all OUTER JOINs. FossilOrigin-Name: 2d962b84dd8ac2d0968f0283f8f082c1c2a7a1f99b59053b2ad8f58745396447
* Fix the OUTER JOIN strength reduction theorem prover's handling of the CASEdrh2023-06-02
| | | | | operator. FossilOrigin-Name: 73d7b14b1713d93c4ae07995e9aa6485cbad90bd6125584dbaeccb0cc9410ea3
* Generalize the LEFT JOIN strength reduction optimization so that it works fordrh2023-06-01
| | | | | | RIGHT and FULL JOIN as well. Rename it to the "OUTER JOIN strength reduction" optimization. FossilOrigin-Name: d747afda5683ca5feb92866a14ccc4c5127d3378ece5cad2c3da819f2477b457
* Add an ALWAYS() on an unreachable branch.drh2023-06-01
| | | FossilOrigin-Name: a00928d48061c1169d5564996e19e7d7c2b962842100bb119846d0f696123c23
* Fix the LEFT JOIN strength reduction for IN operators in the WHERE clause.drh2023-06-01
| | | | | Further simplifications and refinement of the algorithm. FossilOrigin-Name: 96c72dde79d4069f6c2f81467a35b617633f86f7a7dcafbda991affdaa1f8537
* Add a comment to explain why both sides of an AND must be non-null-row in orderdrh2023-05-31
| | | | | for the overall expression to be non-null-row. No code changes. FossilOrigin-Name: 8396032ce14a75f408f0a75bcb36a6504d5188f20886e275746a2c336a74296f
* Improved detection of when the LEFT JOIN strength reduction optimizationdrh2023-05-31
| | | | | can be applied. FossilOrigin-Name: f544a8e47cdd5ad7233887a558489983f4f305a39391ff463c43e2e4157da087
* Avoid performing aggregate processing more than once for a single ↵dan2023-05-23
| | | | | expression. [forum:/info/36ff78b2a3|Forum post 36ff78b2a3]. FossilOrigin-Name: 367b4cc549a14222d54530538e692e9d1a365002c1b8c4ef80ddc0523bfdb3a2
* New assert() statements to verify that Expr.iColumn is never used as andrh2023-05-17
| | | | | array index when its value is negative. FossilOrigin-Name: 6084c5fb6d3fcedf35cd6c597a44ec7bf8b4a2576c7b277e5342d2a7905318e7
* Fix two assert() statements that failed to take into accountdrh2023-05-17
| | | | | the likely() built-in function. This does not impact production code. FossilOrigin-Name: 8504fe812c5b4956c8acad515d537add54cb591bc81747113f9b24526d7685b8
* As evidenced by [forum:/forumpost/f3f546025a|forum post f3f546025a], thedrh2023-05-15
| | | | | | | | | new RIGHT JOIN related restriction on the push-down optimization implemented by [da3fba18742b6e0b] also needs to apply to the automatic index (a.k.a. hash-join) optimization and to the Bloom filter optimization. Computation of the restriction is now moved into the sqlite3ExprIsSingleTableConstraint() routine. FossilOrigin-Name: 4902015dcf3869f08d9986e422faa231d9218a5e0fc59ba8df0f407e4eb3d605
* Remove a stray CR from end of line in a source file.drh2023-05-12
| | | FossilOrigin-Name: 48139fb904de4b7b383e7f8c29bed83ad878eb22b1dd773c366a0aee74613d23
* Rename sqlite3IsTableConstraint() to sqlite3IsSingleTableConstraint() anddrh2023-05-10
| | | | | | improve its header comment, in an attempt to make the code easier to reason about. No functional changes - should generate identical machine code. FossilOrigin-Name: 5dae897431a0a9dbb354c4a8a48f935ea7438035d96f90b83dd81eae434c8277
* Do not apply the "AND false" optimization if either operand comes from thedrh2023-05-01
| | | | | | ON clause of a join. Fix for the problem identified by [forum:/forumpost/96cd4a7e9e|forum post 96cd4a7e9e]. FossilOrigin-Name: d095da0e7a24e3bcab6495d964f76a86d7a5910d2d6edddc6e8092bfa6084fe6
* Fix a code-generator issue associated with very unusual use of windowdrh2023-04-13
| | | | | | | functions. Both the expr.c or the window.c changes will each independently fix the problem. They are both included in this patch for defense in depth. [forum:/forumpost/0d48347967|Forum post 0d48347967]. FossilOrigin-Name: 1ba22631a7831e3562eda0eb6a5edf7f009c85c7ab4451d9eacd13ef0fb6036a
* Remove an ALWAYS() that can sometimes be false. Add a test case that makesdrh2023-04-11
| | | | | the test false. FossilOrigin-Name: c8fb143d64d8e823684cd26799080da4b42bef121ca3c6315b1803a593490926
* Fix a harmless compiler warning.drh2023-04-08
| | | FossilOrigin-Name: c9559ba62191fe7fa2a718233afaa841e2594d1fc833314bf5b0a6b775e87c35
* Work around a harmless assertion fault associated withdrh2023-04-06
| | | | | | | | | sqlite3VdbeMemAboutToChange() such that the detection of stale values in registers is preserved in debugging builds, but we avoid a false-positive assertion fault in cases involving a virtual table with a LIMIT clause in an IN-operator loop. dbsqlfuzz 3fd70d4ab4950acf1deb8f610a7a7c67cd38713b FossilOrigin-Name: 56ea2c2fe6108d39833ac40957afab59ade01a216639d5bafdeeca53bbf4cd67
* Remove an ALWAYS() that might now be false due to the prior check-in.drh2023-04-05
| | | FossilOrigin-Name: fc68993501aaa7180f5457dcb3c296e5b199904a385d98e2bcad7854e34d428e
* Fix the function that determines the collating function for an expressiondrh2023-04-05
| | | | | | | tree to handle new cases that arise as a result of the recently added ability to use indexed expressions in aggregate queries. [forum/forumpost/0713a16a44|Forum post 0713a16a44]. FossilOrigin-Name: cc5041f3f067cf610adffb868b4e2d1b5d248dc5a0ecc551339b670800ecb0ff
* Remove an assert() statement that is no longer valid due to enhancementsdrh2023-04-04
| | | | | | to query planner for improved use of indexes. [forum:/forumpost/dc16ec63d3 |Forum post dc16ec63d3]. FossilOrigin-Name: 2b23dd249d0bc254308f5539936d33ee558f1100dec616caac7317dbe70db761
* When translating arguments of aggregate functions into references todrh2023-04-03
| | | | | | | 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
* Earlier error detection for index expression usage by aggregate functions.drh2023-03-30
| | | | | dbsqlfuzz 29214ace4e25c98d2ddff8fbcf97afdda23f28b9 FossilOrigin-Name: 8e841e7f025f7205959453875f2d9db36271642045593970a2b2fc20b2f847c3
* Fix a crash that could follow an OOM error while processing aggregate functions.dan2023-03-30
| | | FossilOrigin-Name: 804435a2731bd3c26278c47098854b9ee7727a686587f6208e793738fbfc0555
* New #ifdefs to omit code that is unused except under STAT4.drh2023-03-29
| | | FossilOrigin-Name: 09a9b30ba7828a487a33a3ebf8028dfaa147dff67d2724584123b90a88d9814b
* Fix a weird corner case in aggregate function processing that results from thedrh2023-03-28
| | | | | | recent addition of support for index expressions on aggregate queries. [forum:/forumpost/bad532820c|Forum post bad532820c]. FossilOrigin-Name: c34fd9fe1b76e0a5943f014f46141cbe55d41bb1e6980adf9bcb6785a03e7883
* Improvements to register allocation, especially in the ANALYZE command.drh2023-03-26
| | | | | | New assert() statements added to help verify that memory allocation is correct, and to help fuzzer find lingering errors. FossilOrigin-Name: 6f8b97f31a4c8552312b4c98432ea356ae54c06d9cc929969f50c3c88360cd7b
* Add usage detection to the NULL value generator for the left table of adrh2023-03-25
| | | | | RIGHT JOIN inside of an aggregate. FossilOrigin-Name: 4d05a009dfb63bcb4173da4d09ccc00c308ce4dd2534a32aeb23c5d8d6a1fd4b
* When the left table of a RIGHT JOIN is used inside an aggregate functiondrh2023-03-25
| | | | | | | | and the left table employs an index on expressions, then make sure the expressions evaluate to NULL for the cases where the left table should be NULL. Proposed fix for [forum:/forumpost/9b491e1deb|forum post 9b491e1deb]. More testing an analysis needed - there is a FIXME in this check-in. FossilOrigin-Name: 3572b40a7dfc4acc35e72e08e79f64688f8737e57ac89e4d10e6b32bd5178c63
* In the byte-code, when the result of an expression needs to be in a particulardrh2023-03-25
| | | | | | | | register, always use the sqlite3ExprCode() routine because it has the smarts to know whether to use OP_Copy or OP_SCopy. Do not try to OP_SCopy inline because an OP_Copy might be required. Fix for the problem identified by [forum:/forumpost/5522082cfc|forum post 5522082cfc]. FossilOrigin-Name: c104e5c6eeb89575319d9f94f49446142b06912fa8b283c19d46aa2ccddc5bda
* A better fix for the sqlite3_error_offset() problem on generated columns.drh2023-03-20
| | | FossilOrigin-Name: 770b3e67c89ca16b08a9234acb626917a26ea414b3bc0340f9601644cb7504f2
* Expression errors in generated columns should not generate non-negativedrh2023-03-20
| | | | | | sqlite3_error_offset() returns. Second of two defenses against [33aa4c0de8a62e33]. FossilOrigin-Name: 2adb4e0dda471ffc9b2a5cbad01b6c2bc6091b7526a8c8b19944cb2d4a5111e7
* Fix Bloom filters on an expression index. drh2023-03-14
| | | | | | [forum:/forumpost/2e427099d5|forum post 2e427099d5] and [forum:/forumpost/d47a0e8e3a|forum post d47a0e8e3a]. FossilOrigin-Name: c028fb669a5ae34dbaf50fffab1ae49bc568b994435cf02e145d24da3cfb48d7
* Fix a typo in a comment. No code changes.drh2023-03-10
| | | FossilOrigin-Name: 76acc075402aac2d14d8279b8095008a842522a0985fdf89200da4339757a40b
* Do not use an expression index on a generated column if generated columndrh2023-03-03
| | | | | has the wrong affinity. dbsqlfuzz 65f5eb57f8859344d5f1f33e08c77ee12960ed83 FossilOrigin-Name: e95439119ac200cb47d0e277622f41ee7986b364487cd252b485ce5fa030d70f
* When flattening the right operand of a LEFT JOINdrh2023-03-02
| | | | | | | | (check-in [41c27bc0ff1d3135]), ensure that the OP_IfNullRow opcode does not NULL-out a subquery result that was computed within OP_Once. This fixes the problem problem reported by [forum:/forumpost/402f05296d|forum post 402f05296d]. FossilOrigin-Name: 8fe13f7a5e5eb798189acb25a608df7a94c2f5cc83463331a048b779c7890c82
* Follow-up to [bbaf1f2eb1e1637b]: Make sure subtypes do not cross a subquerydrh2023-03-01
| | | | | | | boundary even if the function that returned the value with a subtype is buried down inside a larger expression. This fixes a problem identified by [forum:/forumpost/37dd14a538|forum post 37dd14a538]. FossilOrigin-Name: e72661eb680ea707a839cb3d5cf6c7ef03706e7b40af1b84760147e59cd61a50
* The "flexnum" affinity that was added by [44135d6ea84f7ba6] needs to alsodrh2023-02-09
| | | | | | be added to the output of the affinity() built-in function. dbsqlfuzz d309eaa5fe492c9606a8be876c2bc7dedb29d3d8 FossilOrigin-Name: f4ec68ceefa3a607f37d6355aac89fd1ae1704da4061bad7f271db1f17c1dd3a
* Improvement to the dbsqlfuzz fix of [f113eebdbe68246f].drh2022-12-20
| | | FossilOrigin-Name: 79d62956f206cb2987891d4ba5985cece21fc8c8c1158f46c2951f65c0dcf4e8
* Do not use indexed expressions to replace the expression being indexed on adrh2022-12-20
| | | | | | RIGHT JOIN as that leads to problems, as shown by dbsqlfuzz a644e70d7683a7ca59c71861a153c1dccf8850b9. FossilOrigin-Name: f113eebdbe68246fd38d640b0cdf0fd73ab5d2abad9226274dfa2e41fe286bf0
* Fix an unnecessarily restrictive assert() in the aggregate logic.drh2022-12-17
| | | | | dbsqlfuzz 699bee2aa26c5dc84afabf6894685c316d936485 FossilOrigin-Name: 8cc0af81ad03ac65f230d78cf97e1448c2d93d556467ea3ef700d5abd4a3890c
* Create a new affinity called FLEXNUM that works like NUMERIC except that itdrh2022-12-15
| | | | | | | | | never tries to convert integer to real or real to integer. The affinity is only used internally - it is not possible to create a table column with this affinity. This affinity is used on subqueries and views that are built off of a compound SELECT and where the datatype is controlled by a CAST expression. dbsqlfuzz c9ee6f9a0a8b8fefb02cf69de2a8b67ca39525c8 FossilOrigin-Name: 44135d6ea84f7ba6b36549954b38a8bc048d5ffea5a9779e35950afa4eb2dfb2
* Fix minor problems in the new sqlite3ExprDataType() function.drh2022-12-14
| | | FossilOrigin-Name: c1d5261b222bbf94c20e558089f3d2eae6a88b6d739225ee4f7d0338e0e59994
* If the SELECT that implements a subquery or a VIEW or a CREATE TABLE AS isdrh2022-12-14
| | | | | | a compound with different result datatypes on two or more arms of the compound, then the overall column type becomes BLOB (ANY). FossilOrigin-Name: 6ebb178c6b688ebd632e91a5ec4c748567833037c679ab3d72fb770deb230fe1
* Slightly faster implementation of sqlite3ExprAffinity().drh2022-12-13
| | | FossilOrigin-Name: 01cf3278c9c00dddcac67aa4b22ca26a52c31932cba35daa634a56b4c264bdeb
* Add loops and rows counters to "USE TEMP B-TREE FOR ORDER BY" records. Also ↵dan2022-12-05
| | | | | fix the sqliteHwtime() function so that it returns a 64-bit value. FossilOrigin-Name: 41a0e05e8c0fca3b803fe4bd017a157c172b2ca518356a2a4d4ed4f12d01a1e3