Commit Graph

26055 Commits

Author SHA1 Message Date
drh
731a1aaeb2 Fix an obscure issue with ALTER TABLE RENAME that comes up with triggers
that have UPDATE statements that contain errors.
[forum:/forumpost/ff3840145a|Forum post ff3840145a].

FossilOrigin-Name: c4845a7c5f7f219848d3ee32eef0f9c69ad6dc6e8509da84d612f41e1e05f007
2023-04-13 18:44:59 +00:00
dan
8efa288f99 Add extra test cases to window1.test.
FossilOrigin-Name: ebc844fbfb046c5789efe21fd607c9301cb7b3d78edef72b2926b8c889b048a9
2023-04-13 14:53:19 +00:00
drh
017bdf7838 Fix a code-generator issue associated with very unusual use of window
functions.  Both the expr.c or the window.c changes will each
independently fix the problem.  They are both included in this patch for
defense in depth.  [forum:/forumpost/0d48347967|Forum post 0d48347967].

FossilOrigin-Name: 1ba22631a7831e3562eda0eb6a5edf7f009c85c7ab4451d9eacd13ef0fb6036a
2023-04-13 14:50:50 +00:00
larrybr
4e87950b48 Get CLI utf8_fgets() to not consume more input than it returns. Get console setup restoration to happen for all non-crash exits.
FossilOrigin-Name: b4fa233d3dda54fa83771844cf5156bf1275c687925340af17a7713a9400dfef
2023-04-13 14:14:27 +00:00
drh
3f4a319934 Unwrap the loop in the WAL hash function.
FossilOrigin-Name: eb94ae13206762a42ddad12e0d1461df83e9759e44a369f188cd3aad82f211c4
2023-04-12 20:23:03 +00:00
drh
be0023faba Automatically set HAVE_PREAD and HAVE_PWRITE on linux, as has been done in
MacOS for a long time now.

FossilOrigin-Name: 2f7a36d2c374100019bd9d38aea51ea10cfcf9b1f0330ba084a75f0773df8ebf
2023-04-12 19:40:00 +00:00
drh
6b507423a0 Small performance enhancement to integer-to-text conversion.
FossilOrigin-Name: cfb3dba9b015ce7a75857978bfd2540b4d5be985d9d2ec4a5842b3089ed3da60
2023-04-12 18:57:50 +00:00
dan
7877dca93f Avoid leaking a database handle in test script rbuexlock.test.
FossilOrigin-Name: 2edf98d128cabc0c9de1295470d7f87eb64e4cc1f13344fe3c198fcf9c7bf019
2023-04-12 18:18:28 +00:00
dan
02877e9558 Remove temporary debugging code accidentally left on this branch.
FossilOrigin-Name: 0a0f64870feaf95d2673efc8884ad1236d9bbf9bdb94364f8d2602221bd36ff3
2023-04-12 18:06:43 +00:00
larrybr
ad5a7da489 WIP: CLI option to take control of console on Windows and make it support UTF-8 input pasting (or typing). Needs work to become robust per "ToDo:".
FossilOrigin-Name: 824382393d92d9eb6df8701de7c263280150569a708759c4a539acc6d8d38821
2023-04-12 17:54:52 +00:00
dan
015020cd1a Add the 'secure-delete' option to fts5. Used to configure fts5 to aggressively remove old full-text-index entries belonging to deleted or updated rows.
FossilOrigin-Name: 4240fd09b717dbc69dffe3b88ec9149777ca4c3efa12f282af65be3af6fa5bb0
2023-04-12 17:40:44 +00:00
drh
67f3765876 New #ifdef to enable building with -DSQLITE_OMIT_WINDOWFUNC.
FossilOrigin-Name: e1ff83fa2565334b28bd0d6582088c4ae0d2d9a590d973615a4a598683fe419c
2023-04-11 19:38:47 +00:00
drh
82aacda7eb Remove an ALWAYS() that can sometimes be false. Add a test case that makes
the test false.

FossilOrigin-Name: c8fb143d64d8e823684cd26799080da4b42bef121ca3c6315b1803a593490926
2023-04-11 15:06:20 +00:00
drh
e4d8e7e5df Better handling of OOM errors in the cursor-hint logic.
dbsqlfuzz 60cd5fff91974af91c2c3692beb4a2d7fdafef46

FossilOrigin-Name: 68fcfb58df837b40e401dfa4e505f4f0b87554b9cfeb2c527f3558348b73c1be
2023-04-11 02:10:34 +00:00
larrybr
69881887b8 For sha3 extension, mention NIST standard implemented.
FossilOrigin-Name: 529ab138a438379f0cbd170bff5211aee1c327a1b3119a714ee15f68fd2239f3
2023-04-10 23:21:19 +00:00
drh
ed36917835 New assert() statements to validate the parameters to
sqlite3BtreeCursorHint().  Fix a problem with the construction of those
parameters discovered by
[forum:/forumpost/0b53708c95|forum post 0b53708c95].

FossilOrigin-Name: 4c5a3c5fb351cc1c2ce16c33314ce19c53531f09263f87456283d9d756002f9d
2023-04-10 18:44:00 +00:00
drh
8346f8dacc Sync the vt02.c test virtual table with TH3, in order to pull in the fix
for long delays when there are huge OFFSET values.

FossilOrigin-Name: 49ba030080dd00b4fdf788fd3da057b333e705fa0fe37d653e2461bf96ca3785
2023-04-10 13:20:51 +00:00
drh
d27c18818c Fix an assertion fault that can occur when compiling with both
SQLITE_ENABLE_UNKNOWN_SQL_FUNCTIONS and SQLITE_ENABLE_STAT4.

FossilOrigin-Name: 9ff69e599817610d14948a3eebcc4d3c18245f78a1433c23ae659211cbbdb017
2023-04-09 20:44:09 +00:00
drh
d4fe3c77e6 Fix a faulty assert() in whereRangeScanEst() that should only apply if there
are not prior errors.
dbsqlfuzz 567ad91132879cbab8172b38c6a68ad40fa8d650.

FossilOrigin-Name: 8ba9b08bd976ed2c024f5f378b4dd40a55226e950af77c476c21273fccaf7e26
2023-04-09 10:09:28 +00:00
mistachkin
1a2f490fbc Fix a couple harmless compiler warnings seen with MSVC.
FossilOrigin-Name: 1b864a370fd04bba11487e3dab0388394bc71e1f3f006f7bd9d64eefe04e8b61
2023-04-08 19:27:03 +00:00
drh
df3944ecb8 Fix a typo in [83e84531b46814ae] that changed the value of
SQLITE_DBCONFIG_STMT_SCANSTATUS.

FossilOrigin-Name: b71776539183e5fd8678ce8f3272180d3dbb8214ed7b7bb24d35c0ba027a6ac5
2023-04-08 19:23:13 +00:00
drh
9e0181fcf7 Faster implementation of keywordCode() - the routine that determines if an
identifier is really a keyword and if so, which keyword.

FossilOrigin-Name: 0ff3d3d53709b7f18bf01ded1f988e41b7f8471072cf4f2702a3a8b79964be3f
2023-04-08 16:51:08 +00:00
drh
a9b20c0937 Fix a harmless compiler warning.
FossilOrigin-Name: c9559ba62191fe7fa2a718233afaa841e2594d1fc833314bf5b0a6b775e87c35
2023-04-08 13:31:17 +00:00
drh
2da07d9025 Optimizations to btree.c save about 4.5 million CPU cycles:
(1) Clone insertCell() into a separate insertCellFast() routine for
use by sqlite3BtreeInsert().  (2) Mark allocateSpace() as always-inline.
(3) Improved coalesence of adjacent free blocks in pageFreeArray().

FossilOrigin-Name: 5c12c400fe8eb4e86e14c69a6c34d0d78d9861e5d40a36c6a596a81c6dd65977
2023-04-08 13:01:34 +00:00
drh
65aae44b87 Guard against oversized cells in the newly enhanced pageFreeArray().
FossilOrigin-Name: 2dcdbb50356edbd3a79e53fa0bee4e700c2bdea78e27173b62ddabe44b066726
2023-04-07 18:27:32 +00:00
drh
3da5e2a9f3 Add NEVER on an unreachable branch.
FossilOrigin-Name: 9b3febbd988be05807ada20146d3e196ae17c966722fff049feb32292157bff2
2023-04-07 16:30:33 +00:00
drh
81e31c9c2b Fix an assert().
FossilOrigin-Name: 7eff46ba97dd8a3d6a5d01d5d61e98a2805deceafa47335eded7d784a8304525
2023-04-07 15:49:42 +00:00
drh
706c33d9ba Tweaks to the new insertCellFast().
FossilOrigin-Name: 203a581a9177c1083e8d5b49e8ff026af33b5c5e3e144aeda126f07a3a2953bf
2023-04-07 15:07:58 +00:00
drh
34ceb7e622 Clone insertCell() into insertCellFast() for use by sqlite3BtreeInsert() for
a substantial performance increase.

FossilOrigin-Name: f225afd90c8e65661d8b855050f0ee1a8fe4c0f3bcec824aa5a66d906f3c7119
2023-04-07 14:33:33 +00:00
dan
6d47af64e4 Fix a problem causing the rbu_exclusive_checkpoint=1 to be ignored with zipvfs databases.
FossilOrigin-Name: d8f50b31e8d64fce5141da4a016767a15482703364692a55df346f059fc9d30c
2023-04-07 14:03:30 +00:00
drh
b39f037ca5 Small performance improvement in freeSpace().
FossilOrigin-Name: 8dc5292ee592f16451441e33ad0800ba10a21ecd63f1f9926d6915a59a1552d3
2023-04-07 13:21:20 +00:00
dan
1e24f9f1f3 Add further tests for the rbu_exclusive_lock=1 URI option.
FossilOrigin-Name: c07b62bef96bb69e9b1ce08f0084fdce8de981f4d8ea9689c87a41f1e4451ac7
2023-04-07 11:18:08 +00:00
drh
50dc8d9720 Increase the size of the cache of free blocks inside of pageFreeArray() to
reduce the number of calls to freeSpace().

FossilOrigin-Name: 27c59f1ea789f3ff245f23e79ded5cd71c48e3a51ffbb8c220b51101a4e69fd7
2023-04-06 20:14:10 +00:00
drh
82412051db Work around a harmless assertion fault associated with
sqlite3VdbeMemAboutToChange() such that the detection of stale values
in registers is preserved in debugging builds, but we avoid a false-positive
assertion fault in cases involving a virtual table with a LIMIT clause
in an IN-operator loop.
dbsqlfuzz 3fd70d4ab4950acf1deb8f610a7a7c67cd38713b

