Commit Graph

27787 Commits

Author SHA1 Message Date
drh
3c5a810646 If a term of an ORDER BY or GROUP BY contains an aggregate function or column,
then it is not an alias that needs to be resolved, so don't try to.  This fixes
a harmless assertion found by dbsqlfuzz.  This yet another problem that
orginated at check-in [6e6b3729e0549de0].

FossilOrigin-Name: d4ec2a5d2297cd9ead0a8768dcf003ea76c74d8d68d88c40f62363f484a4a4d3
2024-02-11 20:53:14 +00:00
drh
ece3567aec Improved AggInfo tracing in debug builds. No changes to deliverable code.
FossilOrigin-Name: bb31f9c44794e02a46ed3edbcc96eb48c5870d3f82cb404586ded9a3efa7a859
2024-02-11 18:53:48 +00:00
larrybr
589c407f12 Further clarify sqlite3_exec() callback parameter lifetime.
FossilOrigin-Name: 993a1a843177b19a9cb5598f57d1e05c01e1695f164faaa9ae22810ad4533eba
2024-02-10 03:11:42 +00:00
larrybr
25e172d429 Mention limited lifetime of string arrays passed to sqlite3_exec() callback.
FossilOrigin-Name: 717f67f3189a59842f5c17a25e8db0e24ec4405886fc22ab6eeb3954fba5a964
2024-02-08 01:19:46 +00:00
drh
0f777cd622 Fix an #endif (added in the wrong place by [8f4b1ceafe4a271b]) so that
the build works with SQLITE_OMIT_VIRTUAL_TABLE.

FossilOrigin-Name: 7070924eebce1d089fde911dc0427ab8f3764d57ace24caff2b79954b42d1b51
2024-02-07 20:45:38 +00:00
drh
722bd1fe89 Bring test cases into alignment with the latest enhancements.
FossilOrigin-Name: cd017c28d516399e25b5ee9e8fcd7390ca2be9128c7c41f1007f37bc01a35717
2024-02-07 19:52:03 +00:00
drh
204b41955e Turns out the branch is reachable, so back out the NEVER().
FossilOrigin-Name: 0af36a3223d2dabda887830390a603ab4781baca7e2f1698ec6c5f2cf03faf04
2024-02-07 19:17:44 +00:00
drh
71cdea8f5f Detect and respond to an OOM on the jsonStringTerminate() call of
jsonReturnStringAsBlob() routine.

FossilOrigin-Name: 881f814c09b6896a448a2360b0b43dc99592ea3a1d72ac359770cbb0a2c7d38a
2024-02-07 14:05:38 +00:00
drh
8babc01892 Slight change to OOM handling in JSON to catch a corner case found by
dbsqlfuzz.

