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

10441 Commits

Author SHA1 Message Date
drh
4efa7a477e Correctly enforce a UNIQUE constraint on a non-PRIMARY KEY column of a table
that has an INTEGER PRIMARY KEY with ON CONFLICT REPLACE and that has
a AFTER DELETE trigger that fires when the REPLACE happens and that trigger
tries to INSERT a new row that violates uniqueness.
[bugs:/info/2026-08-22T23:55:15Z|Bug 2026-08-22T23:55:15Z].

FossilOrigin-Name: 521c9f5f282f159332101be32031568cb3f08fd937f354a282e09957dd570f53
2026-08-23 21:41:08 +00:00
drh
5ff4a5390c Remove some unnecessary sqlite3_test_control() optimization control flags
for a small performance increase and size reduction.

FossilOrigin-Name: 2a9cb1e12ab4b81875e2d08f6cdecfb08b57137a69f6eb4efd19a56347184c3b
2026-08-22 16:33:58 +00:00
drh
ccfd5e0941 Add an optimization that converts UNION into UNION ALL if there is
a LIMIT 1 and no ORDER BY.

FossilOrigin-Name: fb83742dd163363b9c18c530b6f95964562a0fca2a563462379595632af94387
2026-08-22 10:39:18 +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
45f4f1c1cb A couple of fixes, one of them important, for the previous check-in.
FossilOrigin-Name: 3a01099c45bd5965286640c23d727ef0c4a61bd97146bf01bac63e296808cba9
2026-08-22 01:21:46 +00:00
drh
6f1110ce05 Faster implementation of sqlite3_bind_int64(). Reduce the need to
reprepare when replacing one integer binding with a different integer
value is many cases.

FossilOrigin-Name: 98edd4ac227e555a84ee7025983a4a394c89d52cb5dfe2076ad9431566be2288
2026-08-21 20:32:06 +00:00
drh
54508b2801 In the CLI, finer-grain control of what status information is displayed via
the ".stats" command.  Add the ability to reset peak measurements after
each display.

FossilOrigin-Name: 852972861636d75ed935c3a0b1b170442048a1eaa80c4d4abd1c9de14c8be022
2026-08-21 14:04:05 +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
stephan
73e39488f7 Internal doc typo fix. No code changes.
FossilOrigin-Name: 1c19bc27cbeb6614e7c01a28c76a7e5f649dba3c15c5fa4588c4e84fe5541947
2026-08-20 11:12:56 +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
7e50e63de2 Disable three unimportant scanstatus tests on Windows to work around
platform incompatibilities.
[bugs:/info/2026-08-19T20:22:44Z|Bug 2026-08-19T20:22:44Z].

FossilOrigin-Name: 3f2b5dc6cd9d83724fcf39e9d7e2ca0eae6b8c698d1eb5444c705696a866d85a
2026-08-19 21:01:42 +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
c69f996361 Fix the zipvfs virtual table so that it works with UPDATE OR REPLACE.
[bugs:/info/2026-08-19T01:52:09Z|Bug 2026-08-19T01:52:09Z].

FossilOrigin-Name: 1f71a577adfbfe9ca691766b9c97d002720118dbfdee5f16424ecf96b4a40b9b
2026-08-19 15:29:15 +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
c60dd4af07 Experimental attempt to reduce reprepares caused by bound variables and "=" constraints in WHERE clauses.
FossilOrigin-Name: 1cfdde74f1c68589d722b876c20317c2a70cec2d915546a2200035190d3fb082
2026-08-18 18:22:47 +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
stephan
f919d99246 Filter the rtree tests out of speedtest1's default configuration when built without SQLITE_ENABLE_RTREE. Resolves [forum:e19d434249|forum post 2026-08-18T11:15:33Z].
FossilOrigin-Name: 198c9678a2010235232570d80c348834823d28e08bf6c76f2519eeac9b063925
2026-08-18 14:00:25 +00:00
drh
714ab82489 Limit the number of nested RIGHT JOINs (or FULL JOINs) that can occur
in a single query.  Report [bugs:/info/2026-08-18T07:03:05Z|2026-08-18T07:03:05Z].