FossilOrigin-Name: 56ea2c2fe6108d39833ac40957afab59ade01a216639d5bafdeeca53bbf4cd67
2023-04-06 17:29:38 +00:00
drh
ebec9c475e A prepared statement that aborts due to SQLITE_SCHEMA should not invalidate
cursors in other prepared statements that are already running.
See [forum:/forumpost/cae4367d9b|forum post cae4367d9b] for the original
trouble report.

FossilOrigin-Name: 857d0f5e16ba69ac9e5ee581befca2f7ed933edfe6e36396b10dae7979b44a57
2023-04-06 13:35:42 +00:00
drh
5482afd6cf In the CLI, during error processing while looking for a word boundary,
avoid being deceived by malformed input that has a very long sequence
of 0x80 characters.
[forum:/forumpost/ab93a23ba1|forum post ab93a23ba1].

FossilOrigin-Name: 82609d5a2d4eba741d48ea265f4e749578964961903c072c7b222ffe2aefaa3c
2023-04-06 01:05:52 +00:00
drh
c6349ce205 In the zipfile extension, defend against corrupt ZIP files that contain
a zero-length filename.
[forum:/forumpost/b15f5e3ad8|Forum post b15f5e3ad8].

FossilOrigin-Name: 46db2e42a5f9b18da9661ccedca68cb70257ea5c58b33b401db2a5e030c1346a
2023-04-06 00:59:41 +00:00
drh
1ba1806637 In the new .scanstatus command in the CLI, make sure the database is opened
before invoking sqlite3_db_config().
[forum:/forumpost/6e26dcf544|Forum post 6e26dcf544].

FossilOrigin-Name: 1cd993c45cd6b60e00d1426dd01d63efad13f7258636b5fa694f21499e77955a
2023-04-06 00:18:31 +00:00
drh
072a02ce2c Add a test case for the ALWAYS() macro removed by the previous check-in.
FossilOrigin-Name: 68a1a837493a0bc5e0e0f2373ac76cb575078cec08990c017fdcb51a4ba363a1
2023-04-05 02:55:08 +00:00
drh
9d10ba8b1f Remove an ALWAYS() that might now be false due to the prior check-in.
FossilOrigin-Name: fc68993501aaa7180f5457dcb3c296e5b199904a385d98e2bcad7854e34d428e
2023-04-05 02:50:00 +00:00
drh
8907cb2f88 Fix the function that determines the collating function for an expression
tree to handle new cases that arise as a result of the recently added
ability to use indexed expressions in aggregate queries.
[forum/forumpost/0713a16a44|Forum post 0713a16a44].

FossilOrigin-Name: cc5041f3f067cf610adffb868b4e2d1b5d248dc5a0ecc551339b670800ecb0ff
2023-04-05 02:21:57 +00:00
larrybr
c6c4bae80a Shell to use SQLITE_SHELL_HAVE_RECOVER consistently (correcting check-in 0421cc03e0efa8f1)
FossilOrigin-Name: 5b980d72a03fa1cfd0f1bf3ed04068b9f216b75a304deb2b7bbe8ddce0e6fb96
2023-04-04 19:56:28 +00:00
drh
cd0f540761 Fix an incorrect entry in the array that maps sqlite3_value values into
actual datatype numbers.  dbsqlfuzz f660c659bcec48577a43d3bab37f46baaa22f59e

FossilOrigin-Name: fa8537dc90cad962dec695418d48da2890a172801ecad0c7c804023a063d3a02
2023-04-04 18:55:31 +00:00
drh
c6a54f418c Remove an assert() statement that is no longer valid due to enhancements
to query planner for improved use of indexes.
[forum:/forumpost/dc16ec63d3 |Forum post dc16ec63d3].

FossilOrigin-Name: 2b23dd249d0bc254308f5539936d33ee558f1100dec616caac7317dbe70db761
2023-04-04 18:10:23 +00:00
stephan
20537f0dc7 Expose the new SQLITE_VTAB_USES_ALL_SCHEMAS to JS.
FossilOrigin-Name: b7ef09be667dd349e195842304c03cbebb1693164e1c3587a5d7c96baa713edf
2023-04-04 17:35:38 +00:00
larrybr
0d3651bd85 Omit shell call to sqlite3_dbdata_init() when it is omitted.
FossilOrigin-Name: 0421cc03e0efa8f1a83e46e91f26837366c10eef0903d099e25eb0cc99c297df
2023-04-04 08:49:22 +00:00
drh
39b07f1afc When translating arguments of aggregate functions into references to
expression indexes, make sure to only translate them for the current
aggregate when there are nested aggregates.
[forum/forumpost/409ebc7368|Forum post 409ebc7368].

FossilOrigin-Name: 898bfa1afd8260eaaf2aa6db94e74d99ebf4e8a6dc02cf21d20cd981393609a5
2023-04-03 23:49:00 +00:00
drh
f61bf3dbe8 Improved diagnostic output from PRAGMA vdbe_addoptrace.
FossilOrigin-Name: 050958c1828f7446e7ee7e458123a23b735e213b76a67c3dd8356da256cbc170
2023-04-03 20:11:06 +00:00
drh
555970bf83 When changing a COLLATE expression node into TK_AGG_COLUMN because the nodes
value is contained in an indexed expression, be sure to clear the
EP_Collate property from the expression node.  Fix for the assertion faults
reported by [forum:/forumpost/e45108732c|forum post e45108732c] and
[forum:/forumpost/44270909bb|forum post 44270909bb].

FossilOrigin-Name: cf6454ce26983b9c3ae924c44a802f3f760eaaae9547b40aee9e14e7b0c47cab
2023-04-03 17:46:14 +00:00
drh
0669d6ebbf Add the SQLITE_VTAB_USES_ALL_SCHEMAS option to sqlite3_vtab_config(). Update
the sqlite_dbpage, sqlite_dbdata, and sqlite_dbptr virtual tables to make
use of that interface.  This was formerly handled by the internal
sqlite3VtabUsesAllSchemas() routine that was called directly from sqlite_dbpage.
But since sqlite_dbdata and sqlite_dbptr are an extension, an external
interface to that functionality had to be provided.
dbsqlfuzz 1a29c245175a63393b6a78c5b8cab5199939d6a8

FossilOrigin-Name: bcd51abee0b0f82bb5dbb881025a92d55baf9df6adeaf3a305e2e0da96a81d58
2023-04-03 15:01:37 +00:00
drh
5517538a9c Make the sqlite_dbdata and sqlite3_dbptr virtual tables accessible to
the CLI.

FossilOrigin-Name: c0eff02854d469bcdb949c09531760d6f96b49c17375abd1c131d41f38b9b2f0
2023-04-03 12:48:51 +00:00
drh
d8c34e3311 Stronger constraint checking in allocateSpace().
dbsqlfuzz 93d4c9ff5ef7cd29f16e767af1ee71c29ec5a4c0

FossilOrigin-Name: 9e968f4fbce061190f10f31ce9d3eb4fce6706ea6b7e5011bfa1e893d37ca68d
2023-04-03 12:33:12 +00:00
drh
6455a7066e With the -DSQLITE_ENABLE_JSON_NAN_INF compile-time option, non-standard
JSON numeric values "Inf", "Infinity", "-Inf", "-Infinity", "NaN", "QNaN",
and "SNaN" are all accepted.  SQLite should never generate these values,
but it will accept that with the appropriate compile-time option.

FossilOrigin-Name: 0a050e9013331595e13ca9f859180057b59291c70a6cedb6230eefb25956df9e
2023-04-02 20:56:29 +00:00
drh
c406ecc662 More off-by-one errors in the new JSON parsing.
FossilOrigin-Name: dbc99662087b63c9ed5b398535a6091fc2c5e507907dd1fcb7ad0b6ab3f17144
2023-04-02 20:46:24 +00:00
drh
26cc3a1387 Fix an off-by-one error in the recognition of -Infinity.
FossilOrigin-Name: f7ebf3e6286ddc8cdaa9446235407785d1be2be2d9992e21ef59fcd655f68432
2023-04-02 20:27:02 +00:00
drh
af33654533 Earlier detection of corruption in sqlite3BtreeDelete().
dbsqlfuzz a4c48c291d6e40157a1b749a05eaa7c7faf5a625.

FossilOrigin-Name: 978dc71c388b37740da38c310674315c7d7fe814d1daa16a146b4df71385d1e1
2023-04-02 16:43:20 +00:00
larrybr
756c6cf281 Clear executable bit on base64.c
FossilOrigin-Name: ec1ddbce7db270afc25f71546fa745935ad74bc72920fccfcb37e98649612bf2
2023-04-02 14:53:59 +00:00
drh
8d1005a593 Allow special floating-point value names in JSON: "inf", "-inf", "infinity",
"-infinity", "nan", "qnan", and "snan".  All are converted into valid JSON
values: 9e999, -9e999, or null.  Requires the SQLITE_ENABLE_JSON_NAN_INF
compile-time option to operate.

FossilOrigin-Name: fc8793e5acac7351749e360c6bace5d5a8b3de3aa600ae23e260557db650c461
2023-04-01 23:29:59 +00:00
larrybr
4d5a5a48c5 Swat grammar nit on README.md
FossilOrigin-Name: 715c00e58b774d6a29e2f60fd33a2ecb960307192ae1fdb8ed396f74fd62b444
2023-04-01 16:14:50 +00:00
drh
54b81e36ff Fix harmless compiler warnings.
FossilOrigin-Name: a4fb2864fe01cce9694242a0750623ca47fcecd68f74c4239d3eb5fbf978770a
2023-04-01 15:51:21 +00:00
drh
e5ea81ae85 Improved error messages from PRAGMA integrity_check. Identify the root of
the tree when a problem is found in a b-tree, making it easier to track the
problem to a specific table or index.

FossilOrigin-Name: a1cb152e69c7c6cdd99300c91a8104716089de459d9d19e33ef38432aad70908
2023-04-01 13:14:53 +00:00
drh
2e89f1cdeb In the b-tree module use %u instead of %d to print unsigned quantities such
as page numbers and offsets.

FossilOrigin-Name: 33ac62d8eec56eb71f20ccd28a5d6e4e8051522feb2db0199abee9e18ce1f64e
2023-04-01 12:22:57 +00:00
drh
1839b7990d Omit the the count-of-view optimization if there is a HAVING clause.
dbsqlfuzz 6a107e3055bd22afab31cfddabc2d9d54fcbaf69

FossilOrigin-Name: babe2b5e59647ac9db4601e67c25190aac14eb76d5fcb9fa5b3692b955fefd61
2023-03-31 23:48:59 +00:00
drh
567b069e42 Earlier error detection for index expression usage by aggregate functions.
dbsqlfuzz 29214ace4e25c98d2ddff8fbcf97afdda23f28b9