FossilOrigin-Name: 6a2b3266c586d12b51e11fe63cda5881be9373207aa16671ab77f547830eb790
2024-02-06 18:33:01 +00:00
stephan
72c7bb3e1a Correct docs about the first OFPS VFS's importDb() method being synchronous (it's not, whereas the second VFS's importDb() is).
FossilOrigin-Name: ae7505fa5e112f39a329befb35eff6ddf46a53f5deb610906550bf67f56fc157
2024-02-06 08:59:59 +00:00
stephan
db9cc74c9c Make explicit that using the importDb() methods of the OPFS VFSes has undefined results if the being-imported db is currently open. Doc changes only.
FossilOrigin-Name: f28b9924b401b359e59a73918a34b29cde719164a6b4ac5a9d23da6294b701bd
2024-02-06 08:25:23 +00:00
dan
5e922865aa 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 [af5c4251].
FossilOrigin-Name: 32f85a5ce8e32506ad0cf309c86589958f38d924b4b3de532bec8bdb8e385fad
2024-02-05 17:54:03 +00:00
dan
8e4d004ba1 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.
FossilOrigin-Name: 478280ef67efed854988ab4f740a38ae1937204c0434ad8da11f1869a12a6d06
2024-02-05 17:35:36 +00:00
stephan
21ded98df5 Extend [d294a23ed6d] to apply to all wasm speedtest1 builds.
FossilOrigin-Name: 26f848e5e0ac34e545d2f27cf33abc46eac13e04ed9cd71084b0f7d47136ff97
2024-02-05 03:56:02 +00:00
stephan
7d3cd38034 wasm: pass the promiser function to the promiser onready() callback to simplify access to it in certain usage patterns.
FossilOrigin-Name: f8a8b9ee2eddf5f875c7c4399e750ccf1941f767560ebc2c88c083560f5aaae0
2024-02-05 03:37:54 +00:00
stephan
0009d40325 wasm: squelch a new (and, in our case, invalid) warning from emcc 3.1.52.
FossilOrigin-Name: d294a23ed6d1d2b567a02552b8a2e4921cd21891ee86e63f8f9945569e3262d3
2024-02-05 02:36:10 +00:00
mistachkin
7718c866e1 Fix a minor test file locking issue on Windows.
FossilOrigin-Name: 6cd70b71df5c0d45412081590316bced302ec4403d565250b56e611882204821
2024-02-04 04:18:29 +00:00
mistachkin
3ab9c021ff Fix harmless compiler warnings seen with MSVC.
FossilOrigin-Name: e52c87420b072fa68d921eda66069542d50accbfaf1110ac4cc1543a4162200d
2024-02-04 04:01:11 +00:00
drh
7d6f33046f Following a ROLLBACK that reverts changes to an RTREE, any pending queries
against that same RTREE abort with code SQLITE_ABORT_ROLLBACK.
dbsqlfuzz de7d17b72d0e842352c998dd86a47b7d0f707be9.

FossilOrigin-Name: af5c425114f32c2f84aea20edd4fa46eb1bfdeb3747fce357540e15978a070c8
2024-02-03 19:19:18 +00:00
drh
50f9caf270 More extensive use of SQLITE_CORRUPT_PGNO.
FossilOrigin-Name: 3838332cffb87f77a7c6b357066a59b9dc4f65ef4b3496767ad7ad7c14a77be2
2024-02-02 18:42:09 +00:00
dan
3a32690a55 Fix typo in vdbe.c comment. No changes to code.
FossilOrigin-Name: 62010ba488f65aec3c6bd17b05f64c5b3e885dee4221e6016c4eb1053e19284d
2024-02-02 11:37:03 +00:00
dan
09768559b6 Ensure the fts5 xIntegrity method correctly returns error codes unrelated to corruption or missing SQL elements.
FossilOrigin-Name: d18d9a05c2d6f290d7b16eafced0cde4eb8dd3f869778a49103812d35a0cee65
2024-02-01 15:42:22 +00:00
dan
adea051707 Ensure the fts3 xIntegrity method correctly returns error codes unrelated to corruption or missing SQL elements.
FossilOrigin-Name: 1bdb8cbaf7e733e0731de2ecd7a05ddf44db5d8595dcc7aaf0927ed0aa5b33d3
2024-02-01 15:21:55 +00:00
drh
64b76c0ed4 In PRAGMA integrity_check, defer running xIntegrity on virtual tables until
after all ordinary tables have been checked.

FossilOrigin-Name: 8f4b1ceafe4a271b23e17493a244a34c1732a3d35c5533c37394b9f3dc158435
2024-02-01 14:57:24 +00:00
drh
1d09f4d018 Add tracing logic to the shared-cache locks in btree.c. The tracing is
off by default.  Enable by changing a single "#if 0" into "#if 1" and
recompiling.  Debugging code only - no changes to release builds.

FossilOrigin-Name: f2b943f97ad7e47848ac6df3a3a1eba134b9e63c4a631f8eaf8bda77cc02ba7b
2024-02-01 14:17:01 +00:00
drh
d87299cece Add the test_oom_breakpoint() routine on debug builds, to serve as a
convenient breakpoint to intercept OOM conditions.