FossilOrigin-Name: 003ed951d85416da97f5cabf96d89b974279bd8ef2433ae1987bdedad38a4b90
2026-08-18 10:12:46 +00:00
drh
9fd4cbde74 Add SQLITE_LIMIT_TRIGGER_STEPS and -DSQLITE_MAX_TRIGGER_STEPS=n. Default maximum
is 65000.

FossilOrigin-Name: 6fbed57b1447725ae9d923d69b509fd5932d8c6bae6cf6ac0d1248a943752a58
2026-08-18 09:17:48 +00:00
drh
13bcd6f6b2 New -pgo option to test/speedtest.tcl compiles using gcc-style PGO.
FossilOrigin-Name: b460488d0572f4fecf45d213932560f83b789fe1c8847d767c9415b19fc7a33c
2026-08-17 15:31:20 +00:00
dan
a87bd2471a Avoid a problem causing a use-after-free in the fts3 snippet() function. Report [bugs:/info/2026-08-17T09:18:24Z | 2026-08-17T09:18:24Z].
FossilOrigin-Name: e4635c41536a0b3620780c3f1c872de33121370bafb608fce9fe7e3113e2ae01
2026-08-17 13:55:38 +00:00
dan
0085ea1443 Have the fts5term and fts3aux virtual table modules only process constraints on the term column that use binary collation. Report [bugs:/info/2026-08-17T10:17:15Z | 2026-08-17T10:17:15Z].
FossilOrigin-Name: f26099b7fad1eab2791b574c9371021d4f05fbf824141e77cdff921a2819866a
2026-08-17 11:52:13 +00:00
drh
3d18207a6f Fix typos. Turn off -fpfmt and -ifmt using "auto" instead of "default".
FossilOrigin-Name: 530b55da56326f4816d43893d05f57b10541605a9508b0b37c46df21ecd22b76
2026-08-15 12:22:31 +00:00
drh
c799c15dbe Refactor "realfmt"→"fpfmt" and "intfmt"→"ifmt".
FossilOrigin-Name: 17277813d101187d85755b7bad3f1c95380335021e13ee368be0add0c8c346b3
2026-08-15 10:10:17 +00:00
drh
0fc163ea1f Add support for integer and float-point format strings to the
"format" method of the sqlite3 object in the TCL interface.

FossilOrigin-Name: 49778c334aaed6d05342a2063cf7f9f8caa1ec9aac0d49ac1db491ddd3d564b5
2026-08-14 17:22:08 +00:00
drh
a6a26aa3f5 Fix an off-by-one bug in --intfmt. Add some test cases.
FossilOrigin-Name: 4e86fc1922e347825e1160652a2d5e6c60d04eabe847621b08f03b05b66904ea
2026-08-14 16:34:00 +00:00
drh
d1e066bf3f Initial code for an enhancement to QRF that allows for app-defined format
strings used to render integer and floating-point values.

FossilOrigin-Name: 067083e973b195f50fa0d199e24a3b01d1b2780a0812fda63d3747c4c75662bf
2026-08-14 15:57:32 +00:00
drh
14031447d4 Adjust the bytecode so that in a RIGHT OUTER JOIN, whenever a row from the
RHS table is added to the output set, the "match" index is updated to avoid
duplicate rows.

FossilOrigin-Name: 9d39b0973bff5af1787fafdd49e455c6c27d493c3bce997ae0fdf88eb9adb1d2
2026-08-14 13:07:17 +00:00
dan
b1c41f40b0 Fix the fts4aux virtual table so that it consistently behaves as if its columns have blob affinity. Report [bugs:/info/2026-08-14T07:27:28Z | 2026-08-14T07:27:28Z].
FossilOrigin-Name: d5b57f76b63552b23ba3e5e372a3773118b929a4116f60f374a91cba87c1152e
2026-08-14 10:57:58 +00:00
drh
9e3e03dfcf Try to make test/testrunner.tcl work on other BSD variants. This change
is untested as I don't have access to any of those BSDs.
[bugs:/info/2026-08-13T17:55:42Z|Bug 2026-08-13T17:55:42Z].