FossilOrigin-Name: 8e841e7f025f7205959453875f2d9db36271642045593970a2b2fc20b2f847c3
2023-03-30 19:05:48 +00:00
drh
09db37c022 Omit a branch that is no longer needed following [c9c4f287652933eb].
FossilOrigin-Name: 960a488a2db92f5437bc8171cdbed44618d9381c57fd41b2f0e357b6012c80b5
2023-03-30 16:08:54 +00:00
dan
53ed383075 Fix an error in new test script test/aggfault.test.
FossilOrigin-Name: 8724fe7426da55d19dba7b30e09321ba30c73286513864cb05de32f72e50ee31
2023-03-30 12:19:38 +00:00
dan
8fe84a40c7 Fix a crash that could follow an OOM error while processing aggregate functions.
FossilOrigin-Name: 804435a2731bd3c26278c47098854b9ee7727a686587f6208e793738fbfc0555
2023-03-30 11:05:36 +00:00
dan
e1afa2bd24 Avoid having OP_SeekScan jump over an OP_IdxGT or OP_IdxGE that follows the OP_SeekGE opcode. Fix for [b50528af4468237c].
FossilOrigin-Name: c9c4f287652933eb6262a3419efe7e7288f55d3db7e2ac032eeae025f665d306
2023-03-29 21:58:06 +00:00
dan
7b56e97866 Fix a problem with sqlite3_stmt_scanstatus() from within an SQLITE_TRACE_STMT callback made from within a trigger.
FossilOrigin-Name: 1fa78fafa1340de458546526b03cf8b3e9c823913c4225d7c747ad182df5c0fc
2023-03-29 18:54:01 +00:00
drh
0dc43fd4c8 Another #ifdef to omit code that is only used by STAT4.
FossilOrigin-Name: 445c75567de9bf9c8075dfc62c60dc4abeefab59c7803a5ef2cc5d69c08d7633
2023-03-29 15:16:29 +00:00
drh
a9fd5f224c New #ifdefs to omit code that is unused except under STAT4.
FossilOrigin-Name: 09a9b30ba7828a487a33a3ebf8028dfaa147dff67d2724584123b90a88d9814b
2023-03-29 14:42:11 +00:00
drh
df542e0500 Enhance PRAGMA integrity_check so that it can detect that a NOT NULL column
contains a NaN value and report that as an error.
dbsqlfuzz f144b642fe6f1a1c196f258ac6e60118a0cb59b2.

FossilOrigin-Name: 7638d9755dc90fd353b874d03ed418fa8aaee4440290ff69b1b552eae84e5baa
2023-03-29 11:36:24 +00:00
drh
e1be2b7ad9 Fix a weird corner case in aggregate function processing that results from the
recent addition of support for index expressions on aggregate queries.
[forum:/forumpost/bad532820c|Forum post bad532820c].

FossilOrigin-Name: c34fd9fe1b76e0a5943f014f46141cbe55d41bb1e6980adf9bcb6785a03e7883
2023-03-28 16:02:28 +00:00
drh
3cbf38c783 Fix multiple problems with RETURNING on a DML statement against a view,
all inspired by [forum:/forumpost/dc3b92cfa0|forum post dc3b92cfa0].
(1) Do not allow a RETURNING clause to trick the code generator into thinking
that the view being updated has an INSTEAD OF trigger.
(2) Generate all result columns for a view in a DML statement.
(3) The automatic covering index for a view should cover all result columns
of the view.

FossilOrigin-Name: c8bedef0d61731c29ae34de1594222d15b578f9e2cddbbd5b74fb3059644fe0f
2023-03-28 11:18:04 +00:00
stephan
fc6c3936aa Remove a meaningless JS test. Add a timer to the OPFS async-side worker loader in an attempt to catch a browser-specific quirk in which the worker loading silently fails, per discussion in/around [forum post a708c98dcb3ef|forum:a708c98dcb3ef].
FossilOrigin-Name: 4fc1904b8e18c7d41fa65490ced125f1df4f0c22c13de957b24615ed09b3ecb7
2023-03-27 13:57:08 +00:00
drh
3594b2b303 Do not allow constant factoring during PRAGMA integrity_check, since the
constants might be stored in registers that are later reused for other
purposes.  dbsqlfuzz dc9ab26037cf5ef797d28cd1ae0855ade584216d.  Problem
discovered by a new assert() statement added in [6f8b97f31a4c8552].

FossilOrigin-Name: 0bba27b78112b2b2271e498f41c437df985aa2faab302ee5b29d9b60003a8379
2023-03-27 13:24:02 +00:00
drh
aa9192e6aa Improvements to register allocation, especially in the ANALYZE command.
New assert() statements added to help verify that memory allocation is
correct, and to help fuzzer find lingering errors.

FossilOrigin-Name: 6f8b97f31a4c8552312b4c98432ea356ae54c06d9cc929969f50c3c88360cd7b
2023-03-26 16:36:27 +00:00
drh
418f947b98 Disable factoring of constant values during ANALYZE. This is a temporary
fix for [forum:/forumpost/07de5f6216|forum post 07de5f6216].  The register
allocation logic in ANALYZE needs to be completely refactored, but that will
take longer.  This check-in will serve to resolve the issue until a better
fix can be devised.

FossilOrigin-Name: c3967d1259f1df969d303394986960bd098e174dcd337e374c9c3c39e0efa466
2023-03-26 11:54:51 +00:00
drh
b900f9e6e8 When the left table of a RIGHT JOIN is used inside an aggregate function and the left table employs an index on expressions, then make sure the expressions evaluate to NULL for the cases where the left table should be NULL. Fix for
[forum:/forumpost/9b491e1deb|forum post 9b491e1deb].

FossilOrigin-Name: ffe23af73fcb324df988a00be343654ce7078b7208647c4eb779d666b8297e7c
2023-03-25 23:52:05 +00:00
drh
debc3202c6 Add usage detection to the NULL value generator for the left table of a
RIGHT JOIN inside of an aggregate.

FossilOrigin-Name: 4d05a009dfb63bcb4173da4d09ccc00c308ce4dd2534a32aeb23c5d8d6a1fd4b
2023-03-25 23:40:21 +00:00
drh
7bb842642c When reading sqlite_stat4 data during query planning, be sure to expand
zeroblobs prior to running comparisons.  Fix for the issue identified
by [forum:/forumpost/5275207102|forum post 5275207102].

FossilOrigin-Name: 5c8dd8dfcaab9c364b3a126ca35880ef57f5cecbe030771e646c934c8cf43709
2023-03-25 22:37:23 +00:00
drh
de0416171b When the left table of a RIGHT JOIN is used inside an aggregate function
and the left table employs an index on expressions, then make sure the
expressions evaluate to NULL for the cases where the left table should be
NULL.  Proposed fix for [forum:/forumpost/9b491e1deb|forum post 9b491e1deb].
More testing an analysis needed - there is a FIXME in this check-in.

FossilOrigin-Name: 3572b40a7dfc4acc35e72e08e79f64688f8737e57ac89e4d10e6b32bd5178c63
2023-03-25 21:01:11 +00:00
drh
28ae195658 In the byte-code, when the result of an expression needs to be in a particular
register, always use the sqlite3ExprCode() routine because it has the smarts
to know whether to use OP_Copy or OP_SCopy.  Do not try to OP_SCopy inline
because an OP_Copy might be required.  Fix for the problem identified by
[forum:/forumpost/5522082cfc|forum post 5522082cfc].

FossilOrigin-Name: c104e5c6eeb89575319d9f94f49446142b06912fa8b283c19d46aa2ccddc5bda
2023-03-25 19:44:25 +00:00
drh
52786ec185 Add the tag-20230325-1 comment that was omitted from the prior check-in.
FossilOrigin-Name: a13c01d076d23f0de500e8e6283e803dfc96f0da7509c0d97d598d6b3e7b930b
2023-03-25 18:41:42 +00:00
drh
4924e82863 The fix at [2bf5413dc2c19d5f] was incomplete in that it failed to clear
the reusable register cache that might contain registers in the STAT4
buffer region.  This additional change corrects the problem.
[forum:/forumpost/83cb4a95a0|Forum post 83cb4a95a0].  Test case in TH3.

FossilOrigin-Name: 5d554e4d0f59a4309fed40e4fb26c7be42f1d4d55ccdcaaf7b4d445aa3122955
2023-03-25 18:31:24 +00:00
drh
e5895333dd Even tighter bounds on the maximum length of the filename for
sqlite3_load_extension().

FossilOrigin-Name: 787291414d2d2082a3c63e7cdd6bec4719f0c8b75ad1355f5026932ecbb28ba8
2023-03-25 12:27:36 +00:00
drh
12b954db7a Tighter constraints on the maximum length of the filename handed over
to sqlite3_load_extension(), due to
[forum:/forumpost/a43074729e|forum post a43074729e].  This is a
follow-on to [01f3877c7172d522] and
[forum:/forumpost/08a0d6d9bf|forum post 08a0d6d9bf].

FossilOrigin-Name: 9f351bdee2a09a4419bb8256a13d1f757b3e00ec26a445523f224fc56d9ae26d
2023-03-25 03:17:08 +00:00
drh
2c16ec829b New test case to further validate the fix at [221fdcec964f8317].
[forum:/forumpost/d34ad68c36|Forum post d34ad68c36].

FossilOrigin-Name: a6e218a6e1ddd74be6a313b1d336334071747efd4ecd354ed7efe303d09c849c
2023-03-25 02:07:20 +00:00
larrybr
86b67f09e7 Fix CLI non-handling of OOM reported at [forum:/forumpost/6872514e04|Forum post 6872514e04].
FossilOrigin-Name: 6f6a0fd63b13cb827d6a402de01a701eb5b3f92954032ea80e78ec864861a26c
2023-03-25 01:29:40 +00:00
drh
62e43b25dd Remove undocumented, vestigial SQL functions in the CLI that were once used
for the ".recover" command but are now no longer needed.

FossilOrigin-Name: 1ef461aa4e95d254c2c1edebbbfd92ca96d752e04f68ebe70104e8d936d36be9
2023-03-24 22:17:59 +00:00
drh
338ff1ceca Fix possible integer overflow in bounds checking for the debugging function
"shell_int32()" found in the CLI.  This change does not affect the core
SQLite.  [forum:/forumpost/be9c294ee0|Forum post be9c294ee0].

FossilOrigin-Name: 6211471138a654641a4cf4831cfa3b470e06f29a2b77e4d58177c8e065bec11e
2023-03-24 21:35:48 +00:00
drh
ed8e12e97b Fix an error in the OP_SeekScan opcode added by check-in [4a43430fd23f8835].
Problem reported by [forum:/forumpost/8cc1dc0fe9|forum post 8cc1dc0fe9].

FossilOrigin-Name: 651a13fcd16f03e89eb6228c9f3250e25910b9bbe2637f627f65ff78f8ba2059
2023-03-24 21:24:52 +00:00
drh
b3ad5444d0 Fix the handling of indexed expressions in an outer query that appear as
corelated values inside an aggregate function within a subquery.
[forum:/forumpost/79cf371080|Forum post 79cf371080].

