Commit Graph

27744 Commits

Author SHA1 Message Date
drh
becd92a508 Version 3.45.2
FossilOrigin-Name: d8cd6d49b46a395b13955387d05e9e1a2a47e54fb99f3c9b59835bbefad6af77
version-3.45.2
2024-03-12 11:06:23 +00:00
drh
0f28d44463 Fix the ".import" command in the CLI so that it works correctly with tables
that contain computed columns.

FossilOrigin-Name: b26f24441f84a30deb9a562ab6c6de7543fbc3b3b93c34277964c9c21d734153
2024-03-11 11:26:20 +00:00
drh
1b386f1d86 Reenable the use of SQLITE_OMIT_VIRTUALTABLE by fixing
a misplaced #endif caused by the merge at [c080560c2d0d753c].

FossilOrigin-Name: 71120ea83783ee04c6dd9ef260f6ec528935b5ea3baf2348c6d5ec258093271b
2024-03-09 13:17:12 +00:00
drh
bd1ee6ccdb Fix the rtreeJ.test module to align it with [cd017c28d516399e].
FossilOrigin-Name: 111b3d8270db4f61efd9f4c02636f50e44bd9547261d1d922de2708bc7a07151
2024-03-09 13:10:28 +00:00
drh
fd56dbf1b8 Handle an OOM case in fts5 code to query tokendata=1 tables.
FossilOrigin-Name: ebf59fa374000169e2ab3f353e2d7c15efd32e3ce2297e893461e6c303de5d4a
2024-03-09 12:30:30 +00:00
drh
c70c328bb7 The NOT NULL strength reduction optimization should
be applied to the WHERE clause only.

FossilOrigin-Name: be266c713963d724802f5e9ad9d7d3c3d7f4daf1d95b63df6df1beb3a065bdab
2024-03-09 00:38:57 +00:00
drh
57976a82fa Silently ignore redundant ON CONFLICT clauses in an UPSERT.
FossilOrigin-Name: 46245855a0be1b4ed0efcde30f0919fb6361affc4443a4ed2fdac01ab6864df1
2024-03-08 14:11:49 +00:00
drh
526128055b Fix a memory leak in new memdb1.test test cases that were added by
[e638d5e408ea2e18].  No changes to SQLite itself.