FossilOrigin-Name: c406ce3f1e3b1a8edea2dbb03aff5649d5217019b23c88b0ae73e627a3a983ee
2026-08-13 18:55:01 +00:00
dan
1238b6d4f7 Disable the seekscan optimization for IN(...) expressions when the RHS is a SELECT that returns more than one column. This was previously only possible if the sqlite_stat1 table was populated with inconsistent information, and was malfunctioning in some circumstances. Report [bugs:/info/2026-08-13T08:45:47 | 2026-08-13T08:45:47Z].
FossilOrigin-Name: 601615fd00574a22724bb8ac93513072c2061b0e32b05f927378426c5ec73d50
2026-08-13 18:50:59 +00:00
dan
cb928efd50 Disable the seekscan optimization for IN(...) expressions when the RHS is a SELECT that returns more than one column. This was previously only possible if the sqlite_stat1 table was populated with inconsistent information, and was malfunctioning in some circumstances. Report [bugs:/info/2026-08-13T08:45:47 | 2026-08-13T08:45:47Z].
FossilOrigin-Name: 9544d46a6d51dbc12057e33ec1a635cd2cd48101c46d4b92171b56b70ea23f53
2026-08-13 18:37:39 +00:00
drh
7b83f65a33 The OP_Affinity opcode with argument E should not try to preserve IntReal
but should cast the value to a pure Real.
[bugs:/info/7f7431180a3b08d1|Bug 2026-08-13T08:12:13Z].

FossilOrigin-Name: 5a4e6920afce4a5b63f8ad4e183506a5dd738dd191027395b710a2904eb7f296
2026-08-13 16:10:04 +00:00
dan
939165ae51 Ensure that if a seek-scan is used for an expression like (x, y) IN (SELECT a, b FROM ...) then the SELECT delivers rows in order of (a, b).
FossilOrigin-Name: c9661d928e9002771b586f09e7b6bad15ffba4466a52a7ca441a661ea2ffdbec
2026-08-13 15:16:49 +00:00
dan
acc18b80ef Fix a problem in the fts4aux virtual table causing it to sometimes return spurious SQLITE_CORRUPT errors for fts4 tables with more than 1 column. Report [bugs:/info/2026-08-13T05:56:36Z | 2026-08-13T05:56:36Z].
FossilOrigin-Name: 06f3f9f93be17584982b5fbd84eb1f35b6e15e9271e8d128df5452226fb3b5b9
2026-08-13 11:29:33 +00:00
drh
bea60d9466 Disable recently added test cases for immutable=1 when running
the inmemory_journal permutation.

FossilOrigin-Name: 198e602053e0f9e7d09cfa2238d0fe45d3120c0a7a6e2d770bebfc8655ea7737
2026-08-13 00:21:08 +00:00
dan
eeea6c76e3 Fix tests recently added to nolock.test so that they run on windows.
FossilOrigin-Name: bc57a14ab92dd8c247a893cf4cec7c0dccaa7e8407854a63aa3af699c60bacd5
2026-08-12 13:41:46 +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
a393a5e05d Ensure that databases opened with immutable=1 specified are opened read-only at the OS level. Report [bugs:/info/2026-08-11T17:21:54Z | 2026-08-11T17:21:54Z]
FossilOrigin-Name: 702cdeb78c19ac971892093bf9d9c90d3c6b7193518db2437d89123fffd9c5f9
2026-08-11 18:22:01 +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
67bf81a85d Fix a problem introduced by [32c762bbb1] causing sessions module conflict handling to malfunction when used with a database handle configured with sqlite3_extended_result_codes(). Also ensure the "session_eec" permutation, which would have detected this, is run as part of release testing.
FossilOrigin-Name: 8b3da5d6cea2e3b31784f5e8f05c4801a3d881039aa26ecadf3a50b4454a3de6
2026-08-07 13:33:54 +00:00
drh
0a5f27711f The sorter enhancement at [bdc841de10fef65b] contains a bug where it
might sort 64-bit integers in the wrong order due to the limited
precision of double.  Fixed here.