FossilOrigin-Name: d8259877eaa962e6f90675790d3770ef02bd1a5d86d319cd8c1834710df844c4
2023-03-24 20:35:56 +00:00
drh
d23924d1ea Fix a problem in cursor-hints for WITHOUT ROWID tables used in a RIGHT JOIN.
[forum:/forumpost/591006b1cc|Forum post 591006b1cc].

FossilOrigin-Name: 221fdcec964f8317b2c23e926cc23799615cd3b4239a8a9ff87a83588d05bc64
2023-03-24 19:17:25 +00:00
stephan
4a1c8ed725 Add a JS test which checks for the issue described in [forum post 895425b49a|forum:895425b49a].
FossilOrigin-Name: 98d30400e4721b1d48ff601698ced146052654f8c6de7c014d4d239bb2dbef43
2023-03-24 17:15:15 +00:00
drh
28fe02cd51 Fix byte-code register allocation in ANALYZE for STAT4 when there multiple
indexes with differing numbers of columns.
[forum:/forumpost/bc39e531e5|forum post bc39e531e5].

FossilOrigin-Name: 2bf5413dc2c19d5feb32e5b01aa9b990ec2f74f45f5ca0dca15215f8c9dbc9b9
2023-03-24 16:57:21 +00:00
drh
c03dbc5a24 The attempt to bring STAT4 up to 100% MC/DC at [55a26c67ed4a3a93] and
at [168fa2fb22b8c1ad] are incorrect.  Back them out and replace them with
a simple NEVER() macro.  Error reported by
[forum:/forumpost/dc4854437b|forum post dc4854437b].

FossilOrigin-Name: 5992370a89f8de7a6e941130b381f85d369856dbdb7860405e6fb17dad2293df
2023-03-23 10:54:07 +00:00
stephan
2255d89f0a Internal cleanups in JS code. No functional changes.
FossilOrigin-Name: 8fbdf7d10400c4f54fc3d8bc823f97818de860deeeed35ab6ad717260cd301e0
2023-03-22 19:57:19 +00:00
drh
ad99243846 The floating-point-to-text conversion with the zero-padding option now
renders NaN as "null".

FossilOrigin-Name: ad59fa17663bda54ec5d4e48ac24e04b87daa70c795d840cd8db382e2dd581b9
2023-03-22 16:55:35 +00:00
drh
5e04d26a3d For consistency, the ".mode json" output from the CLI now renders infinity
in the same format as the JSON functions.

FossilOrigin-Name: abee339d5eae8b63d9579b7ec3a25f18071e675223e0bb5294c733fb618a3a26
2023-03-22 16:37:17 +00:00
drh
c408c155d7 The double-to-text conversion renders infinity as 9e999, so that JSON
output is compliant and so that values can be round-tripped.

FossilOrigin-Name: b52081d0acd07dc5bdb4951a3e8419866131965260c1e3a4c9b6e673bfe3dfea
2023-03-22 16:24:17 +00:00
drh
8854f30295 In the CLI, the magic parameter :inf and :nan bind floating point values
Infinity and NaN, respectively, as an add to testing SQLite's handling of
those quantities.

FossilOrigin-Name: c70a61d8fbfb722679398c211aa48ccd84a392a6b59ba70551fe3a9fbab9a6d5
2023-03-22 16:01:06 +00:00
drh
00cd655c8f Update the version number for the TEA tarball to 3.42.0, to match the core.
FossilOrigin-Name: 03e6918e7f749c3ca1fa66df28b203ff26680f129003e20c71ca246cf7ff34fe
2023-03-22 14:51:22 +00:00
drh
68e976bcc2 Add ALWAYS() on a branch this is always true now due to [84417bbd144b2197].
FossilOrigin-Name: badf7d0e3cfa6efaff4b132cb4ecca79a16e73197c5e275db14ccb5ff938276d
2023-03-21 14:20:10 +00:00
drh
4e45e01693 Add the fuzzcheck-asan.exe target to the MSVC makefile.
FossilOrigin-Name: 0901bc02783527090bdaa626d946ee1e92c7c6848f3c77a799e6837f4e7f8d7b
2023-03-21 12:29:50 +00:00
drh
2439fc1f6d Add the fuzzcheck-asan target to the main posix makefile.
FossilOrigin-Name: 55e94adddba77c1d6ee6ef0c0cf37f7cdccc3bdc144ceaed675d79cdb25f48a6
2023-03-21 11:56:04 +00:00
dan
29fbee66c9 Fix a valgrind error and potential buffer overread when handling a corrupt database.
FossilOrigin-Name: b1e0cd6444d1f710e58129723b285cf1321679fa920fc2841492dcb489ab8b9d
2023-03-21 11:13:53 +00:00
drh
1eca5b5a40 Minor change to btreeNext() to facilitate coverage testing.
FossilOrigin-Name: 20b3ef04d8c79e281e32676d57c7a8569fac9e782ca24337691d44d383eff7bb
2023-03-20 18:35:48 +00:00
dan
bb130c9223 Fix a problem causing a cursor to retain an out-of-date cell-info cache when processing a DISTINCT query on values that are identical according to their collation sequence, but different on disk. [forum:/forumpost/e132e6cde44fb505|Forum post e123e6cde4].
FossilOrigin-Name: 1b3abc1daeac29714256b5a1d5a07a75dc986f1089054a8bee44a00583b7383a
2023-03-20 14:59:19 +00:00
drh
f3ddaaa89a Back out the extra margin added to the input buffer of the CLI, as it is not
needed.

FossilOrigin-Name: ac8d1e5de5da35fa93c3f9241a7817285920431c66f4e4593d4d5c2db9f2b960
2023-03-20 10:43:52 +00:00
drh
6263cefcf5 A better fix for the sqlite3_error_offset() problem on generated columns.
FossilOrigin-Name: 770b3e67c89ca16b08a9234acb626917a26ea414b3bc0340f9601644cb7504f2
2023-03-20 01:55:39 +00:00
drh
715963f1ba Expression errors in generated columns should not generate non-negative
sqlite3_error_offset() returns.  Second of two defenses against
[33aa4c0de8a62e33].

FossilOrigin-Name: 2adb4e0dda471ffc9b2a5cbad01b6c2bc6091b7526a8c8b19944cb2d4a5111e7
2023-03-20 00:53:56 +00:00
drh
0d53e8ed54 When reporting errors in the CLI, ignore the output of sqlite3_error_offset()
if the value returned is clearly out-of-range.  One of two lines of defense
against [33aa4c0de8a62e33].

FossilOrigin-Name: 26adbb80f51b9219ab2a3593496458b74a567ba5ee46b5154f056e389cfc09f7
2023-03-20 00:48:40 +00:00
drh
2ff6569940 Increase the size of ref-count values in the pager layer to 64-bits, to avoid
any reasonable possiblity of overflowing the counters.
There is a performance and memory penality for this.
[forum:/forumpost/b741f15a35|Forum post b741f15a35].

FossilOrigin-Name: 6c5d99a813e8498c2ea91383ac8886a43eaf47023919c03900e893640c03778d
2023-03-19 21:48:55 +00:00
dan
9b532d1e1b Avoid a buffer overread in fts3 that could occur when processing a corrupt record.
FossilOrigin-Name: 02ac2297abee6af64c8df230b42b07f21cff4565d7e315860b2396a7c0c556ca
2023-03-18 16:12:27 +00:00
drh
667b5cc985 Fix json rendering so that it shows positive and negative infinity as
9.0e+999 and -9.0e+999 respectively.

FossilOrigin-Name: efce4690a52592c4f5fc7d023eebe771b0e615bb03c0fe203493f853b28e8f85
2023-03-17 20:31:24 +00:00
drh
f204be8098 Add the ability to name functions using one of the join keywords like
CROSS FULL INNER LEFT NATURAL OUTER RIGHT.

FossilOrigin-Name: 0910b1925e97f7ae4dae86894c9e2f54273c85115e19d0d9bff1280ffee35eed
2023-03-17 19:18:17 +00:00
drh
2eacecfe51 Add test cases for functions named the same as join keywords.
FossilOrigin-Name: 94944b239ce674d984c88ef6029b0260a972f1b25f01614b559ca07c3ebaf8f5
2023-03-17 19:07:48 +00:00
dan
66086eb6a6 Fix a potential buffer overread in the recovery extension.
FossilOrigin-Name: 0b3b5bf9597615589a1d045aaa697c13550553ee4fe4b9008a8e51415b6fe96a
2023-03-17 14:18:39 +00:00
drh
3f22b9ee2c Ensure that an error does not delete the Table object out from under
the xConstruct method of a virtual table.
dbsqlfuzz 7cc8804a1c6d4e3d554d79096e6ea75a7c1c7d2d

FossilOrigin-Name: df4928c92b0db77d0a40d7b492b609db191252e2f87bca63d000e4fe2e206293
2023-03-17 10:43:05 +00:00
drh
14e8299aa0 Add safety margin on the CLI input buffer for tickets
[33aa4c0de8a62e33], [b97e6c5e6a91d97f], [2971fbe3f993e95a], and
[2971fbe3f993e95a].

FossilOrigin-Name: 741af08af1b93406a120580379d13e514524af627da5387ecfa6e442d004bfdd
2023-03-17 00:42:27 +00:00
drh
a84ead119e Fix assert() statements that would (incorrectly) fire if an IF NOT EXISTS
trigger that already exists contained two or more RETURNING clauses.
Tickets [89d259d45b855a0d] and [d15b3a4ea901ef0d].

FossilOrigin-Name: 648899e4ded72cac6cc24bccf7ebfc709ee7309a003452b21fd6ab0ba20c34b8
2023-03-17 00:01:32 +00:00
drh
b816ca9994 Correctly handle SELECT DISTINCT ... ORDER BY when all of the result set terms
are constant and there are more result set terms than ORDER BY terms.
Fix for these tickets: [c36cdb4afd504dc1], [4051a7f931d9ba24],
[d6fd512f50513ab7].

FossilOrigin-Name: 12ad822d9b827777526ca5ed5bf3e678d600294fc9b5c25482dfff2a021328a4
2023-03-16 20:54:29 +00:00
drh
7a9c235aaf Additional debug/test output from the query invariant checker showing the
row-number that is being checked.

FossilOrigin-Name: e4b6eb58e65f7fa0c92768f42bc820614169b7c2f37ded391b866ddb0d894de0
2023-03-16 12:28:48 +00:00
drh
db8c6aa03a Update the tracing output for the query-invariant checker such that it shows
the SQL that is run to verify that a found query-invariant discrepency is
valid.  Changes to testing logic only.