FossilOrigin-Name: f0a49dc8bc22d4889677d03beccda8f71f7374ae56b5c78f7395769f9272dc77
2024-03-06 21:53:55 +00:00
mistachkin
b99f165a1b Fix harmless compiler warning seen with MSVC.
FossilOrigin-Name: 5aa809bcfecc321f122a60f43bc674c7f099cf1ccb2ed976dabb29d8fde83adc
2024-03-06 21:22:34 +00:00
mistachkin
178cac8e2e Fix harmless compiler warnings seen with MSVC.
FossilOrigin-Name: c0f61524103d2421aa1e0fe39f028eed04d115bb4eb245b6c8623bd1c6fed481
2024-03-06 21:08:42 +00:00
mistachkin
0bda8bfbfb Fix a minor test file locking issue on Windows.
FossilOrigin-Name: a44752806f854f06e787bb789d7dbf647219f15d3e315853bb4bc8049f47ef09
2024-03-06 21:06:07 +00:00
mistachkin
4350d16805 Work around obscure floating point issue seen with older versions of MSVC.
FossilOrigin-Name: 6055715febf6e61e37125635b7ec29392fbaab367927411617f5e15d9a95cb82
2024-03-06 21:00:13 +00:00
mistachkin
20f11538f4 Fix two -Werror=lto-type-mismatch warnings reported in [forum:ef62b57bd5|forum post ef62b57bd5].
FossilOrigin-Name: d4e423f3a466a39e435efba81ac33fd80164aaaa43827c2f4f965c1e77b3ef6c
2024-03-06 20:59:38 +00:00
mistachkin
c87f53a3f3 The quote() SQL function should convert +Inf into 9.0e+999 and -Inf into -9.0e+999. See [forum:/forumpost/6675b25108|forum post 6675b25108].
FossilOrigin-Name: 07a9ef888db05a85c2baf8781e5ac51a9dd27e0ef94ca4ebd750045e9690226b
2024-03-06 20:58:52 +00:00
mistachkin
31d4a3d27f Make sure key comprisons are done correctly if the index key contains NaN values that have not been shifted into NULLs. That can only happen due to database corruption, but we need to deal with it nevertheless.
FossilOrigin-Name: 7ed922d99ca9801dc1926df529b2fa93be374f587885282ab6e307ea6cf2ccee
2024-03-06 20:58:08 +00:00
mistachkin
0691451557 When inserting a 3-byte cell into a btree, ensure that the extra padding byte is 0x00. This is not necessary for security, as far as I can tell, but it seems like a reasonable precaution.
FossilOrigin-Name: f3e841873dffaa8cd2f4f3cf260487ed402febb99b9ccad04e2a1d481e903aca
2024-03-06 20:56:52 +00:00
mistachkin
fe271d6717 Rig sqlite3_serialize() so that it will initialize a previously uninitialized database prior to serializing it, so that it does not have a zero-byte size and does not return NULL (except for OOM). [forum:/forumpost/498777780e16880a|Forum thread 498777780e16880a].
FossilOrigin-Name: 22a33f133e3e833c960f46e1b4c74043010181ff7ba9e57f2d009b65d3275d82
2024-03-06 20:55:44 +00:00
mistachkin
e7daad213f When doing a text-affinity comparison between two values where one or both have both a text and a numeric type, make sure the numeric type does not confuse the answer. This is a deeper fix to the problem observed by [forum:/forumpost/3776b48e71|forum post 3776b48e71]. The problem bisects to [25f2246be404f38b] on 2014-08-24, prior to version 3.8.7.
FossilOrigin-Name: 6d385ccda8aba16a37c5e8c39f3aeba97c472321e4c8c9efac2de4518b61bdc8
2024-03-06 20:54:38 +00:00
mistachkin
8013e8cffb Ensure that the replace() SQL function always returns a TEXT value even when its first argument is numeric and its second argument is an empty string. Fix for the issue reported by [forum:/forumpost/3776b48e71|forum post 3776b48e71].
FossilOrigin-Name: a7c98c8f19a1ac049b846da584b246706f2159455f4de7b50aacc1385b9f2987
2024-03-06 20:52:38 +00:00
stephan
91b54ccc8f Reformulate [34439fe3aeea7cbb] slightly to resolve a false-positive OOM reported in [forum:2eadfe94e3|forum post 2eadfe94e3].
FossilOrigin-Name: 320ccb5d5f5c3b25b319426b62c8a86fc3209a04480f5ca7f6f40cb16f04c795
2024-03-05 17:39:56 +00:00
drh
73811c3252 The value returned by the json_each.json field needs to survive longer than
the json_each virtual table itself, in the event that the value is used in
an aggregate expression.  dbsqlfuzz 5120bd0b3bb0b73eebbcb79ac37c6b0663fccad6

FossilOrigin-Name: 040946b342fd532692025806c124643842fdfda55e0c492cd058dcb7f054cc79
2024-03-05 16:59:00 +00:00
drh
a187643752 Fix rounding in zero-precision %f and %g printf conversions.
FossilOrigin-Name: 1ebea57ff212aaac83f388cdebd13f319a7c57b0cdc7467b26d3f49cb7e39666
2024-02-17 03:36:05 +00:00
drh
73a9088ef8 Fix the subtype on the value column from json_each/json_tree for cases
when the value is an array or object.

FossilOrigin-Name: b278ae3980066e5d0561baa869ef6d22d10cbd0481d1bc0e67f099e93fc3a93b
2024-02-16 21:34:08 +00:00
drh
f3c9b779ff Fix a bug in PRAGMA integrity_check introduced by enhancement (8a) in
release 3.42.0.

