summaryrefslogtreecommitdiff
path: root/src/expr.c
AgeCommit message (Collapse)AuthorLines
10 daysRemove an unnecessary branch added by [116a220245].dan-6/+1
FossilOrigin-Name: bf5d2f9f26948bde49bf1271061553a628599def1dbf7989f84562be541e67fb
10 daysFix a harmless compiler warning added by [116a220245803639].drh-1/+2
FossilOrigin-Name: 361598e2d359082340983fe084b6e4369f152eebcb3bb819ee90a71cd64f6a01
10 daysWhen comparing expressions, require that a bound value be the same type and ↵dan-1/+13
bit-for-bit identical as the value is being compared to for the comparison to succeed, just as is done for literal values. Report [bugs:/info/2026-10-28T03:40:05Z | 2026-10-28T03:40:05Z]. FossilOrigin-Name: 116a22024580363939416169f4125d204c61c8d44d186bfdf3aa826d1989faf9
11 daysAvoid applying RealAffinity to a USING column of a FULL JOIN subquery if it ↵dan-3/+8
is materialized. Report [bugs:/info/2026-10-26T12:56:39Z | 2026-10-26T12:56:39Z]. FossilOrigin-Name: e3336dbb4630c5615feba8235ee76318b3b54645f88d031e84b3bb0ab3f3309f
11 daysFix processing of "x IS TRUE" and similar expressions within DEFAULT ↵dan-0/+12
clauses. Report [bugs:/info/2026-11-05T22:15:24Z | 2026-11-05T22:15:24Z]. FossilOrigin-Name: 7111503e9cf26e844cc3787ad6febe3ead434da9cdc5cf1365190703f7c7aef1
11 daysFix long-standing problems with the having-to-where optimization identifieddrh-19/+150
by reports [bugs:/info/2026-10-26T12:58:59Z|2026-10-26T12:58:59Z] and [bugs:/info/2026-10-27T07:19:03Z|2026-10-27T07:19:03Z]. FossilOrigin-Name: 096fafb8e19ece22f59b41855b50977eea2b38035320893a5b9147820ec9ceee
14 daysPut an ALWAYS() on an always-true condition in [c41e45677d75bf49].drh-1/+1
FossilOrigin-Name: 885008f7ff0bc603802340b2240cebf2a633f54ed909b35be65728974fac64e1
14 daysAvoid unnecessary scanning of subqueries in the previous check-in.drh-13/+0
Move the sqlite3SelectWalkFail() routine from expr.c to walker.c for aesthetics. FossilOrigin-Name: ff612271ea1b05042faffbd33decabe69a7846498df62490afb435435724a56e
2026-11-07Add NEVER() to an unreachable branch.drh-1/+1
FossilOrigin-Name: 3ff20c6b2d71838a6d18320517a20ab3d9a14581a52f03d950b0989930e33191
2026-11-07Avoid factoring out constant expressions when replacing a column from the ↵dan-0/+5
RHS of a LEFT JOIN with a value from a partial index WHERE clause, as the value may sometimes be NULL. Report [bugs:/info/2026-11-03T02:14:16Z | 2026-11-03T02:14:16Z]. FossilOrigin-Name: 668fd8745424959000b5a436956de5ac73f49265c382777da1fbbf2852647f4c
2026-11-07Fix sqlite3ExprAnalyzeAggregate() so that it does not translatedrh-0/+3
expression in subqueries, as a fix for [bugs:/info/2026-11-07T18:33:11Z|Bug 2026-11-07T18:33:11Z]. FossilOrigin-Name: a07a6ca1dbe071021dea070e6439a0e2972da0787bd9c2d828b52cac05a1cd5b
2026-11-07Avoiding using an index expression to evaluate a constant expression, even ↵dan-9/+11
if the cursor on the index appears to be open and pointing at a non-null row. Report [bugs:/info/2026-11-03T02:12:43Z | 2026-11-03T02:12:43Z]. See also [fee60d93e9]. FossilOrigin-Name: c9cb6e19a8a3cbcf021d985a52edb637a6f8ace9aa0a691ed8991b4e8c15b117
2026-11-07In aggregate queries, if the RHS of a LEFT JOIN uses an index on an ↵dan-0/+7
expression, do not assume that the value of that expression is NULL just because the cursor current points to the null-row. Report [bugs:/info/2026-11-03T02:11:10Z | 2026-11-03T02:11:10Z]. FossilOrigin-Name: eb1fc11ad6687611e571e1f11ea8de253a96f16dc6385d90b72bb412a4f64152
2026-11-06Do not substitute a value read from an index on a generated column for an ↵dan-13/+26
identical expression within the query if the affinities do not match within an aggregate query, just as is already done for a non-aggregate. Report [bugs:/info/2026-11-03T01:55:11Z | 2026-11-03T01:55:11Z]. FossilOrigin-Name: dcaab21165b0463aae495034157f8c74fe33188bacb01a0709a6be78c86f380d
2026-11-04Do not allow ALTER TABLE to add columns with CHECK constraints that use ↵dan-3/+2
RAISE() expressions. Report [bugs:/info/2026-11-04T00:52:24Z | 2026-11-04T00:52:24Z]. FossilOrigin-Name: 3cbb575c6eae7c0343aec7cc02eb09a90ea2fef2bfbfeac1caa468350b261953
2026-11-04Reintroduce the patch from [e1b09510df4860d3] that got clobbered bydrh-1/+2
the merge at [65091cea03b9a664]. FossilOrigin-Name: 394290b7ced836f08408c10bc7d96c24567e47b3db363f154c97379021667230
2026-11-04A large integer that has no exact floating point representation ought notdrh-0/+6
be converted to floating point when comparing aainst a REAL value. [bugs:/info/2026-11-03T02:13:29Z|Bug 2026-11-03T02:13:29Z] FossilOrigin-Name: d0770f6f5622dcd1ae45f05a6885385490b7871c5ed676404872e0c92ebbd407
2026-10-28When aggregate content passes through the sorter to implement GROUP BYdrh-0/+5
it loses its subtype. So do not pass JSON values from an index on an expression through the sorter and into a JSON aggregate, as that optimization will not work. [bugs:/info/2026-10-27T20:02:01Z|Bug 2026-10-27T20:02:01Z] FossilOrigin-Name: 9887cc52346ff30b54b6236069883dd929df217a3ee80a32e8920cf6a439cf88
2026-10-25Merge all recent branch-3.54 fixes into trunkdrh-3/+3
FossilOrigin-Name: 4fee54f1d687c2e2b4a760c59d1d29fceb81623494cf65b72c309f4922dc0a7e
2026-10-25Use a 64-bit integer to measure expression chain size indrh-3/+3
dupedExprSize(), in case of crazy expressions. FossilOrigin-Name: ed78f5d2bf2042332637edf541c1295f5f5ca7b1cbb4f647492d3f2221afc781
2026-10-21Mark the AND optimization as "not-a-real-0-or-1" so as not to confusedrh-1/+4
ORDER BY and GROUP BY clauses. [bugs:/info/2026-10-21T15:33:18Z|Bug 2026-10-21T15:33:18Z] FossilOrigin-Name: 16cf625360a1448741dafa3d67263b5dda112648a05a0df6a766fae95b529f45
2026-10-20Do not allow a simplified constant expression (example: "123 ISNULL" → "1")drh-1/+27
to be used as the ordinal column number in an ORDER BY or GROUP BY clause. [bugs:/info/2026-10-16T12:58:09Z|Bug 2026-10-16T12:58:09Z] FossilOrigin-Name: c40e620b04aaa3c90501124db27711b1d4e8ae830f75828c7cccf84f7df42660
2026-10-15Remove code that is no longer reachable after [bbdd13370de93035]. Adddrh-2/+1
an assert() to verify that the code is unreachable. FossilOrigin-Name: a0f9daf75b2fc0b230e9d2b79eab9e495a911f39d7427eb5ec09f5414d8703b7
2026-10-14Merge bug fix from branch-3.54 into trunk.drh-1/+7
FossilOrigin-Name: c2df85dd6e750e84ea64a464d65a315e702cd16c1b4a51cb212ae547dfaea673
2026-10-14The previous check-in was not quite correct. Both rLhsOrigdrh-1/+0
and rLhs are vectors and so neither should be freed using sqlite3ReleaseTempReg(). Indeed, neither should be freed at all since both vectors remain in use. FossilOrigin-Name: fc7b959f45a55d95c9cb37692e82b811e3ef286a6d826895dfee9a1f2abfdcc8
2026-10-14In check-in [8800c13deca3717c], fix a double-free of a byte-code register,drh-1/+8
resulting in the same register being on the reusable register list twice. [bugs:/info/2026-10-14T05:52:10Z|Bug 2026-10-14T05:52:10Z]. FossilOrigin-Name: 930df67b442ed677dbe5b22afe4fb91c907c721592a8090f0a70ebea79f3a854
2026-10-13Fix the implementation of Tree-Tracker.drh-1/+1
[bugs:/info/2026-10-13T02:17:32Z|Bug 2026-10-13T02:17:32Z]. FossilOrigin-Name: bfe473ab60f666449b819f0a55e936cef5359e32fd61683437d2ee3e0f3ff6c6
2026-10-12Merge fixes from branch-3.54 onto trunk.drh-13/+17
FossilOrigin-Name: 5a05aded7f54507305edeabbcb54e25d67299769557ae5dc54d0f59d639ac2c6
2026-10-12Prevent scalar subqueries from ever returning a value with a non-zero subtype.drh-2/+8
Report [bugs:/info/2026-10-12T13:52:22Z | 2026-10-12T13:52:22Z]. Re-added after the addition of a necessary prerequisite in the previous check-in. FossilOrigin-Name: 8ab55e0185a1956fb3e131bc5faae0cf3ff5abb1f553217f2d63fcb15c75cc1f
2026-10-12An unknown function can be seen in exprNodeCanReturnSubtype(), but onlydrh-1/+6
if SQLite is compiled with SQLITE_ENABLE_UNKNOWN_SQL_FUNCTIONS. Adjust asserts accordingly. FossilOrigin-Name: dcf20611cdd4a250531d0e753144ab1b6796635331bb906df0e174aea4bd4158
2026-10-12Temporarily back out the penultimate check-in on this branch in order todrh-8/+2
prevent an assertion fault. Need to reconsider this approach in light of [bug:/info/2026-05-18T14:04:01Z|Bug 2026-05-18T14:04:01Z]. That other bug might be fixed incorrectly, and might also need to be backed out. Both bugs reopened until we can complete the analysis. FossilOrigin-Name: 163413d8e19b97e36b2a1f6734c271b3944195a213973e2975e43f45a1e80735
2026-10-12Fix a problem causing "aggregate( t1.col1 ORDER BY t2.col2 )" where col1 and ↵dan-1/+1
col2 are in the same positions in their tables to be treated as "aggregate( t2.col2 ORDER BY t2.col2 )". Report [bugs:info/2026-10-12T13:31:40Z | 2026-10-12T13:31:40Z]. FossilOrigin-Name: ffe3f056f1789f188a0afece0363dc2ea74912510bbbd4edcb656ad8a1acc704
2026-10-12Prevent scalar subqueries from ever returning a value with a non-zero ↵dan-2/+8
subtype. Report [bugs:/info/2026-10-12T13:52:22Z | 2026-10-12T13:52:22Z]. FossilOrigin-Name: af3c900e2b5251bcbc0611dbe2f86b13fd2daa07bcf42563a9d6db46dfdd6b3d
2026-10-12Avoid excessive reprepares when there is an unindexed "col=?" constraint on ↵dan-9/+2
a join query. This should only be reprepared when the bound value toggles between integer values 0 or 1 and any other value. Report [bugs:/info/2026-10-11T16:06:46Z | 2026-10-11T16:06:46Z]. FossilOrigin-Name: 7f154192db5a3a79f4666edd31dfc29fd73904ccd3630952e3b032e49fee6455
2026-10-12Merge recent branch-3.54 fixes into trunk.drh-4/+10
FossilOrigin-Name: a9d8cddccc77bf6c09531e1051eba36f1bd2e95c4e62921c07c4772f12f351ca
2026-10-12Do not use an index expression to evaluate a constant expression, as thatdrh-4/+10
uses unnecessary disk access and might actually give incorrect results if the expression was moved outside of the indexed loop. The error condition arose in check-in [44200596aa943963] for version 3.41.0 and was first reported 3.5 years later by [bugs:/info/2026-10-11T19:26:40Z|Bug 2026-10-11T19:26:40Z]. FossilOrigin-Name: fee60d93e9fb37234d9cad50c65fb6d62dfe21a7fde21a16ce39025290375ad8
2026-10-05Merge the latest trunk enhancements into the tree-tracker branch.drh-3/+9
FossilOrigin-Name: 5fa8b22cfb3fe6a455c40e3eb4c236640fd962d33903dbced244d970f548248a
2026-10-04Fix expression tree depth calculations for COLLATE.drh-3/+9
[bugs:/info/2026-10-04T04:50:56Z|Bug 2026-10-04T04:50:56Z] FossilOrigin-Name: 252c0b7bf5a727d29605672bb58e06c758173c276671df3e388a68294998b4d3
2026-09-29An early attempt to implement the tree-tracker optimization.drh-2/+0
FossilOrigin-Name: ead82958b3edd02e3da8fc3dbec880215d2539d4e0e7b97d3a689793d4938d22
2026-08-27Performance optimizations and code simplifications.drh-6/+4
FossilOrigin-Name: cbf2e796e02b23df9d51b59e047673fe0bdecd6497e678507b5bbc5c136dad7d
2026-08-26Split the sqlite3ColumnExpr() routine out into two routines, one that worksdrh-1/+1
as before and the second sqlite3ColumnExprAuth() to deal with the authenticator in places where that is needed. FossilOrigin-Name: 51a1149bdcbe142b8eb92c2b817d3973bf88aaa73859e0c475505aa201da920b
2026-08-26An attempt to make the authorizer effective at preventing the use ofdrh-1/+1
some functions within the DEFAULT clause of a table. FossilOrigin-Name: 321e41b09179acba59958bdd6b07e4b7d915b9c0dfca143e4914b3690692c201
2026-08-26The sqlite3ExprListIsConstant() routine probably should not return truedrh-8/+14
if the list contains a function like random(). Fixed here. Simplify the logic used to test if expressions are constant. FossilOrigin-Name: 753f42a0925112fd4f2bbe40e72919230890ffc8014900d36624c0dfa371bdf7
2026-08-25When an expression that may have a subtype from the WHERE clause of a ↵dan-0/+5
partial index is substituted for a column value, clear the subtype before the value is used. Report [bugs:/info/2026-08-25T05:36:33Z | 2026-08-25T05:36:33Z]. FossilOrigin-Name: e6ae6fbd5c0b33ae6950a5a45fc0631cd5e0a437eb672f0a2ec6d288596f1be2
2026-08-22Fix check-in [468e730036edac22] so that it works with DESC indexes.drh-6/+24
[bugs:/info/2026-08-22T07:01:45Z|Bug 2026-08-22T07:01:45Z]. FossilOrigin-Name: d1f4fa43f30d0aaf04af1b2afe9ec488654df43444bd49fae31ba1e2ab16b985
2026-08-21Refactor. 2M cycles faster on x64.drh-48/+48
FossilOrigin-Name: 2b3e73200b7842db493da6c9912c3f4405f629384127449edd46febdc21a0228
2026-08-20Merge the latest trunk enhancements into the reduce-reprepares branch.drh-5/+5
FossilOrigin-Name: 62ad88fe1ccd647ef77910d116856d6f2d9c96a726a2a270eacc8f5785875264
2026-08-20Fix the order of 32-bit works on an OP_ColumnsUsed operator.drh-1/+1
FossilOrigin-Name: 0433f33e02e181fecfaff043f72c24118303d767aa9768ed118f48e548f61db3
2026-08-20Modify the OP_Int64 and OP_Real opcodes so that their 64-bit immediate valuedrh-5/+5
is stored split across to arguments, P1 and P3, rather than being stored as a separate memory allocation pointed to by P4. Slightly smaller and slightly faster, but perhaps also easier to maintain. FossilOrigin-Name: c13b4c2c41e19fc47925dfb75e5f48d9972ef9ffb68c2d3c57e71a23e75717f9
2026-08-19Merge recent trunk enhancements into the reduce-reprepares branch.drh-1/+1
FossilOrigin-Name: f3adcd561a50646fa53173da162ed3952065d7bd6cc82babbecf3973be269d57