FossilOrigin-Name: 8f45ad27403e971d88ec62e674c03f82eb19df0b43aa58d20b3400cdb6611d90
2023-03-16 11:50:44 +00:00
drh
7d5a549121 Do not use the one-pass optimization on an UPDATE if there is a subquery
in the WHERE clause, since if the subquery is hidden behind a short-circuit
operator, the subquery might not be evaluated until after one or more rows
have been updated.  Fix for the problem reported by
[forum:/forumpost/0007d1fdb1|forum post 0007d1fdb1].  This is the same
problem that was fixed by [73f0036f045bf371] only for UPDATE instead of
DELETE.

FossilOrigin-Name: 2c56b984a0bd3be5ec326a2109ea7b8f1d4ef63c8fc325caac9663cf2479eaff
2023-03-16 10:17:30 +00:00
drh
5531316dd0 Remove a NEVER() from btreeNext() that dbsqlfuzz 460aa158f9a2c41145831cc924296cde1f312b3f
found could sometimes be reached.  I will find a way to test that branch
later.

FossilOrigin-Name: 1dffeffe150fff6777cf26bc960326ca4e4190d25d05bb066b082d1e1c8eb374
2023-03-16 09:07:46 +00:00
drh
ffcad5893a Disallow the one-pass optimization for DELETE if the WHERE clause contains
a subquery.  Fix for the problem reported by
[forum:/forumpost/e61252062c9d286d|forum post e61252062c9d286d].  This fix
is more restrictive than necessary.  It could be relaxed if the subquery does
not involve the table that is the subject of the DELETE.

FossilOrigin-Name: 73f0036f045bf37193b6e87ae45b578c5831614c530488257c69666178da3aa5
2023-03-15 17:58:51 +00:00
dan
eb5d71ed58 Fix a broken assert() in the recovery extension.
FossilOrigin-Name: 4c4e66f293d7768cceb875a936ca0f4cd910473e20b9910698cc1e1ce221a7d4
2023-03-15 13:53:47 +00:00
drh
cdfb518f6f Fix Bloom filters on an expression index.
[forum:/forumpost/2e427099d5|forum post 2e427099d5] and
[forum:/forumpost/d47a0e8e3a|forum post d47a0e8e3a].

FossilOrigin-Name: c028fb669a5ae34dbaf50fffab1ae49bc568b994435cf02e145d24da3cfb48d7
2023-03-14 20:08:39 +00:00
larrybr
bf7602a7d8 Include CLI's tip for -- in all builds. Better show optionality of its non-option arguments.
FossilOrigin-Name: 9e2c771daad485d923751fdee0316b195bb49ec9f865f2e39565906edeaa5cf8
2023-03-13 16:08:44 +00:00
drh
80511f32f7 The check-in at [198b3e33dcfd74c7] caused a performance regression for some
queries, which is here fixed.  Problem reported by
[forum:/forumpost/b405033490fa56d9|forum post b405033490fa56d9].

FossilOrigin-Name: dc9f025dc43cb8008e7d8d644175d8b2d084e602a1513803c40c513d1e99fea4
2023-03-11 23:21:21 +00:00
drh
7802389398 Allow functions named using keywords "CROSS", "FULL", "INNER", "LEFT",
"NATURAL", "OUTER", and "RIGHT".

FossilOrigin-Name: eeac3d5ec93e9cf8613d764b700b6e39a3ffb39b3953ce1e6a2f84dd986f9e86
2023-03-11 12:27:12 +00:00
larrybr
20f2917881 CLI help to reflect no-more-options option
FossilOrigin-Name: 30d95a12eb8b1cfc8ed11d3ed68cd713993ba34efa2fe623c18cfe41f14df1d9
2023-03-11 00:15:41 +00:00
drh
30ebcf2ecb Fix a typo in a comment. No code changes.
FossilOrigin-Name: 76acc075402aac2d14d8279b8095008a842522a0985fdf89200da4339757a40b
2023-03-10 21:27:59 +00:00
larrybr
a9fffc179f Give CLI a no-more-options option. (--)
FossilOrigin-Name: 0822788752621f6bf6af44b420b594ddd352634b3b0ed0eb835abea34b45817a
2023-03-10 20:54:44 +00:00
dan
5f708cc832 Fix a problem with the fts5 snippet() function that shows up when snippets just 1 token in length are requested.
FossilOrigin-Name: 96d5116d17cbf3de6be38952881c6ddf6a226ddfd7649197bdb2df39c42b5d8e
2023-03-10 13:36:19 +00:00
stephan
17bbbde537 Export SQLITE_FCNTL_RESET_CACHE to JS.
FossilOrigin-Name: 6195cfc86b15614b8db0e0dc5cc79b8d1acaf483f0131c8526992dc8ca075630
2023-03-10 11:57:23 +00:00
stephan
434205a2c1 Replace a lingering use of 'self' with 'globalThis' in JS code, for node compatibility.
FossilOrigin-Name: 7e3782b5aa07621db95c2dc25b25ae21da988c9876d537b78ea289a83c75b06b
2023-03-09 22:09:13 +00:00
dan
bad7d5041a Reinstate some test cases accidentally removed by [cb023fe28560ce0f].
FossilOrigin-Name: 870de61f8ef8781f2f9969b012f5c1cb95b6bce1a9a4dcaf02945b7846c3aa83
2023-03-09 16:11:43 +00:00
dan
1211e1d112 Fix countofview.test so that it works with SQLITE_OMIT_PROGRESS_CALLBACK builds.
FossilOrigin-Name: 2fc7c3fcee05c2a251ceb3666f3f6e9014cfe6e2f8570b72c43f251067e6b252
2023-03-09 15:08:06 +00:00
stephan
fcdfd4716e Experimental addition of sqlite3-node.mjs, for node.js, based on feedback from [forum:ac7a94d4f77db235|forum post ac7a94d4f77db235] and related off-list discussions. Build changes only - no code changes.
FossilOrigin-Name: a5db97fa17d15711ab19af70595912d342ffa326a9b7029d4deb2194ae72a9f0
2023-03-09 08:51:04 +00:00
drh
8c26e6fa16 Fix a possible NULL pointer dereference due to the sqlite3_interrupt()
enhancement at [bd8fa10e59f58886].  Reported by
[forum:/forumpost/f5a2b1db87|forum post f5a2b1db87].

FossilOrigin-Name: 84417bbd144b2197c9930a520feb94b59053957c190be79f8deaaaebca68ecf1
2023-03-08 23:05:18 +00:00
drh
07d1ef97a1 Backout the OP_MakeRecord optimization as it does not work.
FossilOrigin-Name: 25017312d0d476d9cd5a39835748ee26c2ea482e163264ce2f9843ac627276d6
2023-03-08 22:48:03 +00:00
stephan
99ace82634 Export the new SQLITE_CHANGESETAPPLY_IGNORENOOP flag to JS.
FossilOrigin-Name: ac7359b2633ead74a53b2796fe038ca285aacad45b45980db2a76a87154e66e3
2023-03-08 18:05:57 +00:00
dan
975f2062da Add the SQLITE_CHANGESETAPPLY_IGNORENOOP flag, which may be passed to sqlite3changeset_apply_v2() to have it ignore changes that would be no-ops if applied to the database (e.g. deleting a row that has already been deleted), instead of considering them conflicts.
FossilOrigin-Name: cb023fe28560ce0f8c2fd48042553fcdb9db81eba9552be75165de0d46a2645c
2023-03-08 18:03:04 +00:00
drh
7ba63831f8 Small performance improvement in the OP_MakeRecord opcode.
FossilOrigin-Name: ca89daef0fcf6cb04aa6fa90dd333d6f2474bf3f458c833d9cd5bd8e59f2a04a
2023-03-08 17:09:32 +00:00
drh
06af03d70a Change to [44135d6ea84f7ba6] that retains the historical datatype ("INT", not "NUM") for a table created as follows: "CREATE TABLE t1 AS SELECT CAST(123 AS INT) AS value;". The use of FLEXNUM only occurs on compound queries.
FossilOrigin-Name: 6d5b5896261c62a7e130b47416ee8c25793859a2afcb1646c257600537a5b71b
2023-03-08 14:28:09 +00:00
stephan
248c1abdf4 Extend wasm build to support a custom sqlite3.c to support building against sqlite3-see.c. The JS code now binds the SEE-specific functions if it detects an SEE build.
FossilOrigin-Name: dd8612c8adbaf9d06bf0d7319b9afc9bd8ca3d0fcfa1cb591a7a2fcb86480048
2023-03-08 10:05:42 +00:00
drh
217e860053 Fix a problem in the count-of-view optimization that can lead to incorrect
bytecode.  dbsqlfuzz 23d782160b71c3f8f535ccb2da313dfc8eb8c631.

FossilOrigin-Name: f45009533a79a59b302598ee2545ef787c51d0128f4e1dca60dd83589f660619
2023-03-08 00:47:53 +00:00
drh
cad225d6fc Fix a bug introduced 4 days ago by [e95439119ac200cb]: do not set the
Expr.affExpr field of a generated column expression if the expression is a
RAISE() function, as affExpr has a different meaning for RAISE.
[forum:/forumpost/b312e075b5|Forum post b312e075b5].

FossilOrigin-Name: 1096b5a7cc8104db01f8820ace47020baad2f12e6711e3a7b4514ed1becc7b66
2023-03-07 23:47:38 +00:00
drh
bacb8aeb35 A proposed change to [44135d6ea84f7ba6] that retains the
historical datatype ("INT", not "NUM") for a table created as follows:
"<tt>CREATE TABLE t1 AS SELECT CAST(123 AS INT) AS value;</tt>".

FossilOrigin-Name: a0e54fe2058a4ac1e794b2491e424c60dfa42c6781b1cfd83c5db65c28c11c71
2023-03-07 19:39:18 +00:00
stephan
416e9c1908 Improve how sqlite3.initWorker1API() determines whether it's running in a Worker thread. Based on feedback in [forum:ac7a94d4f77db235|forum post ac7a94d4f77db235].
FossilOrigin-Name: 2f712b836a0dafd0b2ee6ba4eaa9caa35e49375c7ad0562477e0f2d3b086ec03
2023-03-07 19:23:36 +00:00
stephan
4214cc32ba Replace use of 'self' in JS code with 'globalThis', as that works in browsers and node environments. Avoid using globalThis.location if it's not set (e.g. in node). Based on feedback in [forum:ac7a94d4f77db235|forum post ac7a94d4f77db235]. Minor JS build tweaks.
FossilOrigin-Name: dbbe8f25e58738c10b6192d41f1e3886983871f17631cbc45ce626d3f05a6e26
2023-03-07 19:12:06 +00:00
stephan
7272f6d64d In the JS sqlite3.vfs/vtab utility APIs, use a local reference to StructBinder instead of sqlite3.StructBinder, as that object is removed from the sqlite3 namespace during the final steps of API initialization. Based on feedback from [forum:d19d96183badca70|forum post d19d96183badca70].
FossilOrigin-Name: 0d89885d28b44b1858117a72a180841f4f5f44bcc574fc59a116ca3526325932
2023-03-07 12:59:20 +00:00
mistachkin
c105b3eccf Fix a couple minor spacing issues in the MSVC makefile.
FossilOrigin-Name: 46b3ac6d1fdd9207cdc511d445bb4c33d11102d6e4eb43f119293d62bb7008ff
2023-03-07 02:24:43 +00:00
drh
112eff9b27 Repair an unintential fork.
FossilOrigin-Name: 8b524c849f9844ea624cfe8968225200a57cefa8b7a17ebac2153c0cb3b657d7
2023-03-06 23:39:19 +00:00
drh
5b6ba9b250 Improvements to query invariant testing such that it uses the new
SQLITE_DBCONFIG_REVERSE_SCANORDER opcode to sqlite3_db_config() to make more
accurate judgements about when a query is ambiguous, and hence when query
invariant testing is approprate.