FossilOrigin-Name: e45df7dcd6b5766d7593ee87e59dd422a217cce0a1a8d369c03144bb21859428
2024-02-01 11:38:58 +00:00
drh
ed0a614c21 Replace an conditional assignment that was made obsolete by [d4c193f0b49f4950]
with an assert().  The conditional was added by [d6fd512f50513ab7] as
a fix for tickets [c36cdb4afd504dc1], [4051a7f931d9ba24], and
[d6fd512f50513ab7] which means now [d4c193f0b49f4950] is the correct fix
for those tickets.
that check-in

FossilOrigin-Name: 44b5524d522e749ad6bf76c94d754ff16c309c32439ec46802924663f64e8b09
2024-01-31 20:11:54 +00:00
drh
d844e0a1c4 Allow control characters in JSON5 string literals.
[forum:/forumpost/05182119f69c3a92|Forum thread 05182119f69c3a92].

FossilOrigin-Name: 380f09c194caff557640692d2f255f8cdc1dcfed5976711686466692f4d7a60d
2024-01-31 15:29:29 +00:00
drh
744581d3d6 Add NEVER() and ALWAYS() macros for the JSON5-control-character change.
Also fix an incorrect comparison used to determine if a buffer needed to
be resized.

FossilOrigin-Name: e3c0c0e686f3b7710f79587cf465b5aac52d8f2f2986a3de885a656f652cbfd3
2024-01-31 15:20:13 +00:00
drh
9486178f39 Fix failure to detect unterminated string literals in json_valid() in the
previous check-in.

FossilOrigin-Name: 5d725644621cf640fb743d59ccf89dac777540410e67501eb00b83638c8c857f
2024-01-31 14:44:59 +00:00
drh
c24f53635c Allow control characters in JSON5 string literals.
[forum:/forumpost/05182119f69c3a92|Forum thread 05182119f69c3a92].

FossilOrigin-Name: 34709c7cc910539e23a830ad8b589a97a88be25e924a59670c1017fb51447dad
2024-01-31 13:46:44 +00:00
drh
b202a452ad Fix a memory allocation bug in the (debug-use-only) json_parse() SQL function.
FossilOrigin-Name: 32ce7dacf58bbf35cf70da8b03fa25f97fcea970edbc1f8aa12739ac4c8608fb
2024-01-31 12:15:57 +00:00
drh
91981fe74e Detect malformed nested JSONB earlier and stop rendering to avoid long
delays.

FossilOrigin-Name: 72f3e1d0eca2b9ebd7c4b4cdccc6d7a0173b2fdb204cb1aa207917aedab6098a
2024-01-29 21:09:56 +00:00
drh
af3824d5fa When generated text JSON from JSONB, do not continue descending into
nested structures after an error is seen.  This avoids long loops and wait
times.

FossilOrigin-Name: 97666ec052ebaceab002874d7ca5c5e6883c3d04fb7d3992235a8c4c8d08407a
2024-01-29 20:36:17 +00:00
dan
581bf002ce Consider an index for queries like "SELECT count(DISTINCT col) FROM ...", even if the index records are not smaller than the table records.
FossilOrigin-Name: ad06868807a27f0c96fa5649ebd981e07909eb2c5e03781377c876fdec49abdc
2024-01-29 19:30:16 +00:00
dan
7f9a1ff3f2 Avoid a potential buffer overread when handling corrupt json blobs.
FossilOrigin-Name: 738473dc0ac353731080d0785cc7dc9810b564906c176916bd91d6cfbb1a7b18
2024-01-29 15:30:35 +00:00
drh
3fc7a34efc 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: b0eb279ea83c1c788c39fb90e178ec99fa4c782195c376a420c661fedf4545a7
2024-01-29 12:50:32 +00:00
drh
4c11a5251a Use __ppc__ instead of __POWERPC__ to identify 32-bit PowerPC processors.
[forum:/forumpost/34794846ce|Forum post 34794846ce].

