Commit Graph

25724 Commits

Author SHA1 Message Date
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
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