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

2781 Commits

Author SHA1 Message Date
drh
5285494b18 Fix the sqlite3_bind_value() interface so that it does not remove a
byte-order mark on the value being bound.

FossilOrigin-Name: 56e268312d038608b5fb2a8ed24002f478ad5a22eb0214b1a064f2926aada66c
2026-10-23 15:30:27 +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
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
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
6e35c19f17 Merge branch-3.54 fixes into trunk.
FossilOrigin-Name: dc388e83b05dd637aafa684eee5f7b51627d39ddfbc97633958266803e882e93
2026-10-10 19:19:12 +00:00
drh
d85a80711c Back out a minor performance optimization associated with
sqlite3VdbeMakeReady() as it has been found to not work correctly on
some 32-bit builds.
[bugs:/info/2026-10-10T18:05:46Z|Bug 2026-10-10T18:05:46Z]

FossilOrigin-Name: 6ebd1e69486cabc6be3316426f67341d75073e8b392de5d6e5307662dd0000dd
2026-10-10 19:11:52 +00:00
drh
4c7729af99 New extension ext/misc/optname.c provides the canonical mapping between
optimization bitmaps and optimization names.  This gives a single point
of edit when there are changes.  Used by the CLI, by testfixture, and by
TH3.

FossilOrigin-Name: 135ed9e2cc9bd37c3e158a488e37f4ce14ffeca44ff12e31f25a6686a2622ca1
2026-10-10 17:40:46 +00:00
drh
d76e14d85e Add comments to help remind developers to keep the table of optimization
disable bit values in sync with the CLI and with TH3.

FossilOrigin-Name: 0e707e7dba7edadda9951549ae3aa34b713a0f2210ccc486e181e833c74e2fa6
2026-10-10 00:11:38 +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
dan
6e20be1c58 Ensure that eponymous virtual table objects are not left with dangling schema pointers if the main database is overwritten using sqlite3_serialize().
FossilOrigin-Name: 18d2646f6fa56244be12122873cd9aa48b2074a22f0be637edfcc9b5de99158b
2026-10-05 14:03:54 +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
jeffchen
9173c2f1b6 When looking up a text key in a temporary index, use the fast memcmp-based comparison if the index uses the built-in BINARY collation. Indexes in the schema already got this fast path because they record BINARY as a NULL collation pointer.
FossilOrigin-Name: ebb4534bc8c19ba2b960112eadc328b937c11acf5b846bf9e3df53846c6e375b
2026-09-11 22:11:09 +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
69785dee50 Merge the latest trunk enhancements into the union-to-union-all branch.
FossilOrigin-Name: c58631b26ad6ee39d8db2700a26413249fd88d137c3a7944bad7af07cd7fe121
2026-08-25 15:49:27 +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
ea9d7d9db1 New optimization bit SQLITE_UnionLimit.
FossilOrigin-Name: 5890dbe54dd06fc7770267f59a430a47a39f7aaa0563274b851931e0dae754b2
2026-08-22 14:41:42 +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
d3d39ef12f Merge the latest trunk enhancements into the opt-inline-jsonbPayloadSize
branch.

FossilOrigin-Name: 88fbeafc8d783fe72625c3c631cf0163ff98b2eb42152e401e14d3df66199a7a
2026-08-18 23:04:22 +00:00
dan
bb7c3e8eac Refactor the new code on this branch.
FossilOrigin-Name: 76a03b5314bd3a48e5f8de60c47cdb6ae749a8741bf0dede0a3b599a796d76d1
2026-08-18 21:12:12 +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
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
4616815533 Partial in-lining of jsonbPayloadSize(), happens in only 5 performance critical
places instead of everywhere.  This gives 96% of the performance increase with
only 18% of the object code size increase.

FossilOrigin-Name: e934c4a7aa66bf9d0214a7946b5ea51b92c11996c920ea8e2ed2513319518f43
2026-08-16 23:05:00 +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
7e15154660 Create a new varint decoder that does not need to return the size of the
varint, and use that in sqlite3BtreeTableMoveto().  Omit the pointless
getVarint and putVarint macros and use the actual function names instead.

FossilOrigin-Name: f845ede54c065ebd222f3f3488f655f2cbbf2c40bae782b3f4eac76cbb0525ad
2026-08-12 19:42:02 +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
drh
15b79d7af8 Experimental changes to improve performance of the OP_MakeRecord opcode,
and especially the code the writes integer content into the record.
This change is not yet 100% correct.  It is a work in progress.  Parking
on a branch because I need to stop and work on other things.

FossilOrigin-Name: fa8dd2af6da66d14e6e2dbf68692d02322f750198fdf97be0b72f04e0a4ca79b
2026-08-10 15:36:31 +00:00
drh
c9771b7018 Replace the EIGHT_BYTE_U64 macro with the in-line function sqlite3Get8byte()
which is more efficient cross-platform.

FossilOrigin-Name: 9492183f2f954d89be698e0d48123d50a6dc96c06b18482e1f06ae9031506033
2026-08-10 12:29:43 +00:00
drh
1a2ed04399 Enhance Bloom-filter support so that it works with blob values and with
text values as long as the collating sequence is binary.

FossilOrigin-Name: a67bff640c9e4ffdf2f48c049eaf829b9e43d167a1055bf8780ff29c910bbade
2026-07-23 21:34:16 +00:00
dan
6f9ef2245e Change the way pointers are passed between C code and Tcl test scripts. This allows tests to be run with Fil-C builds.
FossilOrigin-Name: ba919ea1d4fe84526a4c844b3f901e5e8b1650dcdee647e4d46da2d33ced1710
2026-07-23 20:04:20 +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
b15184e582 Improvements to the implementation of sqlite3_result_str() so that it
has 100% mutation coverage.

