1
0
mirror of https://github.com/sqlite/sqlite.git synced 2026-10-23 21:49:02 +03:00
Commit Graph

20631 Commits

Author SHA1 Message Date
jeffchen
138f51ac68 Remove unused per-index counters from integrity checking.
FossilOrigin-Name: d0b5bc53a9d828c425ea29bc418688aa7df20e8cc4b69b81acb0ac1a7c169b6a
2026-10-22 14:03:32 +00:00
jeffchen
fd8be0ca94 Avoid repeated setup when reusing a materialized CTE.
FossilOrigin-Name: 18bec552a0da979f32f7a5a024691ab2bbb09454c75a7e99a125a5bd7545584f
2026-10-22 14:03:19 +00:00
drh
bc766d966a Merge branch-3.54 fixes into trunk
FossilOrigin-Name: fdf339d965aba5e35feaf3ef613e2e2ce0795338591f261998141a6d080bb0da
2026-10-22 11:41:16 +00:00
drh
de805a8c12 Increased safety margin in sqlite3_preupdate_old(). Test case in TH3.
FossilOrigin-Name: 31b84157965fcd3309a1420db71e0beee4ccdd88a2f44e5f9029a05cb04ae9cf
2026-10-22 11:03:08 +00:00
drh
7f91834658 Extra safety margin added to sqlite3VdbeMemFromBtree(). Change
suggested by Martin Mirchev.  Test cases in TH3.

FossilOrigin-Name: 952ae2c63e0a2007d8213132636e2e99bae113a9c7582b68b2e5a686b0777a99
2026-10-22 10:40:42 +00:00
drh
ac429ff804 Index lookup of an integer column using value -9223372036854775808.0
now works.
[bugs:/info/2026-10-21T17:54:28Z|Bug 2026-10-21T17:54:28Z]

FossilOrigin-Name: 03f699544e6b2040eda17e2f4b48813b10513fc05891a3dd4000867316413103
2026-10-21 23:49:46 +00:00
drh
99774ca002 Make the NOT INDEXED key phrase work for WITHOUT ROWID tables.
[bugs:/info/2026-10-21T17:47:47Z|Bug 2026-10-21T17:47:47Z]

FossilOrigin-Name: 9eafe6158d1042f27b867a90f0fb96abf639954efe7944aed6c8b5c9f4373dfa
2026-10-21 20:53:42 +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
dan
0fa90d6621 Allow composite FKs to use indexes with mismatched affinities as well.
FossilOrigin-Name: 2e0883964e8d14bd5337a3aaa838b72522ee7a54ea151db5e29cff1f9ee6981e
2026-10-21 14:37:51 +00:00
drh
61a8c1579d The IN pre-filter is now only added when the child key can actually use an
index lookup.

FossilOrigin-Name: a3d46e1f8f02f64c888d26038d83a065bcf56ec5df80d924e3b074152aab18dd
2026-10-21 12:57:50 +00:00
drh
e8eff0e979 An attempt to get the new foreign key code to use indexes on type mismatch
between parent and child.

FossilOrigin-Name: c0523245e2ba3339d8b21cf26e164d05ec252f3d882eadacd4c510a224ccbdba
2026-10-21 12:24:59 +00:00
dan
4242856e53 Ensure that all (parent_key = child_key) comparisons performed as part of foreign key processing are done using the affinity of the parent key. Report [bugs:/info/2026-10-20T02:56:10Z | 2026-10-20T02:56:10Z].
FossilOrigin-Name: feb6d3a3016d890fb1a8ca2a1752949b8adc0c06debb6ca305cacafc6b6edd10
2026-10-21 11:52:56 +00:00
drh
23b355fb6e If a reprepare fails in sqlite3_stmt_explain(), do not leave the prepared
statement in an invalid state.
[Bugs:/info/2026-10-21T09:18:32Z|Bug 2026-10-21T09:18:32Z].
Test cases in TH3.

FossilOrigin-Name: 0ffda38c5f7f506cd14c9aedc756f2fc025fe49f0822a4ecf28451a4d2b840e0
2026-10-21 11:25:55 +00:00
drh
049891534d If a virtual table is created within a SAVEPOINT, it needs to be undo by
the corresponding ROLLBACK TO.  This resolves an issue going back to
before version 3.7.8 circa 2011.
[bugs:/info/2026-10-20T20:37:14Z|Bug 2026-10-20T20:37:14Z]

FossilOrigin-Name: 33aeb419d594cd131124cd228dbbb4da246a531edea40009d95d6b2b376bd76b
2026-10-21 00:34:39 +00:00
drh
3e97799009 Change the sqlite3_serialize() interface to return a NULL pointer if
the database is file-based and an I/O error occurs while reading.
[bugs:/info/2026-10-18T10:04:32Z|Enhancement request 2026-10-18T10:04:32Z].