FossilOrigin-Name: 6bdfff7ddb63d0b4f28f6c174a36e81486a652056a4e21644378a22feda780fd
2026-08-04 20:40:10 +00:00
dan
0fae7568b2 When processing a vector IN(...) term in a WHERE clause, do not add individual terms for each column if the RHS of the IN(...) is a query that is expected to do the special min-max aggregate behaviour. Possible fix for [bugs:/info/2026-08-03T09:05:06Z | 2026-08-03T09:05:06Z].
FossilOrigin-Name: b5cee626e149c2cd977ad682ca34ccafe847a468f9e01b365a1fd901a08176e4
2026-08-03 14:10:21 +00:00
drh
1e7bd5531e Make the test-use-only SQL function fts3_exprtest() (available only if
compiled with SQLITE_TEST) more resistant to out-of-bounds inputs.
[bugs:/info/2026-08-02T12:28:28Z|Bug 2026-08-02T12:28:28Z] and
[bugs:/info/2026-08-02T12:31:40Z|bug 2026-08-02T12:31:40Z].

FossilOrigin-Name: 30a61347077f4b9996f6ea771c7fd27203ab05039d54cc4df3068e45faf4d2d4
2026-08-02 22:45:36 +00:00
drh
ee917329f8 Cap constraint values on constraints to the amatch virtual table so
that they fit into a 32-bit signed integer.
[bugs:/info/2026-08-02T13:01:25Z|Bug 2026-08-02T13:01:25Z]

FossilOrigin-Name: 092b87164aa7d097287ad0fee4be8b66cf840043dc3091193824d74f2d54a833
2026-08-02 21:59:03 +00:00
drh
a1594cadeb Reduce the size of test cases for the closure extension so that they
run faster.  The closure extension is not important for anything anymore
and is retained mostly for historical reference.  There is no point in
burning CPU cycles testing it with large cases.

FossilOrigin-Name: 73350e128141ab21d8f4c1213a1cca4e153151d85e39643defd438341ed53d14
2026-08-02 17:22:13 +00:00
drh
83e6d3e471 Enhance the (unsupported) closure extension to support 64-bit "depth"
values. [bugs:/info/2026-08-02T13:11:13Z|Bug 2026-08-02T13:11:13Z].

FossilOrigin-Name: fccfd5c410c875c35b72475d442c9c1d384deaef1859ba05586841d6c0909e0d
2026-08-02 17:12:01 +00:00
drh
c59cf28db7 Do not allow the (obsolete and unsupported) closure extension to use itself
as its own reference table.
[bugs:/info/2026-08-02T13:07:40Z|Bug 2026-08-02T13:07:40Z].

FossilOrigin-Name: 5e347561c3f8d271bf47c44473fa4b51b87ccab91b40c33f5aad28990a26e9ba
2026-08-02 16:32:28 +00:00
drh
9274a8d14e Fix the detection ON clauses using tables to the right so that it does
not depend on the order of cursor allocation, which is inconsistent with
recursive CTEs.  Problem introduced by [d96271db6a3a44e5]. Reported by
[bugs:/info/2026-07-29T17:50:40Z|Bug 2026-07-29T17:50:40Z].

FossilOrigin-Name: 5a22150bf812774825ffc5bd8adcb5aa6d2177d5fe7eb95cb4130e4a44a706c6
2026-07-29 23:28:56 +00:00