FossilOrigin-Name: 60dccb23b11f7e4a743e867f393f34f673600c12f1e7199e505f2e2b81c6dacd
2024-02-13 18:44:28 +00:00
drh
fd97f350fd Have rtree avoid keeping a blob handle open following an error.
FossilOrigin-Name: 26978f34bd03b052d40fbc84037fb0e0ca04e571cf8055bf834e9da1dc3cec83
2024-02-12 17:01:33 +00:00
drh
8f28852ca0 Cherrypick multiple fixes for trifling faults from trunk, so that all 834
dbsqlfuzz run clean with ASAN on branch-3.45.
dbsqlfuzz.

FossilOrigin-Name: c080560c2d0d753c41c265c154c8185b7b5065ba1f2457476aa39c687675d91f
2024-02-11 23:25:02 +00:00
larrybr
bd3d3486d9 Further clarify sqlite3_exec() callback parameter lifetime.
FossilOrigin-Name: 044ce823a45f024fe3dfe8a44bab8f25affb7bc54cfbe01a00719217b93ff6f8
2024-02-10 03:12:46 +00:00
larrybr
37fdb9696f Mention limited lifetime of string arrays passed to sqlite3_exec() callback.
FossilOrigin-Name: d14a9d81a59cb55be68cc057166050cbb9b474be865a6998a9beeed54d6b388d
2024-02-08 01:23:22 +00:00
drh
f7853591ba Detect and respond to an OOM on the jsonStringTerminate() call of
jsonReturnStringAsBlob() routine.

FossilOrigin-Name: 77431aca6ec0aaeacdc9173ca19e996498650ad19934fc77681203c0c9f06632
2024-02-07 14:16:47 +00:00
drh
ae819b3a50 Return SQLITE_ABORT if the underlying shadow tables change in the middle of an rtree query in such a way as to invalidate an rtree internal priority queue entry. This replaces the SQLITE_ABORT_ROLLBACK mechanism added in [97cffff331b].
FossilOrigin-Name: 061af0d74a436efa24b348e9a0f9fe6d6d52c02e5c03929e6f9c7f0e2ef3e2a0
2024-02-06 13:36:29 +00:00
drh
8b5f0f37fa Following a ROLLBACK that reverts changes to an RTREE, any pending queries
against that same RTREE abort with code SQLITE_ABORT_ROLLBACK.

FossilOrigin-Name: 97cffff331b5f95abed5451f9d0cef085c3fc8911efbcd2422c1c78eac17b669
2024-02-03 19:41:34 +00:00
drh
189e44dfec Version 3.45.1
FossilOrigin-Name: e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257cc467a
version-3.45.1 vesion-3.45.1
2024-01-30 16:01:20 +00:00
drh
651dcec4a7 Detect malformed nested JSONB earlier and stop rendering to avoid long
delays.

FossilOrigin-Name: ab40e282465c989bf249453d7c6f60072a38b691f579411cdf9aad234b20f0f7
2024-01-29 21:29:22 +00:00
drh
3ff77c5053 Avoid a potential buffer overread when handling corrupt json blobs.
FossilOrigin-Name: ac402cc551b2cbe3f8fbbc9c711a04942eab5eeb9d2f4a394e9370d2380427b5
2024-01-29 16:49:28 +00:00
drh
f838022342 When rendering JSONB back into text JSON, report an error if a zero-length
integer or floating-point node is encountered.  Otherwise, if the node occurs
at the very end of the JSONB, the rendering logic might read one byte past
the end of the initialized part of the BLOB byte array.  OSSFuzz 66284.

FossilOrigin-Name: 3ab08ac75d97ffd9920f5c924362a4819560b40faa8a4f9100068057f5fa420a
2024-01-29 12:58:12 +00:00
drh
e6a50562f4 Automatically disable the DISTINCT optimization during query planning if the
ORDER BY clause exceeds 63 terms.

FossilOrigin-Name: 6edbdcc02d18727f68f0236e15dde4ecfc77e6f452b522eb4e1e895929b1fb63
2024-01-28 17:44:47 +00:00
drh
f032114147 Apply the same fix found in [99057383acc8f920] to descending scans.
FossilOrigin-Name: 593d6a1c2e9256d797f160e867278414e882a3d04d7fea269bea86965eaa7576
2024-01-28 00:35:24 +00:00
drh
00af690017 Slight adjustment to test results for Windows in mmap1.test due to
the previous check-in.