FossilOrigin-Name: aa36cfe5b0f944752ace7986b2bff5dcb597fc0d456da781ed5b55e47ecb3d3c
2026-10-20 20:17:15 +00:00
drh
99f724be20 Simplify the ".clone" command so that it just makes a copy of the main
database.  Move the implementation into a separate dotCmdClone() function
and provide better help text explaining its history.

FossilOrigin-Name: 8b5c87a5f4dc6dccf2130d41df958ea59f0892836b574388539ee7d905cd014d
2026-10-20 19:30:24 +00:00
drh
bd27afc005 Be sure to use the correct collating sequence when doing a balanced merge
of a four-way or larger compound select.  Error goes back to version
3.38.0 (2021).
[bugs:/info/2026-10-18T23:46:25Z|Bug 2026-10-18T23:46:25Z]

FossilOrigin-Name: 7ee2a48bb3765bfe8cef4ae400eacf77c660f9d5dbaa289ab5f17474fca98cae
2026-10-20 18:25:01 +00:00
drh
03c38c992a Merge branch-3.54 fixes into trunk
FossilOrigin-Name: 8efb0acad85f6220f576c71530256d62f92dfba5673cdc5e0371f480753f1034
2026-10-20 17:53:47 +00:00
dan
5a1da0ae1b When a b-tree cell is deleted, zero the cursor's cell-info cache as the cell it describes no longer exists, even if the cursor position is being preserved. Report [bugs:/info/2026-10-18T16:11:58Z | 2026-10-18T16:11:58Z].
FossilOrigin-Name: 07ed30558ee7da460ed0ca2b36cd555aeb5caa91f0971b2cf83adc08524ca9b7
2026-10-20 17:27:17 +00:00
drh
60f12a1ecc Fix the --preserve-rowids option on the ".dump" command of the CLI
so that it works for tables that have a non-IPK column named "rowid".
[bugs:/info/2026-10-20T03:22:48Z|Bug 2026-10-20T03:22:48Z]

FossilOrigin-Name: ecd172bb44be40841336cf2ec42f2505c4f98a96eace3e4862e038a3c147770d
2026-10-20 17:24:29 +00:00
drh
2f0c895a4e Fix the sqlite3_carray_bind() interface so that it works with
SQLITE_TRANSIENT and an array length of zero.
[bugs:/info/2026-10-20T13:53:58Z|Enhancement request 2026-10-20T13:53:58Z]

FossilOrigin-Name: 47228787b1459a35a12a499be90e249c555658bf4e393122041f474e8986b17d
2026-10-20 17:05:30 +00:00
drh
5eb5ab72a2 Provide auto-init for the sqlite3_cancel_auto_extension().
[bugs:/info/2026-10-20T13:51:06Z|Enhancement request 2026-10-20T13:51:06Z].

FossilOrigin-Name: 08962c885f007c379a16167b280f022cf3c9045ab40a4e7e6ad721c966c2f0cc
2026-10-20 16:40:12 +00:00
dan
12b80e71b6 When a real value is specified as a default for a text column, avoid various inconsistencies by ensuring that it is always converted to an IEEE double and then back to text before use, as is already done for integer values. Report [bugs:/info/2026-10-05T16:22:00Z | 2026-10-05T16:22:00Z].
FossilOrigin-Name: d140ada6488a27342c6baf0d8e44adf38f91b37a657c2bcc0efa9ecf437b414c
2026-10-20 16:11:44 +00:00
dan
34a05a3723 Fix handling of GROUP BY and HAVING clauses attached to the rightmost SELECT of a compound SELECT with one or more COLLATE clauses attached to ORDER BY expressions. Report [bugs:/info/2026-10-16T22:06:45Z | 2026-10-16T22:06:45Z].
FossilOrigin-Name: bd873f7ca9fc0d36a884d3929517d9a19c181c811dae65d64815a2006005b788
2026-10-20 15:19:35 +00:00
dan
4f5062f0ba Correctly handle aggregate functions that aggregate over the rows of a window function query, even if they are nested within sub-selects. Report [bugs:/info/2026-10-16T08:07:09Z | 2026-10-16T08:07:09Z].
FossilOrigin-Name: 7522512ff96d869c46596e7d514b65f210530db09e6359c2f37911d45f34979d
2026-10-20 14:07:59 +00:00
drh
4855cb2a31 Fix the CLI to correctly handle a ".exit" immediately following
a ".output memory". [bugs:/info/2026-10-20T13:13:50Z|Bug 2026-10-20T13:13:50Z]