FossilOrigin-Name: 121f54c532d51af017d93996c40a694227064f1204429a7df1f1e2daff862eba
2026-07-11 19:49:54 +00:00
drh
a9a1fac180 New compile-time option SQLITE_MAX_SCHEMA and runtime limit option
SQLITE_LIMIT_SCHEMA that put an upper bound on the number of objects
in a database schema.  Current default is 10 million.

FossilOrigin-Name: 4ff362a4c2897e2b438d3d8fc88a012264526fa617f058be5a2d596c42d2e8a4
2026-07-10 15:06:05 +00:00
drh
fa8e52021f Put the sqlite3OomStr singleton in "const" space to ensure that it is
never modified.  Doing so identified a long-standing bug.

FossilOrigin-Name: 2fe53e6d68c3f9f1c4b064fa40fe8efe12025179a973182f0bb256acb9b5d58d
2026-06-19 22:17:09 +00:00
drh
ec4f18fed8 Additional changes based on Claude analysis.
FossilOrigin-Name: d4691a0db1e96b646d3094f183b1fc330411a2d2472b09f9b5fe0fb268b5ca09
2026-06-19 21:43:04 +00:00
drh
9487f6d441 Further refinements and uses for sqlite3_result_str().
FossilOrigin-Name: 974253a6058a7120354261b2134ed4803373031996957c7334161370b80bf428
2026-06-19 20:01:47 +00:00
drh
e070f37183 Small parsing performance improvement by reducing the amount of the
Parse object that needs to be initialized.

FossilOrigin-Name: 0901b7c2dfb87707fa159f24ada5abb0a2914043c6f0571de4ce55c80edb663b
2026-06-17 20:11:26 +00:00
drh
b5d0d980be Remove the unnecessary Parse.szOpAlloc field, for small size reduction
and performance improvement.

FossilOrigin-Name: 9a2a230464e4314033e67e602dbd9f554f50ec2eefc7b1a5f05b85249591f7b8
2026-06-17 19:28:17 +00:00
drh
9fb225190c Limit VIEW recursion depth to SQLITE_LIMIT_EXPR_DEPTH to prevent
static overflow in malicious schemas with tens of thousands of
levels of recursive views.
[bugs:/info/2026-06-16T04:21:51Z|Bug 2026-06-16T04:21:51Z]

FossilOrigin-Name: 3f3fb9b638f59ad982beafb7c117f24ddd3da612e62c862510805fa672ffae06
2026-06-16 13:43:08 +00:00
dan
b7c32f2f29 Fix instances of potential buffer overflow caused by loading the contents of a stat4 table with an absurd number of samples in a 32-bit build. Bug [bugs:/info/2026-06-16T11:30:52Z | 2026-06-16T11:30:52Z].
FossilOrigin-Name: 0b72246732fecd7909add28f2d95f1727e1c4dc6c8f3b8e6e3482f6d17c92d34
2026-06-16 11:53:19 +00:00
drh
1d2f71ce4a Do not allow internal-use-only functions to be used in CHECK constraints
that are added as part of ALTER TABLE ADD COLUMN.

FossilOrigin-Name: 28272746fb13dcdbe2a4f21ef30446c316dfc843aa3d48f135f490abaee34198
2026-05-12 19:33:04 +00:00
drh
431b85963f Fix a copy/paste error in a comment. No changes to code.
FossilOrigin-Name: 2741193e81750512cae8bb14ebc03fa11dde100da144488b4da1c81a351e4ff6
2026-05-12 18:06:44 +00:00
drh
5f6a6fa6f0 An alternative fix to ALTER TABLE ADD CONSTRAINT.
FossilOrigin-Name: a231fc6d58abb3b76d0e669babdb377e41b5a348d155ab5f2c1fe49eefbbf3a9
2026-05-11 12:38:18 +00:00
drh
c9bed48c3c Fix comment typo
FossilOrigin-Name: d64a1dbe0fb2d9286806d833a3146b21d5bf1636a650d5a64cf163c7f2356e98
2026-04-28 12:49:10 +00:00
drh
f6b807a022 Performance improvement in the substr() and length() SQL functions.
Caution: The new code may give different results for malformed UTF8.
I do not consider that to be a problem by the GI/GO principle.

FossilOrigin-Name: 6124d27a33f4562f40777c2c6318d61709f7b481f23f9ade45064d8ad0700752
2026-04-18 12:31:53 +00:00
drh
6d27844bbe Merge trunk performance enhancements and fixes into the direct-printf branch.
FossilOrigin-Name: 9fa9cd11f8f5f7591168870c6e41121221b58a4a3094e708e3fa5bab1502f190
2026-03-29 19:23:47 +00:00
drh
03f13d77a5 Avoid using unsigned 64-bit integer division on platforms that do not support
it in hardware.

FossilOrigin-Name: 2197677491dfc5ec87b57bbf807776875248a250f80ce9a5ce94ae385bb1d2bc
2026-03-29 19:06:36 +00:00
drh
eb0cb3f53b In sqlite3_str_vappendf(), write floating-point renderings directly into
the output buffer, saving a memcpy().

FossilOrigin-Name: e4e040e7aaaf5bfccbf0414fee3d08c5fdc24e03d1118dce92d2dd16c614ce63
2026-03-28 20:24:47 +00:00