aboutsummaryrefslogtreecommitdiff
path: root/src/expr.c
Commit message (Collapse)AuthorAge
...
* The ALTER TABLE fix of check-in [7e5ad8e0ab7ee91a] is no longer needed duedrh2020-04-07
| | | | | | to the changes at check-in [4cf8721f5ceb1fda]. But, we keep the defense in place as an assert() for extra safety. FossilOrigin-Name: 230556e859536bbadf0daf8133a9a01ef4f03148b3296723e37bad66e3fc3d82
* Remove dead code that was added during initial development of RENAME COLUMNdrh2020-04-07
| | | | | but never actually served a purpose. FossilOrigin-Name: c95c4cda4640f05d61b13b4e60494dec07d4483734fc41ffcce73fb5163cbb0d
* When running ALTER TABLE, avoid adding some internally generated tokens to ↵dan2020-04-06
| | | | | the token map to improve performance on schemas with nested views. FossilOrigin-Name: 4cf8721f5ceb1fdaefdc355b3211f75c53c4cdf9d2582ca70fc96777a9b057c2
* Avoid factoring out constant expressions on the LHS of an IN(...) operator, ↵dan2020-04-03
| | | | | as the IN(...) operation may affect the affinity of these values. FossilOrigin-Name: 98d56b4a34fddcbaecd953a045ae0270b4d78c1edf34cc73522fb4e12743af80
* Reinstate the optimization that converts "x IN (y)" into "x==y".drh2020-03-26
| | | FossilOrigin-Name: 27936e6884e77093533719c7955a17f051cfb359872e51a6d1481152e6256443
* Rename sqlite3ExprCodeAtInit() to sqlite3ExprCodeRunJustOnce().drh2020-03-11
| | | | | Other changes to make the new code cleaner. Test cases added. FossilOrigin-Name: d7f18489978fdbbe3ab317485518cac91a75416ccef55898301afdd76d3b415b
* Do not factor out constant functions into the initialization section at thedrh2020-03-11
| | | | | | | end of the prepared statement, be cause if they throw an exception, it will abort the statement even if the function is never called. Better to put constant functions in an OP_Once block. FossilOrigin-Name: 97a18a5cd701848a9660385e31bffe2c397e3cfe57ccdb876f44d08c00d1d39a
* This variant to the fix for ticket [e0c2ad1aa8a9c691] uses fewer CPU cycles.drh2020-03-11
| | | FossilOrigin-Name: fb5a8a9edd0a4f979d6c30278d4ddc73c651f56ae989b4e5983fca36887c5ceb
* Enhanced detection logic for preventing the use of static schema expressionsdrh2020-03-10
| | | | | by code generating routines. FossilOrigin-Name: 5f60b527b938c0778e8f725c635ce0dc5ed7a4e01fd6252aa2cdb64da2f625bc
* Make a copy of the expression that defines a value of a generated columndrh2020-03-10
| | | | | before sending it to the code generator routines. FossilOrigin-Name: 03d201c041c17579e791c73fe6babd60b9f892a84ffd1470851f8eb2857d3990
* Apply the correct affinity transformations when pulling values off of thedrh2020-03-10
| | | | | sorter index used for GROUP BY. Ticket [e0c2ad1aa8a9c691] FossilOrigin-Name: 101f7dea75a203f1f3aa422a607ef701eb0901ba4d5e8d1075cd350454a61956
* The sqlite3ExprCodeFactorable() routine should make a copy of non-factorabledrh2020-03-10
| | | | | | expressions, as they might be coming from a DEFAULT or generated column in a table constraint. FossilOrigin-Name: a2d6f108c5d07559b125823a04c9cb072c80be80d7913097891a6192c7e1e225
* A better (smaller and faster) solution to ticket [4374860b29383380].drh2020-02-17
| | | FossilOrigin-Name: abc473fb8fb999005dc79a360e34f97b3b25429decf1820dd2afa5c19577753d
* Take care when checking the table of a TK_COLUMN expression node to see if thedrh2020-02-17
| | | | | | table is a virtual table to first ensure that the Expr.y.pTab pointer is not null due to generated column optimizations. Ticket [4374860b29383380]. FossilOrigin-Name: 9d0d4ab95dc0c56e053c2924ed322a9ea7b25439e6f74599f706905a1994e454
* Extend the OP_Copy-coalesce optimization fix of check-in [b36126c1889e323c]drh2020-02-04
| | | | | | so that it is also correctly disabled by the CASE operator. Ticket [9d3666754ac37d5a]. FossilOrigin-Name: 29a969d6b1709b80d9cb88b60971e4eb021f7f5f8ee9a619be74b833a78a35ef
* Merge in the untrusted-schema enhancements.drh2020-01-09
|\ | | | | | | | | | | See [/doc/87aea3ab1cdda453/doc/trusted-schema.md|doc/trusted-schema.md] for details. FossilOrigin-Name: 5720924cb07766cd54fb042da58f4b4acf12b60029fba86a23a606ad0d0f7c68
| * Block edgy functions used in DEFAULT constraints.drh2020-01-08
| | | | | | FossilOrigin-Name: da434dc149786e4b1cd80b3b2b25f8b614d0dec62d5439f839a66b536999e398
| * Performance improvements and test cases added. Allow "PRAGMA trusted_schema=ON"drh2020-01-08
| | | | | | FossilOrigin-Name: 30882ca80f6c51f6bb7b2692c1ac3f19a7c61a23aa8730be79aec0ae3ef08d54
| * Check for whether or not it is safe to use non-innocuous functions as thedrh2020-01-08
| | | | | | | | | | function is being coded, not when its name is resolved. FossilOrigin-Name: 1da802d54b689a462e1fe899c6ffa08ef14d34f36728b14b055b5a76b1edc274
* | Fix an assert() in window.c that could fail with some obscure SELECT ↵dan2020-01-09
|/ | | | | statements that use window functions. FossilOrigin-Name: 83dc55679a91bf5d1d13706088ce58eed02b9aad1ad0ae237966e78e0d769663
* Backout change [4d0b9109f7a5312d4e1] because the conditional it added isdrh2020-01-06
| | | | | no longer reachable due to check-in [1409758f72c0206c]. FossilOrigin-Name: b3f2696705cc3e7b038f156423f808432a4680ea7e313dc15e34bdf6b1845655
* Fix a false-positive in the register validity tracking logic by moving thedrh2020-01-04
| | | | | | temporary register release call before the jump that uses that temporary register. FossilOrigin-Name: 9da48a5ca66dc67c8f7fb2d2471dac7ea696e35ecba5ddf65747d08d452436c1
* Fix the OP_Copy-coalesce optimization so that if the previous row happensdrh2020-01-03
| | | | | | to end with OP_Copy but is not a candidate for the optimization due to jumps, then the optimization is correctly bypassed. FossilOrigin-Name: b36126c1889e323c9a8f04b4f4884576993c845e7d393e5e73aaa6ab5158c1f9
* When generating the name of a view (or common table expression) because thedrh2020-01-03
| | | | | | | SQL does not specify a name, avoid the names "true" and "false" which might be confused for the boolean literals of the same name, leading to an inconsistent abstract syntax tree. FossilOrigin-Name: ff9492d3ff733c222ea67f23d478df1547641b5e2e6dd870b0b29e25c13f3739
* Merge the latest enhancements from trunk.drh2020-01-02
|\ | | | | FossilOrigin-Name: bd57e6d923d3b04f0a07aaf18bf389d2b2b7efc7c57e8cb37e6ef910662d8397
| * Have the OP_ReleaseReg opcode also invalidate the registers if P5 is non-zero.drh2020-01-02
| | | | | | FossilOrigin-Name: 937be22106f7e3f08712febd342d6cb81d129f2d5ab24ce80b3a5c3f9bbde54e
| * Use OP_Copy instead of OP_SCopy to move the results of a scalar subquery.drh2020-01-02
| | | | | | FossilOrigin-Name: 435c272dcf6ed5f3acb564b8f959557145f117b869547b670258cf5a1908ab6b
| * The sqlite3WhereEnd() call now unwinds all Expr modifications made by thedrh2020-01-02
| | | | | | | | | | sqlite3WhereBegin(). FossilOrigin-Name: 7bfd42f1dc0c94f9bb74516e62fec8e39c20f4749f4e0972f66c2886d3c64f73
| * When generating code for a subquery, make a copy of the Select object anddrh2020-01-01
| | | | | | | | | | | | generate the code out of the copy, in case the code generator makes modifications to expression and the Select object needs to be reused. FossilOrigin-Name: 4edddcc0bc8d71e9b8abac67bc3766f1d9143dddd1f59264859ce65e5aa9b8c6
| * Fix the sqlite3ExprImpliesNonNullRow() routine so that it correctlydrh2020-01-01
| | | | | | | | | | handles a numeric comparison of two AND subexpressions. FossilOrigin-Name: 07e504d5174a1a8b1aa05ec5b44ac81ab3ea706c5a098caa88deb3d489cec8fb
| * New test-only SQL functions: implies_nonnull_row(), expr_compare(), anddrh2020-01-01
| | | | | | | | | | | | | | expr_implies_expr(). The SQLITE_TESTCTRL_INTERNAL_FUNCTIONS test-control is modified to toggle internal function access on and off for a single database connection. FossilOrigin-Name: 473892a8eceacf24d57fd0c72ff2a0b8be4e0d75e0af7a30bdb24fbc3b453601
| * Factor out code generation for in-line SQL functions into a separate routinedrh2020-01-01
| | | | | | | | | | inside of expr.c. FossilOrigin-Name: 586a65a28fc6cac77309612abc32a2e1017c65e0387f9f438f5d8ac8406da8eb
* | Merge recent enhancements from trunk.drh2019-12-31
|\| | | | | FossilOrigin-Name: 39d55579376906f212271ce9b2d367e3ad029fb173f22c7253312b467970208a
| * Back out the NEVER() from check-in [40d10e7aad5b8992] because it is reachabledrh2019-12-30
| | | | | | | | | | after all. Ticket [892575cdba4e1e36] FossilOrigin-Name: f481636f1a0333c6e98906e5d4433bf1d046380bc29c760e8e7e2c2b3530b956
| * Put a NEVER() on a defensive branch.drh2019-12-30
| | | | | | FossilOrigin-Name: 40d10e7aad5b899206e45d1f8606470a90a07049e15d94c3811cfe695f3a402e
| * In ALTER TABLE, rename columns and tables in expressions that are optimized ↵dan2019-12-30
| | | | | | | | | | out by the "AND 0" optimization. Doing this also fixes an otherwise harmless assert() failure. FossilOrigin-Name: a9e0354c992b0287608ddd18fd35fe7e6102a8f293d6e6e1b3488644bcda8168
| * Convert an assert() back into a conditional. The conditional was converteddrh2019-12-28
| | | | | | | | | | | | | | into an assert() by check-in [6ae4ad6ebee4db88] (2009-05-28) because we were unable to find a test case for it. Yongheng's fuzzer just now found that test case. FossilOrigin-Name: 4d0b9109f7a5312d4e136395e08b11dad64d746bc106ad44d47675e5b1dcb4ef
| * Remove a NEVER() that is no longer true. Fix for [36ffedcb9].dan2019-12-27
| | | | | | FossilOrigin-Name: 597896ed0ae9e2960a8f39576bd7f77a11dccc1da84b6a44ebb5c38d90ebc330
| * When determining if an aggregate within a sub-query should be processed as ↵dan2019-12-27
| | | | | | | | | | part of the sub-query or an outer query, consider any FILTER clause in the same way as the arguments to the aggregate. FossilOrigin-Name: 1ffc045d2bbeeda9c13a3a3585538ff6434fc852b0ae6679d3c8b9f606bf92e6
| * When the sqlite3WindowRewrite() routine detects and error, have it convertdrh2019-12-25
| | | | | | | | | | | | | | | | the SELECT statement into just "SELECT null" so that it does not leave the parse tree in a goofy state that can cause problems with subsequent code before the stack has a chance to unwind and report the error. Ticket [d87336c81c7d0873] FossilOrigin-Name: fa58aad48a788802b13a819e49f9b8787f713bbe395c46c7295e821c52c81738
| * Extra defense against problems following an OOM. dbsqlfuzz find. Alsodrh2019-12-24
| | | | | | | | | | import the latest dbsqlfuzz test cases. FossilOrigin-Name: 0a70f5ddaf3567f335cc0fd0fcd5303e2afb5e38a6388faddf5cab1f2a74e3dd
| * Fix a case in which SQLite could fail to identify "x BETWEEN ? AND ?" being ↵dan2019-12-23
| | | | | | | | | | true as implying that x is not null. Ticket [dfd66334]. FossilOrigin-Name: 2f17974912ec5e99089dc0da803e7ff1bf033377a49762d2689a812c005f2641
| * Enhance the sqlite3VdbeMemAboutToChange() shallow-copy validation mechanismdrh2019-12-23
| | | | | | | | | | | | | | | | | | | | | | by adding the new OP_ReleaseReg opcode to tell MemAboutToChange() that a range of registers is no longer needed so that the source register can be freely changed. This is a change to debugging and test builds only and does not impact release builds. Fix for ticket [c62c5e58524b204d] and [5ad2aa6921faa1ee]. The previous fix to ticket [5ad2aa6921faa1ee] is backed out by this change since this change is a better fix. FossilOrigin-Name: 36fdeb4f0a66970a35de688b617f90899c89cfdfab659f864df99aa7ebf854ea
| * Change the code generator for the IN operator so that it avoids creatingdrh2019-12-22
| | | | | | | | | | | | OP_Eq and OP_Ne opcode with the same P1 and P3 arguments. This enables us to back out check-in [ddb17d92df194337] and also fix ticket [188f912b51cd802]. FossilOrigin-Name: 9ab985a9c8160b905730678f40ed440a246cdec549c798bafefaed5abbc0437f
| * Make a hard copy of strings in constraint checks prior to applyingdrh2019-12-22
| | | | | | | | | | | | | | | | | | OP_RealAffinity, to avoid problems with a pointer accounting assert. This change is not strictly necessary - the correct answer is obtained without it and no UB occurs - however the pointer accounting asserts are useful to prevent other problems so it is a simple matter to bring this piece into compliance. Ticket [5ad2aa6921faa1ee] FossilOrigin-Name: 89a9dad6330270a4c3b962f86a208088d2ea9883c7d291351a77f058e0ed8b0c
| * When parsing a CREATE TABLE from the sqlite_master table, delete the CHECKdrh2019-12-22
| | | | | | | | | | | | | | | | constraints if there are any errors, since there might otherwise be attempts to use those CHECK constraints if PRAGMA writable_schema=ON is set. This undoes the fix in check-in [ea721b34477ab8b4] for a more general solution. FossilOrigin-Name: a982e6434cd66bfbe94d455f538bcbc4360b91572062d92acae6b77e9560e65d
| * When a corrupt schema is loaded using writable_schema=ON, the CHECK constraintsdrh2019-12-21
| | | | | | | | | | | | | | (or other expressions in the table definition) might not be fully resolved. Ensure that the code generator can deal with this if the table is subsequently used in a DML statement. dbsqlfuzz find. FossilOrigin-Name: ea721b34477ab8b49d182352c4bc198245933b850e9b6248b4f97600e80bb44b
| * Apply real affinity to generated columns of type REAL that are extract fromdrh2019-12-20
| | | | | | | | | | an index. Ticket [e0a8120553f4b082] FossilOrigin-Name: 728ad39e3bd07a2503a95c68ed5bbc3f28fd97551d59f12a5fab25dc68227e99
| * When an error occurs while rewriting the parser tree for window functionsdrh2019-12-19
| | | | | | | | | | | | | | | | in the sqlite3WindowRewrite() routine, make sure that pParse->nErr is set, and make sure that this shuts down any subsequent code generation that might depend on the transformations that were implemented. This fixes a problem discovered by the Yongheng and Rui fuzzer. FossilOrigin-Name: e2bddcd4c55ba3cbe0130332679ff4b048630d0ced9a8899982edb5a3569ba7f
| * Change an unreachable testcase() into an assert()drh2019-12-18
| | | | | | FossilOrigin-Name: 062e00c4d7e30155299339eaefe6cbe01953894baebf0af6d7ab3295b7436eb7