FossilOrigin-Name: 2fdd752dc92692e08c805eb10bf78d97e93c8436433c8175fbff310513f340d7
2026-10-20 13:45:54 +00:00
drh
a6f89b9d0b Add an extra sqlite3MemoryBarrier() call in sqlite3_initialize() to avoid
a race condition that only happens on non-X64 CPUs.
[bugs:/info/2026-10-20T07:33:27Z|Bug 2026-10-20T07:33:27Z]

FossilOrigin-Name: 37b83ad2f5245217a4a4626916c3974acb3491fc5d45ed082ac0386e9d84b4ce
2026-10-20 12:42:26 +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
bf1c107e3a Fix ALTER TABLE RENAME so that it works on triggers that contain UPSERT.
[bugs:/info/2026-10-20T03:23:05Z|Bug 2026-10-20T03:23:05Z]

FossilOrigin-Name: be17b0b030c06169c92e49cbe56ed9228696fce741d4ecb0683b27e2113f0ce1
2026-10-20 09:49:36 +00:00
drh
5484850c7a Minor fix to ALTER TABLE RENAME COLUMN so that it works on TEMP tables.
[bugs:/info/2026-10-19T01:55:31Z|Bug 2026-10-19T01:55:31Z]

FossilOrigin-Name: 6d998905f8210f3e627e30fef2293afbd22bdcd39432d4388ecedbf927dc87dc
2026-10-20 09:24:08 +00:00
drh
1f3577bc0c Remove an ALWAYS() that can sometimes be true when using
sqlite3_collation_needed() and dropping collations.
[bugs:/info/2026-10-18T18:09:53Z|Bug 2026-10-18T18:09:53Z]

FossilOrigin-Name: 8717ff8d73bd5822b3306e999783b41eb1d74d2bc120641b2beadc98cf61de1f
2026-10-20 09:00:48 +00:00
drh
1f3e5e763d Merge the latest branch-3.54 fixes into trunk
FossilOrigin-Name: b3606f7019b2a2dc77d9e476055156631d07c33dfef2d8bc0fdd75b13fad54fd
2026-10-20 00:17:35 +00:00
drh
17f128f746 Fix an adverse interaction between triggers changing a table that uses
ON DELETE SET NULL constraints and the optimization at [8c5dd6cc259e0cda],
almost 12 years ago.
[bugs:/info/2026-10-19T06:36:47Z|Bug 2026-10-19T06:36:47Z].

FossilOrigin-Name: 15424da529e827f3eca7d70b1c54b57f2e9e05ed866a872ea45fa538e8b72825
2026-10-20 00:14:02 +00:00
drh
cc04298893 Fix a problem in ALTER TABLE DROP COLUMN that could result in a stale
index.  [bugs:/info/2026-10-19T06:36:17Z|Bug 2026-10-19T06:36:17Z]

FossilOrigin-Name: 4ea5d16c2159738614e135377120b604f89ff1cdf0bfe60ea3cc41073680c8f1
2026-10-19 19:40:21 +00:00
drh
ea1e2759a1 Merge the latest branch-3.54 fixes onto trunk
FossilOrigin-Name: 79ba7ba1a75c998c68dd2cc60de7fbe133a563e803a536efea94eff657603965
2026-10-19 18:26:06 +00:00
drh
aa037e12be Correct the handling of SQLITE_IGNORE returns from authorizer calls
for UPDATE on the rowid or INTEGER PRIMARY KEY.  See the test cases
in TH3 for details.

FossilOrigin-Name: 606005419f60bd14eec71ee87a770051c8c551273c9a7567d830283eeb1058e8
2026-10-19 18:20:03 +00:00
drh
9c6e3568ba Fix JSON parsing to properly recognize a backslash-continuation at the
end of a string.
[bugs:/info/2026-10-18T04:42:37Z|Bug 2026-10-18T04:42:37Z]

FossilOrigin-Name: d8c93a5f2c19622d1da29f503145223ff433e1597235510273fbebefe455c4c4
2026-10-19 17:24:43 +00:00
drh
ee16b84fb6 In the CLI, do not read the ~/.sqliterc file or an alternative specified by
the --init command-line option if the --safe option is used.
[bugs:/info/2026-10-19T12:32:27Z|Bug 2026-10-19T12:32:27Z]

FossilOrigin-Name: f1e94b6042f056f103eaf4ac11004fc2f559499ccf2b93eae0c9283150a6e921
2026-10-19 16:25:28 +00:00
dan
c7885735ac Correctly handle compound SELECTs with explicit COLLATE clauses on ORDER BY expressions, even if they appear in a CTE or VIEW definition. Report [bugs:/info/2026-10-19T08:22:22Z | 2026-10-19T08:22:22Z].
FossilOrigin-Name: 36803e2660eed4f3d16750f1d3a4af796e2c15034838f07f472c2fbb0f9b52b0
2026-10-19 15:14:13 +00:00
drh
10586997d9 Fix the ".dump" command in the CLI so that it is not affected by
mode settings like --fpfmt, --ifmt, or --textjsonb.
[bugs:/info/2026-10-18T20:39:22Z|/info/2026-10-18T20:39:22Z]