FossilOrigin-Name: be9ab292cd14889b1c9648b47138260b33fe5be282ff2d90653b1387885a7d02
2023-03-06 23:38:44 +00:00
larrybr
51a31a3b9c Cause CLI to fail noisily when deserialize option used for non-seekable "file".
FossilOrigin-Name: 24bd7e82471925987d924188ce0f80ed4f282b10ea1022e42881a7f529814eb9
2023-03-06 21:38:38 +00:00
drh
f30da226e3 Add SQLITE_DBCONFIG_REVERSE_SCANORDER for direct C-language access to the
"PRAGMA reverse_unordered_selects" setting.

FossilOrigin-Name: 83e84531b46814aea6dad1ce8283cb9f6b90ad52badb60b875ea8f66e4ac0925
2023-03-06 19:04:39 +00:00
stephan
eac6e8cb6a Rename sqlite3-worker1-bundler-friendly.js to sqlite3-worker1-bundler-friendly.mjs and refactor it to work as an ES6 module, based on feedback in [forum post a255f89c2eadf4c4|forum:a255f89c2eadf4c4].
FossilOrigin-Name: af312b131457743d98b84137bd51d9ba60e0daf0bd8f5a66f05956ca35ab68fb
2023-03-05 07:44:23 +00:00
stephan
32b3444f15 Correct rendering of error messages in demo-worker1.js. Remove some stray EOL whitespace.
FossilOrigin-Name: 1d5d515ad97cf61bd679f8c1afc607815c079583fe80264b591c6ef18f56fb8b
2023-03-05 07:33:11 +00:00
drh
89b3cbed67 Fix to check-in [b9190d3da70c4171] - the agg-with-indexed-expr optimization
requested by ticket [99378177930f87bd] - that can cause an incorrect answer
if an aggregate subquery has a GROUP BY clause, and that GROUP BY contains a
term that is not in the result set, and the outer query makes use of expression
indexes.  Problem reported by
[forum:/forumpost/a68313d054|forum post a68313d054].

FossilOrigin-Name: e06973876993926fd56181281d04b8dd504c689abf883fa21a5721cc1d478ea8
2023-03-04 15:36:51 +00:00
drh
c8c7243d6e Show the output value from OP_AggFinal when doing byte-code tracing.
FossilOrigin-Name: 35f10a06ba81b8a526249729828fff06214e9cf95de418a9081f19d8d69fd657
2023-03-04 12:57:07 +00:00
dan
3410e550dc Make the SQLITE_DBCONFIG_STMT_SCANSTATUS option on by default.
FossilOrigin-Name: 5a09191186bc03b374e0c0d029e1a15208c6b845bc2f5f5f9f6a8a882809d9f3
2023-03-03 21:17:12 +00:00
drh
fe52615925 Fix a vdbe-coverage macro added by [f418bdd627e84e7d].
FossilOrigin-Name: 77f559d2647615379fed55ced5d69ae90515273e59811b92171bdd3089c90a22
2023-03-03 19:56:19 +00:00
drh
294872382b Follow-up to [e95439119ac200cb] to fix a case where a pointer is NULL due to
OOM.

FossilOrigin-Name: 2535bc8c256a7642a6ac00ebfd3393beb93da94394c13b886c3ddd20d114aa3c
2023-03-03 19:43:39 +00:00
drh
1b9db7f32d Enhance PRAGMA integrity_check so that it can detect when there are extra
bytes at the end of an index record, which might cause OP_IdxRowid to
malfunction.  dbsqlfuzz c1aa3986534d5feab8d21f28b3c1712df2ef358ba.  Test case
in TH3.

FossilOrigin-Name: f418bdd627e84e7d494f730d7124d8f4846ebcde031f5b2498685c9aceebb3c8
2023-03-03 18:35:00 +00:00
dan
0433789863 When it is known when preparing a statement that X cannot be NULL, transform the expression (X IS NULL) to integer value 1 instead of 'true'. This is because under some circumstances, "Y IS TRUE" may not be equivalent to "Y IS 1".
FossilOrigin-Name: cc4bb05b3653e9502b95ea6fe0bfb77feebc11285b66e1dde4c7b945928efbf1
2023-03-03 16:25:18 +00:00
drh
dc81902445 Do not use an expression index on a generated column if generated column
has the wrong affinity.  dbsqlfuzz 65f5eb57f8859344d5f1f33e08c77ee12960ed83

FossilOrigin-Name: e95439119ac200cb47d0e277622f41ee7986b364487cd252b485ce5fa030d70f
2023-03-03 15:12:46 +00:00
dan
0b23765b6f Remove unnecessary call to sqlite3_dbdata_init() from shell.c.in.
FossilOrigin-Name: c4d083a3aeeee69342d41b93a1393855871b0e4e7bfdb5fcc2973138018f248b
2023-03-03 10:42:23 +00:00
drh
3f23ce664e When flattening the right operand of a LEFT JOIN
(check-in [41c27bc0ff1d3135]), ensure that the OP_IfNullRow opcode does not
NULL-out a subquery result that was computed within OP_Once.  This fixes
the problem problem reported by
[forum:/forumpost/402f05296d|forum post 402f05296d].

FossilOrigin-Name: 8fe13f7a5e5eb798189acb25a608df7a94c2f5cc83463331a048b779c7890c82
2023-03-02 13:49:50 +00:00
stephan
c355f6c839 Resolve a parallel build timing issue when building sqlite3.c/h from ext/wasm. For the time being, do not add sqlite3_wasm_extra_init.c to fiddle.wasm because it can cause duplicate definitions of extensions which are already built into the shell (a better resolution for this conflict is pending). No longer add sqlite3_wasm_extra_init.c to speedtest1.wasm because it's useless there.
FossilOrigin-Name: 75fdd5b83b4c527d25649b0d08841e3dc7d4d8109c1c97b2195b303538ced73d
2023-03-02 06:58:55 +00:00
stephan
c3d84b4cbd Rename some vars in the ext/wasm makefiles for consistency's sake.
FossilOrigin-Name: c23589d92cd16b67266d97f4a3d8c0991864dbea30ec074173e1a67466532d21
2023-03-02 05:51:03 +00:00
drh
bf90114867 When flattening a view that is the right operand of a LEFT JOIN, using
the optimization of check-in [41c27bc0ff1d3135], always insert the
TK_IF_NULL_ROW expression nodes, even for TK_COLUMN expressions, as
the TK_COLUMN might be a column from an outer query and hence still need
to be NULLed out. This fixes the problem described by
[forum:/forumpost/26387ea7ef|forum post 26387ea7ef].

FossilOrigin-Name: 198b3e33dcfd74c7ba6abcf789ee81dfed464a50ebf15c8edeff349d36789fca
2023-03-01 20:23:46 +00:00
drh
fe37348255 Follow-up to [bbaf1f2eb1e1637b]: Make sure subtypes do not cross a subquery
boundary even if the function that returned the value with a subtype is
buried down inside a larger expression.  This fixes a problem identified
by [forum:/forumpost/37dd14a538|forum post 37dd14a538].

FossilOrigin-Name: e72661eb680ea707a839cb3d5cf6c7ef03706e7b40af1b84760147e59cd61a50
2023-03-01 15:21:53 +00:00
drh
46960e4677 Do not attempt to apply the count-of-view optimization to a CTE.
dbsqlfuzz ef8623915d843b150c159166ee4548c78cc6895a

FossilOrigin-Name: abc3a383636c0346053b5d09d96585f56c64cacb5751673ea3bf339e4955d1cd
2023-03-01 13:54:07 +00:00
drh
f1f4f090c7 Activate SQLITE_DBCONFIG_STMT_SCANSTATUS in fuzzcheck.
FossilOrigin-Name: 4fe1419ac3161ea8735241b04913593170c636cf3e1583756fe94edd396cd38b
2023-02-28 21:23:46 +00:00
drh
0bdee38969 Updates to speedtest1.c and the speed-check.sh test script so that they work
with the new SQLITE_DBCONFIG_STMT_SCANSTATUS control.

FossilOrigin-Name: bd02df052e1ef78b5335915a38f3c5e13c3c04ab82fd251aeb42a440d1d39257
2023-02-28 20:06:30 +00:00
dan
06382de2a3 Change the name of SQLITE_DBCONFIG_STMT_SCANSTATS to SQLITE_DBCONFIG_STMT_SCANSTATUS.
FossilOrigin-Name: a63e4a150b505fc309fac847131009ee9965eb1b798ebcb202ec8b52f9189240
2023-02-28 20:04:01 +00:00
dan
45163fc45e Add an sqlite3_db_config() option - SQLITE_DBCONFIG_STMT_SCANSTATS - for enabling and disabling the collection of sqlite3_stmt_scanstats() statistics in SQLITE_ENABLE_STMT_SCANSTATUS builds. Collection of statistics is disabled by default.
FossilOrigin-Name: 0f5579bef27b84ee855065cfe87703c51e1f9773906a9e0d4e4dafc90bd0e553
2023-02-28 19:39:59 +00:00
drh
4990fc84f1 Only use a Bloom filter on an automatic index if one or more of the key
columns in the index can take on non-TEXT values.

FossilOrigin-Name: 5916705c731604d2e6b51a307cc8d7b67f4c102062bfdfcbc716a2916e0b0d86
2023-02-28 18:06:52 +00:00
drh
a353369f57 In the Bloom filter optimization, hash all strings and blobs into the same
value, because we do not know if two different strings might compare equal
even if they have different byte sequences, due to collating functions.
Formerly, the hash of a string or blob was just its length.  This could
all be improved.  Fix for the issue reported by
[forum:/forumpost/0846211821|forum post 0846211821].

FossilOrigin-Name: 090304b870419acb5b05205a07fc75830b556928149f76a843cda526f77a6fc0
2023-02-28 14:28:54 +00:00
drh
f43ffb30b0 When an automatic index creates a Bloom filter, show that in the
EXPLAIN QUERY PLAN output.