FossilOrigin-Name: a8043eaed899285b5cf4aab0c23c3dabb8975910c353cb579fd1f1655db390f6
2024-01-23 21:10:28 +00:00
drh
a8556eef91 In os_unix.c and os_win.c, do not allow xFetch() to return a pointer to a page buffer that is right at the end of the mapped region - if the database is corrupted in a specific way such a page buffer might be overread by several bytes.
FossilOrigin-Name: d131cab652ac11795322af13d0b330e7e44ab91587a1a3e73fe7b9a14b2dd531
2024-01-23 16:17:00 +00:00
drh
e8df88eae9 Fix harmless "unused parameter" compiler warning in the new fts3IntegrityMethod
implementation.

FossilOrigin-Name: 9d459f6b50fb6f995e6284a0815c5e211cacac44aad0b96bf01ba68af97f51fc
2024-01-23 15:04:07 +00:00
drh
1e47802761 Bump the version number to 3.45.1
FossilOrigin-Name: 54d34edb89430b266221b7e6eea0afbd2c9dafbe774344469473abc8ad1e13fd
2024-01-23 13:58:41 +00:00
drh
5b9e435d7f When a JSON input is a blob, but it looks like valid JSON when cast to text,
then accept it as valid JSON.  This replicates a long-standing bug in the
behavior of JSON routines, and thus avoids breaking legacy apps.

FossilOrigin-Name: 4c2c1b97dce46a279846380c937ac6de5c367927c6843516641eead7ea6db472
2024-01-23 13:53:45 +00:00
dan
f05bd8b21a Ensure that the xIntegrity methods of fts3 and fts5 work on read-only databases.
FossilOrigin-Name: e79b97369fa740f62f695057d4a2cf8dae48a683982ec879f04a19039c9cb418
2024-01-23 10:47:04 +00:00
drh
b5c5f36da8 When backing out a character in a constructed string in JSON, first make sure
the string has not been reset by on OOM.

FossilOrigin-Name: 950bf9fe7829864e0abe6d71ca0495f346feb5d7943d76c95e55a6b86ea855da
2024-01-20 12:19:16 +00:00
stephan
0dfdf2db59 wasm build: reformulate an awk invocation to account for awks which do not support the -e flag. Problem reported on the forum via a docker-hosted build.
FossilOrigin-Name: 90dd51153fd0a6197e2ee49b5492ad120f0bfc324b60651f3d4f47c286887b46
2024-01-16 14:28:59 +00:00
drh
f352e0a9cf Version 3.45.0
FossilOrigin-Name: 1066602b2b1976fe58b5150777cced894af17c803e068f5918390d6915b46e1d
version-3.45.0
2024-01-15 17:01:13 +00:00
dan
4c6554223e Have the shell tool automatically enable SQLITE_CONFIG_DQS_DDL when executing a ".dump" script against an empty db.
FossilOrigin-Name: f47a5f4e0ce078e6cc1183e6cbb3c4013af379b496efae94863a42e5c39928ed
2024-01-12 11:44:49 +00:00
drh
e5b2132df6 Fix a comment in sessions. No functional changes.
[forum:/forumpost/8c20dc935b|Forum post 8c20dc935b].

FossilOrigin-Name: b0eb6d3628c1f70399a22d9fd3b79a796bc343adfeba50515440db609565961a
2024-01-11 14:13:17 +00:00
dan
c08a8a33d3 In fts5, flush the contents of the in-memory hash table whenever the secure-delete option is toggled. This prevents spurious corruption reports under some circumstances.
FossilOrigin-Name: ccf552319a62bfb329820a3bc1f490bacbaa6e90694a257fc65a568a605542c3
2024-01-11 14:03:08 +00:00
drh
5fdabcf9ff Put an SQLITE_ENABLE_SETLK_TIMEOUT branch inside the appropriate ifdef with
an assert on the else since the condition is always false if SETLK_TIMEOUT
is not available.

FossilOrigin-Name: d81e7a036ac5d70b6a6ee6ab7d81e041c1f5fc04b70bcee47e203d521caf7e93
2024-01-09 23:15:46 +00:00