drh
37a6d8d4e4
When aggregate content passes through the sorter to implement GROUP BY
...
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-28 00:00:01 +00:00
drh
1820defd76
Merge all recent branch-3.54 fixes into trunk
...
FossilOrigin-Name: 4fee54f1d687c2e2b4a760c59d1d29fceb81623494cf65b72c309f4922dc0a7e
2026-10-25 22:40:37 +00:00
drh
862625c9ae
Use a 64-bit integer to measure expression chain size in
...
dupedExprSize(), in case of crazy expressions.
FossilOrigin-Name: ed78f5d2bf2042332637edf541c1295f5f5ca7b1cbb4f647492d3f2221afc781
2026-10-25 17:45:41 +00:00
drh
0168a3f32b
Mark the AND optimization as "not-a-real-0-or-1" so as not to confuse
...
ORDER BY and GROUP BY clauses.
[bugs:/info/2026-10-21T15:33:18Z|Bug 2026-10-21T15:33:18Z]
FossilOrigin-Name: 16cf625360a1448741dafa3d67263b5dda112648a05a0df6a766fae95b529f45
2026-10-21 17:36:54 +00:00
drh
3863fd3b40
Do not allow a simplified constant expression (example: "123 ISNULL" → "1")
...
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-20 12:07:04 +00:00
drh
c2d796b3f2
Remove code that is no longer reachable after [bbdd13370de93035]. Add
...
an assert() to verify that the code is unreachable.
FossilOrigin-Name: a0f9daf75b2fc0b230e9d2b79eab9e495a911f39d7427eb5ec09f5414d8703b7
2026-10-15 13:55:05 +00:00
drh
9d1806e3c0
Merge bug fix from branch-3.54 into trunk.
...
FossilOrigin-Name: c2df85dd6e750e84ea64a464d65a315e702cd16c1b4a51cb212ae547dfaea673
2026-10-14 12:48:03 +00:00
drh
eba536e8f2
The previous check-in was not quite correct. Both rLhsOrig
...
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-14 11:32:36 +00:00
drh
9266f1518b
In check-in [8800c13deca3717c], fix a double-free of a byte-code register,
...
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-14 11:22:24 +00:00
drh
4226522153
Fix the implementation of Tree-Tracker.
...
[bugs:/info/2026-10-13T02:17:32Z|Bug 2026-10-13T02:17:32Z].
FossilOrigin-Name: bfe473ab60f666449b819f0a55e936cef5359e32fd61683437d2ee3e0f3ff6c6
2026-10-13 02:43:51 +00:00
drh
9de75a1245
Merge fixes from branch-3.54 onto trunk.
...
FossilOrigin-Name: 5a05aded7f54507305edeabbcb54e25d67299769557ae5dc54d0f59d639ac2c6
2026-10-12 22:05:35 +00:00
drh
394e7bc1ac
Prevent scalar subqueries from ever returning a value with a non-zero subtype.
...
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-12 21:33:49 +00:00
drh
7815214b6c
An unknown function can be seen in exprNodeCanReturnSubtype(), but only
...
if SQLite is compiled with SQLITE_ENABLE_UNKNOWN_SQL_FUNCTIONS. Adjust
asserts accordingly.
FossilOrigin-Name: dcf20611cdd4a250531d0e753144ab1b6796635331bb906df0e174aea4bd4158
2026-10-12 21:24:29 +00:00
drh
e26021ed60
Temporarily back out the penultimate check-in on this branch in order to
...
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-12 17:52:40 +00:00
dan
5bf1891464
Fix a problem causing "aggregate( t1.col1 ORDER BY t2.col2 )" where col1 and 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-12 16:29:30 +00:00
dan
3922c42423
Prevent scalar subqueries from ever returning a value with a non-zero subtype. Report [bugs:/info/2026-10-12T13:52:22Z | 2026-10-12T13:52:22Z].
...
FossilOrigin-Name: af3c900e2b5251bcbc0611dbe2f86b13fd2daa07bcf42563a9d6db46dfdd6b3d
2026-10-12 16:08:07 +00:00
dan
48fedaa403
Avoid excessive reprepares when there is an unindexed "col=?" constraint on 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-12 13:36:00 +00:00
drh
9d7c5b1472
Merge recent branch-3.54 fixes into trunk.
...
FossilOrigin-Name: a9d8cddccc77bf6c09531e1051eba36f1bd2e95c4e62921c07c4772f12f351ca
2026-10-12 12:51:45 +00:00
drh
e326d6eff0
Do not use an index expression to evaluate a constant expression, as that
...
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-12 10:24:09 +00:00
drh
46545d6d15
Merge the latest trunk enhancements into the tree-tracker branch.
...
FossilOrigin-Name: 5fa8b22cfb3fe6a455c40e3eb4c236640fd962d33903dbced244d970f548248a
2026-10-05 14:26:15 +00:00
drh
d54522a5b8
Fix expression tree depth calculations for COLLATE.
...
[bugs:/info/2026-10-04T04:50:56Z|Bug 2026-10-04T04:50:56Z]
FossilOrigin-Name: 252c0b7bf5a727d29605672bb58e06c758173c276671df3e388a68294998b4d3
2026-10-04 21:54:17 +00:00
drh
349d1438eb
An early attempt to implement the tree-tracker optimization.
...
FossilOrigin-Name: ead82958b3edd02e3da8fc3dbec880215d2539d4e0e7b97d3a689793d4938d22
2026-09-29 18:49:51 +00:00
drh
ebba9a05f2
Performance optimizations and code simplifications.
...
FossilOrigin-Name: cbf2e796e02b23df9d51b59e047673fe0bdecd6497e678507b5bbc5c136dad7d
2026-08-27 01:42:32 +00:00
drh
0754d37652
Split the sqlite3ColumnExpr() routine out into two routines, one that works
...
as before and the second sqlite3ColumnExprAuth() to deal with the
authenticator in places where that is needed.
FossilOrigin-Name: 51a1149bdcbe142b8eb92c2b817d3973bf88aaa73859e0c475505aa201da920b
2026-08-26 21:04:25 +00:00
drh
04a4ee45c5
An attempt to make the authorizer effective at preventing the use of
...
some functions within the DEFAULT clause of a table.
FossilOrigin-Name: 321e41b09179acba59958bdd6b07e4b7d915b9c0dfca143e4914b3690692c201
2026-08-26 19:37:23 +00:00
drh
8a9882714d
The sqlite3ExprListIsConstant() routine probably should not return true
...
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-26 15:23:14 +00:00
dan
11d653bbd3
When an expression that may have a subtype from the WHERE clause of a 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-25 14:26:16 +00:00
drh
3468c5b73e
Fix check-in [468e730036edac22] so that it works with DESC indexes.
...
[bugs:/info/2026-08-22T07:01:45Z|Bug 2026-08-22T07:01:45Z].
FossilOrigin-Name: d1f4fa43f30d0aaf04af1b2afe9ec488654df43444bd49fae31ba1e2ab16b985
2026-08-22 09:33:37 +00:00
drh
8fafd53c09
Refactor. 2M cycles faster on x64.
...
FossilOrigin-Name: 2b3e73200b7842db493da6c9912c3f4405f629384127449edd46febdc21a0228
2026-08-21 20:21:23 +00:00
drh
5d92a8f1b5
Merge the latest trunk enhancements into the reduce-reprepares branch.
...
FossilOrigin-Name: 62ad88fe1ccd647ef77910d116856d6f2d9c96a726a2a270eacc8f5785875264
2026-08-20 14:05:49 +00:00
drh
ed22d61dd2
Fix the order of 32-bit works on an OP_ColumnsUsed operator.
...
FossilOrigin-Name: 0433f33e02e181fecfaff043f72c24118303d767aa9768ed118f48e548f61db3
2026-08-20 09:26:01 +00:00
drh
255f7220fd
Modify the OP_Int64 and OP_Real opcodes so that their 64-bit immediate value
...
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-20 01:22:18 +00:00
drh
2b356863cc
Merge recent trunk enhancements into the reduce-reprepares branch.
...
FossilOrigin-Name: f3adcd561a50646fa53173da162ed3952065d7bd6cc82babbecf3973be269d57
2026-08-19 17:25:54 +00:00
drh
857f41a4ae
Fix a minor error in [d287358b8d356d4f] that was causing an assertion fault.
...
FossilOrigin-Name: 1357ac105a0e0c380dc88b13d53b93799221a389f3f81ba6d05fe8fd9ffc6975
2026-08-19 10:38:49 +00:00
dan
bb7c3e8eac
Refactor the new code on this branch.
...
FossilOrigin-Name: 76a03b5314bd3a48e5f8de60c47cdb6ae749a8741bf0dede0a3b599a796d76d1
2026-08-18 21:12:12 +00:00
dan
6252e83bec
Also correctly process "x IS NOT TRUE" expressions that appear in the second or later rows of a VALUES() clause.
...
FossilOrigin-Name: 0de50d5685b2edf317bdc48f79052f58a64738d3ee966ad1e631f76f4aba6168
2026-08-18 14:40:24 +00:00
dan
6227f9abd7
Correctly process an "x IS TRUE" expression that appears in the second or later rows of a VALUES() clause. Possible fix for report [bugs:/info/2026-08-18T05:06:40Z 2026-08-18T05:06:40Z].
...
FossilOrigin-Name: 1be96edbd5f695e8a12620e4d74d2b7bc7fb277a956c4b5e5ee8274121920c7b
2026-08-18 14:21:27 +00:00
drh
464f5129c2
Change the variable name for the variable-number bitmap cache. Make the size
...
of the cache configurable at compile-time.
FossilOrigin-Name: 35c9c6e6352ff855eea4782da2270ff2937a969116db9d481bc0701375749c2b
2026-08-16 19:50:46 +00:00
jeffchen
3de1035b3b
Add a small bitmap to the Parse object recording which variable numbers below 128 are already in Parse.pVList, so that repeated or out-of-order ?NNN parameters avoid a linear scan of the VList on each occurrence. Optimize particularly well on ORM testset.
...
FossilOrigin-Name: 306f8f3ccbd7d5c4993f0f084db73950b2c00fb356c10f00e579c7d413ddab6b
2026-08-16 12:04:16 +00:00
drh
f1a8574eef
Do not use the propagate-constant optimization on a constant that is
...
really a function that might return a subtype.
FossilOrigin-Name: a5bf606f3b76b66988d9f4ce97ca48827c2583e2e275f50a2fdfc8bb08719779
2026-08-12 13:23:52 +00:00
dan
24ad808809
When comparing row values that are sub-selects, do not consider the collation sequences of the expressions returned by the sub-select when determining the collation sequences to use for the comparisons. i.e. in "(a, b)=(SELECT c, d)", do not consider the collation sequences of "c" or "d". Fix for problem [forum:/info/2026-08-09T09:33:49Z | 2026-08-09T09:33:49Z].
...
FossilOrigin-Name: 88580851be734d1917809a4254f2f117df58c71b4c118509ccb4756a300fa6e6
2026-08-10 15:57:42 +00:00
dan
98c319e259
Avoid apply an affinity to a register that might be the result of a TK_AGG_COLUMN expression, as it might be reused. Possible fix for bug [bugs:/info/2026-07-29T05:51:06Z | 2026-07-29T05:51:06Z].
...
FossilOrigin-Name: e5cce8a0026e71985f3afd07aba4b3f550871a1079d18234efa19438eed15d2d
2026-07-29 14:23:30 +00:00
dan
c571cec033
Ignore any DISTINCT qualifier on a SELECT statement on the RHS of an IN(...) expression. Forum post [bugs:/info/2026-07-25T08:40:13Z | 2026-07-25T08:40:13Z].
...
FossilOrigin-Name: c54858eab45f71a77249c8ecdc8e107cf631e743b8b883f2b6db60e0bf7e908a
2026-07-25 14:49:40 +00:00
drh
b4ca411eb6
Improved Bloom-filter invariant checking.
...
FossilOrigin-Name: f38f4167110df11ba54816932126f695dc6e114d4001d0261669807a55ad7966
2026-07-23 18:55:12 +00:00
drh
83f39c1788
Add the ability for Bloom filters to work on text values, as long as
...
the collating sequence is BINARY.
FossilOrigin-Name: 2577edc796505a0a6dabccbcc1bb6a828457092caa4d074561da5e58a6f065a2
2026-07-23 16:00:10 +00:00
drh
782a6a42e1
Remove an incorrect ALWAYS() macro from the implementation of the
...
internal exprNodeCanReturnSubtype() routine so that it works with
zero-argument deterministic functions like pi().
FossilOrigin-Name: a2511c6223a08033a2c5c66faee3afa50b992dc18de7a8498c8e3d24ce1376cc
2026-07-20 19:17:30 +00:00
drh
72d26f4660
Do not allow internal-use-only functions to be coded, anywhere, unless
...
inside of a nested parse (which is the case for ALTER TABLE) or if
the appropriate test-control is activated.
[bugs:/info/2026-06-23T15:49:27Z|Bug 2026-06-23T15:49:27Z].
FossilOrigin-Name: a145307e4d0b621c5493cecc7c826e8422cbd8dbc8cd9a042b8ec9e05d389eb6
2026-06-23 19:08:18 +00:00
drh
2dacda40a6
Extra testcase() macros to ensure adequate testing of the previous
...
check-in.
FossilOrigin-Name: 003013ccabaaa7aea1e78844474ed5032ee9c9824f98c5d36687ac5256a5e128
2026-06-04 11:39:13 +00:00
dan
62a3734e78
Fix problems with expressions like "(?,?,?) IN (SELECT c,b,a FROM ...)" when there is an index on columns "c", "b" and "a", but not in that order. Bug [bugs:/info/2026-06-04T07:02:53Z | 2026-06-04T07:02:53Z].
...
FossilOrigin-Name: 07667afd0f17b73b58df8ace6a2a5c3a593276f9b7804cb14d4705051258dd75
2026-06-04 11:19:43 +00:00
dan
03aa9a7b50
For expressions of the form "(x, y...) IN (SELECT a, b ...)" where the result is not true, consider the collation sequences of columns "a" and "b" when determinining if the result should be false or NULL. Bug report [bugs:/info/0785f45e67 | 2026-05-31T02:10:44Z].
...
FossilOrigin-Name: 04d7a9d788cf0bb811483baceb9142f67d4a2380d4af409d5300a92f7972472e
2026-06-01 16:20:40 +00:00