FossilOrigin-Name: d7b2ac1c1a31fa4285cf6df0995db7e7705bb6a1bc94850c14c94cc4e3eb239a
2023-02-28 13:46:01 +00:00
drh
485a92cbb9 Performance optimization in the varint decoder for the cell parser.
FossilOrigin-Name: b2b91c7cb40f1efe800059614e34823411016a3ece3f988e1574aecadd4c3114
2023-02-28 12:31:40 +00:00
dan
b211a4b391 Improve the error message generated by the recovery extension if it is used with a non-SQLITE_ENABLE_DBPAGE_VTAB build.
FossilOrigin-Name: c1f2a1d55c180fb51a4e203befbbe529bdd23137b26190c50b8f85820450e7fa
2023-02-28 11:02:02 +00:00
drh
ca4cf12d70 Minor performance optimization in the computation of an affinity string
for an index.

FossilOrigin-Name: 07334aa17b6ded27c5bd353998d96645a94cdcf32440abb59d127a002cd98ce9
2023-02-27 18:55:37 +00:00
drh
baef8442d3 Further to [46639f682975dac6], the parameters of a table valued function that
is on the left side of a RIGHT JOIN do not need to be in the ON clause.  Add
new test cases and tags to associated test cases with the code.

FossilOrigin-Name: 18ee689de3d1ae43b05ca52e0b62c49442ebf68a88814a7c679e8856250a4b0d
2023-02-27 14:48:54 +00:00
stephan
ef22012b6e Minor doc tweak for the previous commit.
FossilOrigin-Name: a8832164d36ea88dc1c5c874c67212800238eab6b1477e5ca92fbf8c77f341b4
2023-02-27 07:23:54 +00:00
stephan
9885c76c4c Extend wasm build to enable inclusion of client-custom C code, initialized via the SQLITE_EXTRA_INIT mechanism, per discussion in [forum:1e1c04f3ed1bc96b|forum post 1e1c04f3ed1bc96b].
FossilOrigin-Name: 68a52cafff60f19c9c998133d04f192b1e8b23f78b8cee13807d76845ef5e13d
2023-02-27 07:12:28 +00:00
drh
d7ddec765c When a table-valued function appears as the right table of a RIGHT JOIN,
the argument constraints on the table-valued function should be considered
part of the ON clause of the RIGHT JOIN.  Fix for the problem reported
by [forum:/forumpost/422e635f3beafbf6|forum post 422e635f3beafbf6].  Test
cases in TH3.  Possibly related to the enhancement at [501609eddf2a46d5].

FossilOrigin-Name: 46639f682975dac6efec4e230aca2c9b127b4fc77e0b465fad38ef4caa9b7a4c
2023-02-26 20:57:09 +00:00
drh
4edbcdd391 In the [/info/7c2d3406000dc8ac|omit-unused-subquery-columns optimization], be
sure to remove the EP_Skip and EP_Unlikely flags from the result set expressions
that get nulled-out.  dbsqlfuzz bf1d3ed6e0e0dd8766027797d43db40c776d2b15.

FossilOrigin-Name: 21aec65e5e2a01e58dd0bb8c8b9b29b8414373b53353fc7ca80a152fdd27566b
2023-02-26 11:36:35 +00:00
drh
2d7829057e Split out a new variant of cellSizePtr() that applies only to leaf pages,
for a small performance increase.

FossilOrigin-Name: 22d32eef8741ae4f2aac3869465e5a7d2e33c6bc2425dd8e77f2a746e43687e8
2023-02-25 16:03:28 +00:00
drh
20e09ba6a8 Remove an unnecessary and redundant corruption checks in defragmentPage().
FossilOrigin-Name: 2dc7342e12e9dac2d8345d045a17caa29c26eaf6f417dd052c7c645eddd6c58c
2023-02-25 15:34:09 +00:00
larrybr
4ee8e9681c Revert (mostly) to earlier CLI response to -echo and SQL at the command line.
FossilOrigin-Name: 1c6cfcf6ed5e084e5eb6874a261f3670ab5fb3e5dbcf150f37c58b2f16351ee3
2023-02-25 15:15:40 +00:00
drh
0f8aebbfcf Performance optimization on sqlite3_vsnprintf().
FossilOrigin-Name: 4430e6e96dbf3d0b464776c132838dd3e456716e0ae5972fc7e0ece13b56ea25
2023-02-25 12:50:54 +00:00
drh
96705c1d7a Add the "on" option to the ".log" command in the CLI. Allow ".log on" and
".log off" even in --safe mode.  Enable the .log command for fiddle builds.

FossilOrigin-Name: 6bba9100ae81466eeb49845c449cbfddf4f82f18b89f55e6ef575cbf66af63af
2023-02-24 21:23:53 +00:00
drh
d8f13f48a8 In the CLI, do not emit warnings about the incorrect usage of sqlite3_config()
in Fiddle.

FossilOrigin-Name: 847021b402a3e624e22959a70e3e29a4f069c2005534485779cdc018722b5863
2023-02-24 21:05:12 +00:00
drh
407f06a823 Modify the sqlite3_config() interface so that the SQLITE_CONFIG_LOG and
SQLITE_CONFIG_PCACHE_HDRSZ opcodes can be called after sqlite3_initialize().
Enhancement request [0b75886e6d48f7c2].

FossilOrigin-Name: 7902fb806b33a27932f9ca347246f4ac43091caad0a1536009985b650fd720e2
2023-02-24 16:04:05 +00:00
drh
70e01f6adc Back out the SQLITE_CONFIG_URI option from anytime-config.
FossilOrigin-Name: 0de98b8e21e4cbf2438160651585ea23ebea952c5a4e7d88e5eabe5cc49517b2
2023-02-24 15:59:27 +00:00
drh
acf8905425 Adjust testrunner.tcl to make use of the new number_of_cores TCL command
available in testfixture, and to use no more than half the available cores.

FossilOrigin-Name: e0122d3863ed03e7bb64400d6561cbc824ecb14d228949ffde443069dbb4223a
2023-02-24 13:45:51 +00:00
drh
1fa0f27e81 Add the "number_of_cores" TCL command to the testfixture.
FossilOrigin-Name: 16ee5a7b5d02cad51a35d5675fcc5bb50a62d1f243bde107fc89fed44ffd6a43
2023-02-24 13:25:49 +00:00
drh
764e53d9bf Merge enhancements from trunk into the anytime-config branch.
FossilOrigin-Name: 04b2fdf3bc986cd402e8a6c060e1b3989e60770695e2f8a4bc12c43e380a694c
2023-02-24 12:55:24 +00:00
drh
8ac60da70e Slightly faster and more precise floating-point to decimal conversion.
See [forum:/forumpost/d1387c3979c7f557|forum thread d1387c3979c7f557] for
discussion.

FossilOrigin-Name: 6dea6f4738fc7d003183e94f08bd95181f23e165a966882c0bdc64708a05a607
2023-02-24 11:54:40 +00:00
drh
4b04ced3e0 Fix an incorrect optimization that was attempted as part of
check-in [18de3a8e6b431a07].

FossilOrigin-Name: f32055e8110a2eac6c9e26d1d1e620f0668bcb475d49d309dc549cea05e1e582
2023-02-24 01:08:35 +00:00
drh
ed530c0221 Omit unnecessary branches from the enhanced floating-point conversion
logic.

FossilOrigin-Name: 32b0ba0d27481d85a4b0037ec36befcbffecdec75891eba58569acb160045553
2023-02-23 22:08:22 +00:00
drh
4df23a3248 Increased precision of floating-point to decimal conversions when the
floating point value has no fractional part.
[forum:/forumpost/d1387c3979c7f557|Forum post d1387c3979c7f557]

FossilOrigin-Name: 18de3a8e6b431a075143631eafdcf0e1b1a21868b417394c365d46d2feca10b5
2023-02-23 21:18:47 +00:00
drh
648de49c03 Fix harmless compiler warnings and a code indentation error.
FossilOrigin-Name: de6c5c6bb49a0beca793cdc0462da2c17bb05f3292e08dd815be29b45b59a8fb
2023-02-23 14:43:15 +00:00
drh
ad96db8df5 Allow the sqlite3_config() interface to be invoked at any time for a few
choosen options:  SQLITE_CONFIG_LOG, SQLITE_CONFIG_URI, and
SQLITE_CONFIG_PCACHE_HDRSZ.  This list will likely change before release.

FossilOrigin-Name: e1702eb48d13c7c9b7605f1e77242672222c53059edcdc4e9cea59510715822a
2023-02-23 14:22:29 +00:00
drh
3c2688d137 Provide -DHAVE_LOG2=0 and -DHAVE_LOG10=0 compile-time options for use on systems
that lack the log2() and log10() standard math library routines, to cause
SQLite to substitute its own alternatives.

FossilOrigin-Name: 7ee22f95e7a7d8650f961f20e304e56c7813e624f05655d7392ca9347748270f
2023-02-23 01:52:54 +00:00
drh
af03eb3241 Enable the count-of-view optimization by default.
Enhancement request [eaed8e36ce888f1e].

FossilOrigin-Name: a4aacdd323a854d771c8cb1e2e4cfc4fb66b0020cfed23525733603605f5c63b
2023-02-22 21:47:02 +00:00
drh
95dee6d2e3 Avoid computing the values for unused result-set columns in subqueries.
Performance optimization request [baa5bb76c35a124c].

FossilOrigin-Name: 7c2d3406000dc8ac5a99cc205b036356b67e4b0b94738592ffc5680749696904
2023-02-22 21:11:34 +00:00
drh
7b56a0eacd Update the version number to 3.42.0 to begin the next development cycle.
FossilOrigin-Name: 65910216393ed287dbc7e42a2598b6980183c62a64da6572cb691ff4ee23555d
2023-02-22 20:50:51 +00:00
drh
bcb3215630 Remove the push-down optimization restriction that was added by
check-in [1ad41840c5e0fa70] because it is no longer needed after
the enhancements to compound query processing in check-in [27655c9353620aa5]
This resolves the performance regression reported by
[forum:/forumpost/bcc4375032|forum post bcc4375032].