FossilOrigin-Name: c974d9313b60591bcd554c3ec652a8040d382930e30778e6be8a875145b0b3da
2024-01-28 20:42:12 +00:00
drh
5b480ead99 Automatically disable the DISTINCT optimization during query planning if the
ORDER BY clause exceeds 63 terms.
dbsqlfuzz afd1d61fc27d14938a0d78a50970fa1e9fbfee58.

FossilOrigin-Name: d4c193f0b49f4950b20c2f0e6aa037d2ed7d8c0b4687c14923b3a0d0d4a1b3fd
2024-01-28 17:39:31 +00:00
drh
d921533954 Apply the same fix found in [99057383acc8f920] to descending scans.
dbsqlfuzz afd1d61fc27d14938a0d78a50970fa1e9fbfee5.

FossilOrigin-Name: e1d463c2d6e93e0ae0a60a05a79cd346bd07142de2fe631b370a9b946763b5d6
2024-01-28 00:31:47 +00:00
drh
052f0a95d0 Improvements to parser stack overflow testing.
[forum:/forumpost/99e181b5bf|Forum post 99e181b5bf].

FossilOrigin-Name: 556c43a937f1d1c19117da24e6d892852241189f4e47e1c86aa1e8c36461c5de
2024-01-27 20:17:05 +00:00
drh
21bdfe5884 Performance enhancements to the parser template.
FossilOrigin-Name: 2db8b30acdeaeaf7ec92dc0382a25f96bca4561fb68a72713ff963e27f39c63b
2024-01-27 12:47:51 +00:00
drh
48e899a86e Use an alternative memory allocator for parser stack space that includes
a call to sqlite3FaultSim() to facilitate testing.

FossilOrigin-Name: 7c36d560ff4e8e1b3f8fad972ec7f07837e4fa4e6861fafde970ffccfda5a2f1
2024-01-27 12:25:07 +00:00
drh
ad2689fe4e Allocate new parser stack space from the heap if needed, eliminating the
possibility of a "parser stack overflow" error as long as heap memory is
available.

FossilOrigin-Name: d87a2054774aa6ce54d9ccd78899b638f1eaf4f9a1d847bf22500018049c9f8d
2024-01-27 11:35:35 +00:00
drh
7659ce22c5 Optimizations to ParseFinalize() to make up for the extra cleanup associated
with the allocated parser stack.  This branch now runs faster than trunk
and is less than 300 bytes larger.

FossilOrigin-Name: f7290db63cc2568090c14dffc4ea4eadfacb5b94b50a1852ef6eefd9e2e32533
2024-01-27 02:21:25 +00:00
drh
3467698000 Omit the "parser stack overflow" error message, since it no longer occurs.
Replace it with an ordinary "out of memory".

FossilOrigin-Name: 33f17ec24880937892d47a5a321c43785ca18e03dde28a9a0d50ae86edb29679
2024-01-27 01:35:07 +00:00
drh
51f652de10 Bug fixes in the function that expands the parser stack.
FossilOrigin-Name: e91179fe849760771c3508b1e7d75325183e5c3b029752d0a97dbdbd57188b97
2024-01-26 20:57:19 +00:00
drh
82bf13796a Experimental changes that prevent parser stack overflows by growing the
parser stack with heap memory when it reaches its limit.

FossilOrigin-Name: 3fd062905fc20507b7cfc97fa976ac5b57c5b68926bf9136bd5ea4265d2d6528
2024-01-26 20:34:48 +00:00
drh
539085ddf5 Add NEVER() to a branch that is no longer reachable.
FossilOrigin-Name: 9411337a7b3237366768fc708396da53d67a7a17b6cdc5c6f8932c5ab32217a9
2024-01-24 21:08:57 +00:00
stephan
4821b15dca Update ext/wasm/SQLTester for recent internal-API reorgs.
FossilOrigin-Name: 996cfdf9b5f70408faeaa68ba2ea9494e419be8f2c59d89ab702419056e3569c
2024-01-24 19:54:49 +00:00