FossilOrigin-Name: a9d8123e27fa71bf7d29ec4cc7aa997f5e94de3c5b48907ccb7242795e44144c
2026-10-19 12:02:08 +00:00
drh
58626f682a Merge branch-3.54 fixes into trunk
FossilOrigin-Name: d987e46422d32a0ec7870dcc6d9f0e5767dff57a6004ece527964f1dd840cb11
2026-10-18 23:51:22 +00:00
drh
58f8fe5547 Do not run the OR optimization on the left operand of a LEFT JOIN.
[bugs:/info/2026-10-18T16:10:55Z|Bug 2026-10-18T16:10:55Z].

FossilOrigin-Name: b4974127526b290149447849bf9c24c9ea01678755a58af3843c9e2c73c417d2
2026-10-18 23:45:59 +00:00
drh
b1f3151bb7 If terms on the SELECT on the RHS of a vector IN are removed, then the
subquery cannot be reused for other things, since it is now different.
[bugs:/info/2026-10-16T22:07:15Z|Bug 2026-10-16T22:07:15Z]

FossilOrigin-Name: 080338a91b447c12186bbb4e23da1927ca448fee9a11cd6507f5f2041ee2dcba
2026-10-18 22:48:50 +00:00
drh
dac1b8dc84 Add the SQLITE_LIMIT_CTES option to sqlite3_limit(). The default is 50K.
Setting to zero disables the limit.  The limit is approximate - it does not
actually count CTEs but rather simply refuses to process a CTE with cursor
number that exceeds this limit.  This is a re-do of the fix for
[bugs:/info/2026-10-04T05:35:14Z|Bug 2026-10-04T05:35:14Z] that also
avoids the regression reported by
[forum:/info/2026-10-16T20:30:17Z|Forum post 2026-10-16T20:30:17Z].

FossilOrigin-Name: b32709ea065da2eb41a6eb0ca20381d2bd82a356bb5f8bc76fee063d1da93004
2026-10-18 19:10:13 +00:00
drh
e58a5a91ed Limit the size of the second argument of the (testing use only) SQL function
fpdecode() to avoid a (harmless) signed integer overflow.
[bugs:/info/2026-10-18T03:43:20Z|Bug 2026-10-18T03:43:20Z]

FossilOrigin-Name: 72187f18fe8b207e5955f269a5e299e5b18d5b919ae9073b208454c994e9b18d
2026-10-18 18:30:00 +00:00
drh
d7e0a4717a Merge recent branch-3.54 fixes into trunk
FossilOrigin-Name: f9e0ce3382e4787468bdb4029105fbffb2d4ab92b51c655ae762b555d8570efb
2026-10-18 16:31:01 +00:00
drh
850ea24139 Back out parts of [e68aa6e1293a2c7a] for the 3.54.x patch series, as they
cause a regression reported by
[forum:/info/2026-10-16T20:30:17Z|Forum post 2026-10-16T20:30:17Z].  The
"bug" fixed was not important.  The plan is to add a new limit in 3.55.0
to address this problem.

FossilOrigin-Name: 845190e3f2ede1f64d7e26ec9391d3551080c1d787599d49bad402c3734d81aa
2026-10-18 16:17:16 +00:00
drh
c006236c19 Remove a NEVER() that can in fact be true. A test case to demonstrate
has been separately added to TH3.

FossilOrigin-Name: 70bb130523a69e2babb08d4538c73772fd354f2df76193f75d8d8ff8b7299e76
2026-10-18 16:04:03 +00:00
drh
18347d8044 Check the datatype of the second (optional) argument to the log() SQL
function and return NULL if it is non-numeric as the documentation says
it should.
[bugs:/info/2026-10-18T05:05:18Z|Bug 2026-10-18T05:05:18Z]

FossilOrigin-Name: a99e577b951fa38fcdff3693072c2f78e546be6a1c187b648f043b499a06768e
2026-10-18 10:14:50 +00:00
drh
3bce1260e7 Fix 24:00:00 rounding of dates with negative years.
[forum:/info/2026-10-17T12:57:32Z|Forum post 2026-10-17T12:57:32Z]

FossilOrigin-Name: 91515aa82e05f32db4b5d126d762d730cf424735edc4ef59a696ad581f4ca1ab
2026-10-17 13:23:07 +00:00