FossilOrigin-Name: aa6bd6dff751223e302575c60f335707e4bb820bff716cab3706b564e18ed7ed
2023-02-22 20:42:15 +00:00
stephan
dbb3260627 Remove some unnecessary bind() calls in JS code.
FossilOrigin-Name: 71215599cd8ebb970500d8366dfac40420a9a6b243ea9d6ba62d5cde28fae3d3
2023-02-21 20:08:10 +00:00
stephan
2b83570b5f Unconditionally disable -sSTRICT_JS flag in wasm build because it no longer works with emsdk 3.1.31+.
FossilOrigin-Name: b5e0b69649e6341ffff4e62f9f68abd2a53519f73964559a133f3b708e007e98
2023-02-21 18:47:25 +00:00
drh
3b832a1a29 Version 3.41.0
FossilOrigin-Name: 05941c2a04037fc3ed2ffae11f5d2260706f89431f463518740f72ada350866d
2023-02-21 18:09:37 +00:00
drh
b5726a76f7 Disable DQS by default in the MSVC makefile for the amalgamation tarball.
FossilOrigin-Name: 409a19145e9558686acab730b94c6d53691b6d0efcea1e9239fc7e5863586a85
2023-02-21 13:28:49 +00:00
drh
61f0a03492 Yet another comment typo fix. No changes to working code.
FossilOrigin-Name: cdbdc8013fcfa8ce1bd4f5521c8d98afc53b9c577d43e5e6d0d1e15c789b910f
2023-02-21 12:42:25 +00:00
drh
0c30eaec99 Fix a minor typo in a comment. No changes to working code.
FossilOrigin-Name: 7981671d1449b3fc6eb214deb558d91b87dc4fa6e38e24606625a146cc71664a
2023-02-21 12:34:00 +00:00
drh
6e2b2f3073 Fix formatting and improved documentation on the various sqlite3_file_control()
opcodes.  Other minor documentation changes.  No changes to working code.

FossilOrigin-Name: 13280f720a4ef5a1f7f2a2fbe72f374d3a2e12be9bc0c50f7fce50d0cd28a67f
2023-02-21 12:30:18 +00:00
drh
3eeace23f5 Update the TEA version number to 3.41.0
FossilOrigin-Name: b450a920c0c59affd105616e999205cb9d2b25a79f8a7f7f05610ddaac0f770f
2023-02-20 19:43:01 +00:00
drh
ffe9bfd8e9 Fix an incorrect #ifdef in the CLI.
FossilOrigin-Name: 3c4d29cf227511bf218ef620d497dc72c708dcc819971b34c7629f3ed11803fb
2023-02-20 16:55:58 +00:00
drh
e17cac189f Fix a harmless compiler warning.
FossilOrigin-Name: b2534d8de5051a3516f4b9ee5a4b99e1dcf455e9af88c60815d2c2a479fc8566
2023-02-19 19:16:51 +00:00
drh
1603f7edee Fix stale requirement marks and fix a typo in the documentation for
sqlite3_preupdate_hook().

FossilOrigin-Name: 655991f5d9afdd3281049eb430921046e0ba90eef215020c2fb149adc0d3c4c5
2023-02-18 20:31:26 +00:00
drh
3c7e90b894 Fix a harmless UBSAN warning in debugging code of the new unhex() function.
FossilOrigin-Name: 315574d5cbe5c805ff2163052d986b054985984fb45bfb064d1a7b39a22b90eb
2023-02-18 15:50:23 +00:00
drh
16cdb4b632 Fix a harmless typo in the test case added by [29fc06465efb948f].
FossilOrigin-Name: e0a0bf56f11f32f58705098e76c276deaf90cfa87e110032bdaad10ce9674f61
2023-02-17 22:48:46 +00:00
drh
ab31a5df93 Do not allow the COUNTOFVIEW optimization to run if the count() contains
a FILTER clause.  dbsqlfuzz 4f8e0de6e272bbbb3e1b41cb5aea31e0b47297e3

FossilOrigin-Name: 29fc06465efb948f98d2733bb25ffa1e0662a0189304006b3d0be9fec7dd28c5
2023-02-17 18:27:48 +00:00
drh
e43d101c83 A few simple test cases for the omit-unused-subquery-column optimization.
FossilOrigin-Name: cf8f57c53425d89619ece10edc197d7d28946d3b23fcb4f526330196c76d9cc1
2023-02-16 19:41:39 +00:00
drh
7defd20cb0 Provide an optimization-disable mask for this optimization. Do not do the
optimization if the subquery is an aggregate or is distinct, but allow it to
be an ephemeral subquery.  Do not omit columns that are used in the ORDER BY
of the subquery.

FossilOrigin-Name: 6b1a1f374d1372f11f5420d99645b218867100bf070bd3a8885bf5f00c189dff
2023-02-16 18:04:49 +00:00
drh
90b7af7715 Do not perform the omit-unused-subquery-columns optimizations on a
subquery that is DISTINCT, as that can lead to incorrect results.

FossilOrigin-Name: cc148503db8ef180bce984328da7e84959afadd6a9613c2d03bc1eafeb95dfad
2023-02-16 15:54:55 +00:00
drh
6945ba787f Fix the subquery result column NULL-ifier so that it correctly handles
subquery columns past the 63rd column.

FossilOrigin-Name: 77b220a7240425fa83e142ceef78505208e6e38d797070e146b9f7d255f753c7
2023-02-15 19:53:08 +00:00
drh
e3ec00ccb8 Do not compute result columns of subqueries that are never used. Make those
columns NULL instead.  This optimization potentially resolves the enhancement
request described by [/tktview/baa5bb76c35a124c|ticket baa5bb76c35a124c].

FossilOrigin-Name: 5dec3cc0225296a043d17f73126d477d90a604f82b3180628176d8f950adbce8
2023-02-15 17:53:17 +00:00
dan
bdb2ec409a Update testrunner.tcl to run zipvfs test scripts on unix.
FossilOrigin-Name: e6c8e19ab0d6e7526d4596b75a45bb6becaf3c029690f7e75c016eac803c9990
2023-02-14 18:09:40 +00:00
drh
d6ba4252b2 Ignore extra parentheses around a subquery on the RHS of an IN operator,
because that is what PostgreSQL does.

FossilOrigin-Name: ecdeef43b27412b0b0b09e09a62ad3a03836a3fc80f2070268090e7ca8f02712
2023-02-13 19:32:40 +00:00
drh
b4dc263ec5 Do not allow WHERE clause terms to match constant string index terms, which
can happen if DQS_DDL is enabled.  Follow-up to
[44200596aa943963].  dbsqlfuzz 54c9db85ed4af7055f5fd0d50877875c82b11d46.

FossilOrigin-Name: 2d2b91cc0f6fed8cb6f738dc7019047ce0f1e86b5eb8efa997095d08a32cbcb6
2023-02-13 18:42:01 +00:00
dan
1aacb3b02f Allow vector-IN expressions like "(a, b) IN ( (?,?), (?,?) )" to use an index.
FossilOrigin-Name: 18a99d9cfbc3a0419342b3fe91a83d2217578d0f6e8ee1084237d000946b1942
2023-02-13 18:37:48 +00:00
dan
5c84aafd77 Fix compile time option SQLITE_DEFAULT_SYNCHRONOUS so that it works consistently.
FossilOrigin-Name: bf6f1ee77c4bf653f6cd2a3db5292b8c5c83f18ea9acf951107d22807546b28a
2023-02-13 18:26:58 +00:00
dan
0c69938511 Allow vector-IN expressions like "(a, b) IN ( (?,?), (?,?) )" to use an index.
FossilOrigin-Name: 1815b15ddb8785a25b7617aab19e13c2410b9377389c16a85176025b3d9400e8
2023-02-13 16:10:31 +00:00
drh
9e463e878d In the LIKE optimization, do not analyze the new virtual WHERE clause terms
until both have been added, since they are expected to be consecutive and
the analysis might add complementary terms.
This fixes a problem caused by [44200596aa943963] and discovered by dbsqlfuzz
and recorded as case 7e3b5983727d843b910b2d9ab556e4afcd777cfb.

FossilOrigin-Name: d35de3ad3fac6b30d3f266cbe4b1e9923eb31a1eff4a869205bbc3ba122eeec5
2023-02-13 12:46:22 +00:00
drh
0c55b5fd1c Change a variable from 32 to 64-bits to avoid a harmless compiler warning
in Xcode.  [forum:/forumpost/402d733c22|Forum post 402d733c22].

FossilOrigin-Name: 0216ce23cf23bc147c5de6de178a6689b7ad744bf0ee0098809938b5fe10708b
2023-02-11 21:11:39 +00:00
drh
80e936aef0 Do a better job of detecting when a WHERE clause term might be useful to
an expression index.  Fix for performance regression reported by
[forum:/forumpost/e65800d8cb|forum thread e65800d8cb].

FossilOrigin-Name: 44200596aa943963bc6ca98b5d4fd5b9235d1109d8dfc1a75eeae353b4239142
2023-02-10 21:53:33 +00:00
dan
a3e6192941 Fix a problem with the fts5 trigram tokenizer and LIKE or GLOB patterns for which contain runs of 2 or fewer non-wildcard characters that are 3 or more bytes when encoded as utf-8.
FossilOrigin-Name: 00714b39b39c51519edbc0194f98c7275fecf96763a06fd95db6e1d81bb9f1f1
2023-02-10 17:17:04 +00:00
drh
74e6e30358 Ensure that the valueFromFunction() routine does not clear a prior
parser error.  dbsqlfuzz 6fa816f20cf5b62260d635d110b88f38e29d8fe1.

FossilOrigin-Name: 734766451123c98a467c3407562eaa097b3307c8a275e1c8dd93e4654fe78014
2023-02-10 14:20:18 +00:00
stephan
98094e2f4c Minor text-only updates to wasm demo/test HTML and license header.
FossilOrigin-Name: f28e2a8613571fe3c23bfbbb602311071f4cb9731653216cfe436c38b0a59736
2023-02-10 11:05:16 +00:00
stephan
c9e3cbe873 Fix ext/wasm/fiddle build, which was silently broken by recent build refactoring.
FossilOrigin-Name: dcf532931136d09bef23ccad669d486cb31daec8565317c3209c280b5695d45d
2023-02-10 11:04:39 +00:00
drh
3f4795a391 Disable the double-quoted string misfeature by default in CLI builds.
DQS can be reenabled at run-time using the ".dbconfig dqs_dml" and
".dbconfig dqs_ddl" dot-commands.

FossilOrigin-Name: c995932c3ffe7f2710ebce0fa407eca3200418aa84febc15fb15f20f3758a98d
2023-02-09 15:32:24 +00:00
stephan
5b56a13977 Squelch two harmless signedness comparison warnings in shell.c.in.
FossilOrigin-Name: bdd3edec13fa1142a8074c316e9ecec93fb278d42836eeb38587376fdf22cebd
2023-02-09 12:59:44 +00:00
drh
9a8330b550 New test cases added to fuzzdata8.db.
FossilOrigin-Name: be67bafccd79ba835ed7e287e09852ce83805da0797b164d0c8e44be05d9d28a
2023-02-09 12:47:15 +00:00
drh
a0c8ec9ee5 The "flexnum" affinity that was added by [44135d6ea84f7ba6] needs to also
be added to the output of the affinity() built-in function.
dbsqlfuzz d309eaa5fe492c9606a8be876c2bc7dedb29d3d8

FossilOrigin-Name: f4ec68ceefa3a607f37d6355aac89fd1ae1704da4061bad7f271db1f17c1dd3a
2023-02-09 11:51:40 +00:00