Commit Graph

23937 Commits

Author SHA1 Message Date
dan
ece092e728 Experimental change to have sqlite3_vtab_distinct() return 3 to indicate that results should sorted and duplicates may be removed.
FossilOrigin-Name: 11f4508895c0a46d8623ca2f4f37b4f1b54b6d9022765f6124a9d42132f7d633
2022-03-16 12:06:00 +00:00
larrybr
c6e2f2e64d Make CLI complain about incomplete input at EOF. Fix for regression reported at https://sqlite.org/forum/forumpost/718f489a43be3197
FossilOrigin-Name: 72029cf7cdb266703cc8716102dbba8e6f2666e1f47409f42c39528795757b73
2022-03-15 17:57:42 +00:00
drh
836652952f Calling sqlite3_value_dup() on a pointer value results in an ordinary
NULL.  [forum:/forumpost/ae8592cc73|Forum post ae8592cc73].  Test cases
in TH3.

FossilOrigin-Name: fff1243b594c190d15f14b7ca4e60d23519cd15134f275991c685966fcc24145
2022-03-14 23:50:38 +00:00
drh
d024eca323 Fix an assert() statement in the covering index optimization for the corner
case of dealing with an sqlite_offset() SQL function call.

FossilOrigin-Name: 3950b7d006add571579158c751247a9435801e53eafd84b43dd3046e01da8ee6
2022-03-14 22:58:04 +00:00
drh
1a25be1a9a Disable trigger coding while running sqlite3_declare_vtab().
dbsqlfuzz 97e1865771b4226f29e6e482411c1cae14133f50

FossilOrigin-Name: 387ab17b8a0a4b87903aab52abc7da79098b882aff2ab687a554d5794e9d183e
2022-03-14 20:31:57 +00:00
drh
90402d4d54 Foreign key constraint failures should return SQLITE_CONSTRAINT_FOREIGNKEY
even if there is a RETURNING clause.  See
[forum:/forumpost/e6be6e82c86aa59b|forum thread e6be6e82c86aa59b].

FossilOrigin-Name: 3f9887d4a58cbfdbabf2a37e975c81ba660f373414058920b379f3a81e6e1c2c
2022-03-14 16:54:05 +00:00
drh
5a1f761218 Add a comment linking a part of the UPDATE constraint checking code to
one of the corresponding TH3 test cases.

FossilOrigin-Name: 0606e8e93edb5de4d154f377dbf91f15295d25ca9013c0f1612ae6d63a0139ea
2022-03-11 15:42:05 +00:00
drh
27e456458e Fix a harmless compiler warning.
FossilOrigin-Name: 5d739aff96c47146dba72fd76fed62d4e43ded09b32246fdde13d5467f713135
2022-03-11 15:16:50 +00:00
drh
605137aae6 Fix a harmless compiler warning and restore performance in the
sqlite3BtreeIndexMoveto() last-page optimization.

FossilOrigin-Name: 8b032293b384c3728c27b0658ee634c028c0d231d067de8b747d2e9e4ae704a7
2022-03-11 14:20:06 +00:00
dan
7ef4d75bd2 Fix a case in fts5 where a corrupt database could cause a crash.
FossilOrigin-Name: 5e95df261cce275adb5b2226e9584f4c389bb0d53c3b4feafd5a14be8d02ce63
2022-03-11 12:02:18 +00:00
drh
3946561a7f Another corruption detection case in the sqlite3BtreeIndexMoveto()
last page optimization.

FossilOrigin-Name: 531e6ad0389c6c820bb8c64db5049fb6b0bffd30bd394fd8ee7412959b1752e2
2022-03-10 23:37:58 +00:00
drh
463edb6275 In the sqlite3BtreeIndexMoveto() last-page optimization, make sure to return
SQLITE_CORRUPT if corruption is detected.

FossilOrigin-Name: 4ef19ba9b5cbda435c0bb9f2faddf8f7fac5d51399ff69bd049571c2ca3d9357
2022-03-10 22:54:32 +00:00
drh
fde3043200 Stronger defenses against corrupt schemas in the ALTER TABLE logic.
FossilOrigin-Name: 13fbde28173332522a7ad307c1aad2b83c9aa1fe737583afa2b29f6da4de6370
2022-03-10 21:04:49 +00:00
larrybr
551b650236 Amend sqlite3_column_*() doc table. (no code change)
FossilOrigin-Name: 1f473099776249f774a285fa117316636e00c3ff030ba0f22ed5bd05641c1bc9
2022-03-10 19:44:04 +00:00
drh
5e121a50b3 Prevent a NULL-pointer dereference when trying to parse a illegal
schema entry that contains a window function while doing a RENAME COLUMN.
[forum:/forumpost/ec2a2e0deb|Forum post ec2a2e0deb].

FossilOrigin-Name: 58de3c2b1a773a71b2d6a5d9a4dc0f839185d78d64519e7d267ad133b9830120
2022-03-10 16:26:00 +00:00
drh
105dcaa503 Refactor Window.pFunc into Window.pWFunc to disambiguate from other uses of
the variable or field named "pFunc".

FossilOrigin-Name: d9475ebcde169272ad7b1d3a82b2326df55dafc68217bfecd9fcd1f2b89efbd9
2022-03-10 16:01:14 +00:00
drh
7931f0a3d8 Only run atof1.test on x86_64 machines.
FossilOrigin-Name: 4173819cd285a1c133645eda27b9f6dc5a2247eaa0c834bdc60058ef3109b102
2022-03-10 11:48:16 +00:00
larrybr
a1d60e6c8c Mention that sqlite3_column_text16() returns have native endianness
FossilOrigin-Name: 25b7f88fcb2bb1908abde109c1167c462efbb156b4a8a8f94d36202bd93ea433
2022-03-10 02:23:43 +00:00
drh
6a51e70c5f Check-in [642a0b4752743216] fixing sqlite_dbpage is not exactly correct.
This patch should fix it.

FossilOrigin-Name: 6ba36714ca5e5457bc424273129f2814b62b7fae38926aa6eeeeec81020d7f70
2022-03-10 01:10:28 +00:00
drh
6563d0c11a Further refinements to the sqlite_offset() fix from [6029514b08b88e3f].
FossilOrigin-Name: 6f838305e2c848a43b210bd1b7b962fb9e3c41de34de778675e6578fcd99f397
2022-03-09 18:29:19 +00:00
drh
46dc631a32 Fix the sqlite_dbpage virtual table so that it starts a write transaction
on all attached schemas.

FossilOrigin-Name: 642a0b4752743216271e4f855a465515ef7f6a985f280251e18d67e3d5fb694b
2022-03-09 14:22:28 +00:00
drh
b528a5a04e Do not use va_arg() as an l-value, because
[forum:/forumpost/45e39c1311|AIX does not allow that], from what we are
told.

FossilOrigin-Name: 46d1a6de620f26fef9d0e2de6e9ea032790016441e4e6228a2f8cb30e20c9a51
2022-03-09 13:22:53 +00:00
drh
577f0a1e45 Improve the defenses against bad pathnames input into the findCreateFileMode()
function of os_unix.c in order to quiet static-analyzer warnings.  There
are no demonstrated problems in the prior code, but this change makes the code
easier to prove correct and more robust against future changes.

FossilOrigin-Name: a9cda38997a692e25d2fe994a9a3fb9472c00ba04323c82e706fdb1112d4244e
2022-03-09 12:20:40 +00:00
drh
32135d7e0a Fix a minor typo in a comment.
FossilOrigin-Name: cf61419f8816377f40ea032e1e3fb8b765ff7eb5b3a5ece8f7b59acffc5d3f05
2022-03-08 15:49:17 +00:00
drh
e684ac6f12 Fix compiler warnings.
FossilOrigin-Name: 5e30c6ea707f9d381127e8b2bb59e0b39bc00997da2c14d32a0e302d0121203b
2022-03-08 13:59:46 +00:00
drh
ec9b622fbf Disable an assert in moveToRoot() when the database is corrupt.
[forum:/forumpost/e9a176b7bd|Forum post e9a176b7bd].

FossilOrigin-Name: ae464a18d74bf44fc95bc335e75e6a57dc974f6d6a3d603133594039fb589af2
2022-03-07 18:32:08 +00:00
drh
42bb09c412 In the stay-on-last-page optimization for sqlite3BtreeIndexMoveto()
(check-in [0057bbb508e7662b] about 16 hours ago), be sure
to clear the BTCF_ValidOvfl flag, since the overflow cache is invalidated
by the search on the last page.  OSSFuzz issue 45329.

FossilOrigin-Name: 0021bebc162e001b788786703ce634e7b8fcd3976f7047a5956e82140791e765
2022-03-07 17:19:40 +00:00
drh
4c460bbffd Do not allocate new Trigger objects in the parser following a syntax error,
to avoid violating invariants associated with Expr nodes.  See
[forum:/forumpost/2024e94071ef1531|forum thread 2024e94071ef1531] for more
information.

FossilOrigin-Name: 5e0ed49b3d739d292f5df3e498449ae8f4357cbb83394181fb34f98ed8372707
2022-03-07 16:22:31 +00:00
drh
6d6ea42a25 Fix the code generated for vector IN operator constraints on virtual tables
so that they work even if the "omit" field in the sqlite3_index_info object
is off.  This has apparently never worked correctly before.  Presumably, nobody
has ever before written a virtual table that can use vector IN operator
constraints and that relies on bytecode to double-check the constraints.
Test cases in TH3.  Problem discovered by
dbsqlfuzz cab8e26194a40147627094f3c6849c0a7b1e0310.

FossilOrigin-Name: 21b656572d066b640ff5774205a4f0db13e1b08a35d0fd484da9130e759b0c26
2022-03-07 14:51:29 +00:00
drh
c5a55db75d Optimizations to sqlite3BtreeIndexMoveto() avoid unnecessary comparisons if
the cursor is already near the end of the table and is not moving far.  This
case is more common that you would expect.  The optimization saves almost
4 million CPU cycles.

FossilOrigin-Name: 0057bbb508e7662b0da19e981c07ef10236cb616bda952745de3aa2d1c286289
2022-03-07 01:29:36 +00:00
larrybr
41f46703b8 Disentangle variable use in last checkin
FossilOrigin-Name: 4c3a02600f10926da1f88ddbd457bb1486e6e02dee366b5cfc89e498a10daa6f
2022-03-07 00:14:52 +00:00
larrybr
53e1186da9 For CLI .import, revert to importing into temp or main when given table is found there and no -schema option used. And plug an obscure leak.
FossilOrigin-Name: bf9d1278846dce9255f9a11ddfc5dfac1acea2eadcb20816a19d59f7bccaec0f
2022-03-06 23:41:21 +00:00
drh
eab1064f04 Fix obsolete but harmless comments in btree. No changes to code.
FossilOrigin-Name: 4838b888e431f794b8a5ee65e797b3bf0616c03261de4e1fc9499287eb3e1265
2022-03-06 20:22:24 +00:00
drh
97a985e0c5 The sqlite_offset() function should be non-deterministic.
dbsqlfuzz 3df8230bb940870db87ffca2c0fc759c1e7fa356.

FossilOrigin-Name: e1a185e60afd32d3b25278dee42049920759ccd8fe709161007f5daa4a048693
2022-03-06 11:43:06 +00:00
drh
dc9513601e Remove a NEVER() associated with sqlite_offset()>
FossilOrigin-Name: e29dffcdba6f68af5cb76ca250e06a42183d9db92b60a16b2337b0d43c68bf2e
2022-03-05 23:52:05 +00:00
drh
ea840117af Fix the 'localtime' modifier in date/time functions so that it preserves
fractional seconds.
[forum:/forumpost/2ffbaa2c3fd7fb82|Forum post 2ffbaa2c3fd7fb82].

FossilOrigin-Name: 1c875b0764ab00e95c92f0ee329659e88041763e125c2891201d80f68c41f717
2022-03-05 20:12:53 +00:00
drh
8f32d92786 Further improvements to the sqlite_offset() function.
FossilOrigin-Name: 4230e2f5e068f2151fa33be25bb06123d41273dbe497a5ebc7173f8d7f81d160
2022-03-05 19:36:29 +00:00
drh
a275e76696 Fix the sqlite_offset() function so that it gives the correct answer even
if the argument is a virtual column in an index-only query.  Test cases
in TH3.

FossilOrigin-Name: 6029514b08b88e3fb3c0163813af38358490a6b6070b90f69975a324481394e5
2022-03-05 14:44:12 +00:00
drh
768ab1f296 Update obsolete text in the ICU README.txt file talking about SQLite's
robustness (or lack thereof) in the face of corrupt database files.

FossilOrigin-Name: dc88fc62f096bcf4df91406f565197f335333388121f860ba4424d9c881b0117
2022-03-05 11:57:28 +00:00
drh
ff55da360d Do try to evaluate the Bloom filter on a LEFT JOIN early, as doing so
essentially converts it into an INNER JOIN.  See
[forum:/forumpost/544af7eee2|forum thread 544af7eee2].

FossilOrigin-Name: d46d0e67c96bd49add4f71194496804a31209f2027a2e48eaf36dde26c1ca7df
2022-03-04 20:54:09 +00:00
drh
6f9d68817c When setting an sqlite3_value object to a pointer value, make sure any prior
memory allocations associated with that object have been cleared first.
dbsqlfuzz 33f842d1a09afaad5f078c3e1162a54b78e5f2ab.

FossilOrigin-Name: 31e1bde4b20bec4242b4101adad29bfa85648ea703d6e8c5c75e8c49b54a3a0f
2022-03-04 16:28:24 +00:00
drh
07559b2716 Restore the ability to push-down OR subterms of the WHERE clause when
processing a multi-index OR.

FossilOrigin-Name: d71fb6fdc32d2fce73059b6ab86d7d7bbc812c637469755dd45b6794aadc3a80
2022-03-03 19:40:21 +00:00
drh
4f12271780 Make sure the xParseCell and xCellSize methods of the MemPage object are
initialized consistently even if the page is detected as being corrupt.
dbsqlfuzz fd21f341f3b4f582401d2feb2a1c0c4cc2c26caa.

FossilOrigin-Name: 725a06434b886c96bb816340ef236530672a4593f0ceb3230ce69c8367beb997
2022-03-03 16:48:35 +00:00
drh
c9bcc5aab7 Fix for the problem identified in
[forum:/forumpost/0cd8e058bf|forum post 0cd8e058bf]:
When evaluating an multi-index OR, do not push down auxiliary WHERE clause
terms that involve subqueries into the OR-subqueries.  Otherwise, the
covering-index optimizer might convert table-references into index-references
for the particular OR index that is active for the branch in which the
subquery subroutine is coded, and those index-references
will not work if the subquery subroutine is invoked from a different OR branch
that uses a different index.

FossilOrigin-Name: 61a1c6dbd089979cbeb8b0c0c5ee1ab1abcb466be1d21a3a851be73c27e67a6c
2022-03-03 15:59:22 +00:00
drh
1902516d16 Add the new OP_BeginSubrtn opcode (which is really an alias for OP_Integer)
and make other changes so that the span of a subroutine that implements
a subquery is more readily apparent in bytecode listings.

FossilOrigin-Name: b8226748709de37cfc86414714c20567254e5b320b380e767c322dba69a79d49
2022-03-03 15:00:44 +00:00
drh
5694569591 Bloom filter pull-down optimization is incompatible with Skip-Scan.
Make sure the query planner does not try to to both.
[forum:/info/50a1bbe08ce4c29c|Forum post 50a1bbe08ce4c29c].

FossilOrigin-Name: ad3ffa1a75a5a032ebb64d8e014ee0a85c5e44b732e4b11bd67f31a59e729b94
2022-03-02 21:04:10 +00:00
drh
fc854505b4 Faster version of sqlite3VdbeMemRelease().
FossilOrigin-Name: 86c5fa2f301e4bdb538099f654b70b6ba0e214778cba2c53c53844e5d7ca129f
2022-03-02 17:50:59 +00:00
drh
5308d3931e Reinstate the releaseMemArray() performance optimization of
[bb520293d8c11518] with corrections.

FossilOrigin-Name: 1291080d118c678072289a2e57a56b73657e9256ae47eafa7853716c8d47392f
2022-03-02 13:45:22 +00:00
drh
e3994f2975 The optimization at [ece326db50201937] is not quite right, so back it out
for now.

FossilOrigin-Name: b218a4b9fe44ffc5cb8d2a2491a5aad217d37b26ccc6b04caf8f28b71bcfe809
2022-03-02 11:39:11 +00:00
drh
ceff761521 Fix a harmless compiler warning.
FossilOrigin-Name: 6497997aa80419688890ed5dbbb7d6acc26bf3732305ff4a728cba1fe4d1626b
2022-03-02 01:02:16 +00:00
drh
86af59830f The performance optimizations at [bb520293d8c11518] is not quite right,
so it has to be backed out.

FossilOrigin-Name: 15f73b121cacf77ada02bfe434f9caa1175ac482d007156cfb0864e4221490d1
2022-03-02 00:50:06 +00:00
drh
a055abb8c4 The MemPage.aDataEnd field should point to the end of the data buffer for
the page, not just the end of the usable portion of that buffer.  The purpose
aDataEnd is to detect cells that overflow the page, and that won't work on a
page with reserved bytes and a cell that starts in the reserved region, unless
the boundary is at the very end of the page. Chromium issue 1276294.

FossilOrigin-Name: f839c0bc8388a31f6db5081906b66b9e129855ba27a13cf13bd995b083f7386e
2022-03-01 20:15:04 +00:00
drh
3b4cb719c0 Fix a minor typo in a comment.
FossilOrigin-Name: 86ba06aa4c55d3aefe030b19b2b5c08baf46bbb2218b04ac1228ab76682a929b
2022-03-01 19:19:20 +00:00
drh
3703429cdb Fix two assert() statements in btree.c which were not true in the case of
a corrupt database file.
[forum:/forumpost/14819f2063|Forum post 14819f2063].

FossilOrigin-Name: 3b36ed79d82fae47a08a7d27f4fcefb7978fdf0e7f8c0f4a82f59501f201b32b
2022-03-01 16:22:54 +00:00
drh
e7fae604a0 Fix slightly-incorrect assert() statements.
[forum:/forumpost/f1e83b77b5ff37db|Forum post f1e83b77b5ff37db]

FossilOrigin-Name: 3c9f5c9defd7d36684132ae4ade9db2e2148dad4bd91bfe9374620ecafc35348
2022-03-01 15:48:16 +00:00
drh
90368c5dcb Increase the max_page_count on ROLLBACK, if necessary, so that it is sufficient
to cover the entire database.  Fix for the problem identified by
[forum:/forumpost/3b9e894312|forum post 3b9e894312].

FossilOrigin-Name: 12c012162ce110a7a7fbbe853f422e23cb4ae10b45237727328c8f3315b70842
2022-03-01 14:13:32 +00:00
drh
935c37229c Fix the Xfer-optimization on the INSERT statement so that it is omitted if
there is a RETURNING clause, since that optimization is not able to deal
with RETURNING.  See [forum:/forumpost/595e132f71|forum thread 595e132f71]
for details.

FossilOrigin-Name: 1d3760a517b8bd2a6be82d2d5788945f49397cdc539fe28fd23e2c0c62a1dbe2
2022-02-28 16:44:58 +00:00
drh
8552b10c45 Reorganize the bits in Mem.flags. Free up one bit for reuse.
FossilOrigin-Name: fe454291d959c299d6608dfc165c9e05fb53e431b0fc7aed1cb4a557cd61d8ab
2022-02-28 14:26:33 +00:00
drh
74a12dd6fd Expand the comment on the definition of the Mem object to better explain the
meanings of the various flag bits.

FossilOrigin-Name: f2f0426035d4e0334be000a3eb62bbd7d61fdab7c2ef9ba13cfdf6482396dd13
2022-02-28 13:38:28 +00:00
drh
0150c81cd3 Performance optimization in initMemArray() saves about 750K cycles with only
a 4-byte increase in code size.

FossilOrigin-Name: c3e9cd5e7430be0653a96a2097a695447549980e08cc8bd8d8097a50c954908e
2022-02-28 12:16:51 +00:00
drh
4296357c90 The performance increase in the previous check-in of this branch was due to
the revised loop in initMemArray() and reordering fields of Mem - not the
call the memcpy().  Changing the code to avoid memcpy() results in an even
better gain, and code that is far less dodgy.

FossilOrigin-Name: d74aa979530d4236f5900d2ef998b27065d352d7c18bcd822e5c8f1041a1a81c
2022-02-28 12:08:09 +00:00
drh
c9373e86e8 An optimization to initMemArray() saves almost 500K cycles. But it seems a
little dodgy.  I want to think about this more before merging to trunk.
Perhaps there is a cleaner way to accomplish the same.

FossilOrigin-Name: 7fefd8676110a53e6c98a697e2dbf820740fe602a1e83b6caa8d099c41a15d80
2022-02-28 03:25:13 +00:00
drh
b3d981c3b7 Avoid unnecessary deinitialization of the Mem.flags field.
FossilOrigin-Name: bb520293d8c11518ba153b986662f081ebfd781d38eb624c509605fa9148f6e9
2022-02-28 02:35:48 +00:00
drh
f357cafaf5 Cache values of UnpackedRecord.aMem[0] into new fields of UnpackedRecord.
This avoids extra indirections and saves about 750K cycles.

FossilOrigin-Name: 7cf2d1f0396362aae7b93da75c2036d52ba86acba1cc90abca560bcf0314a22f
2022-02-27 21:10:49 +00:00
drh
a1e951fa48 Bypass a single branch in vdbeRecordCompareString() in the common case, for
a performance increase of over 600K CPU cycles.

FossilOrigin-Name: 36f0f07e505dfb38c61d3b4d5b947013c8793e6796fe690e53864479b9276abb
2022-02-27 18:54:33 +00:00
drh
a0318fd7b4 Remove an unnecessary local variable for a small performance increase and size
reduction.

FossilOrigin-Name: 9bda611f0d182a62ac1b68610313143c2e28868c16c7d4362a8f5945c27dd88e
2022-02-26 23:01:25 +00:00
drh
9090df6f73 Allow the OP_Column opcode to read rows that are larger than
SQLITE_LIMIT_LENGTH as long as the specific field being read out is
less than or equal to SQLITE_LIMIT_LENGTH.

FossilOrigin-Name: 1bf4848995ab094ad84ef4aa1563bce641d5acf7335fb4630c892b16cf7d7edd
2022-02-26 14:39:08 +00:00
drh
fc56950337 Revise the initialization processing for OP_Column to make it about
1.8 million cycles faster.

FossilOrigin-Name: 3b7259ebd5b9b1f75577521c4d0d96f5503d302a513b20a0b17dbe8c3823dd33
2022-02-25 20:11:59 +00:00
drh
a10be3da20 Fix the OP_NullRow documentation so that it accurately describes what it
actually does for a pseudo-cursor.

FossilOrigin-Name: 4e269902094e8f9d852e5fc852e473167048fdeb9034f1fb1436f6df205de926
2022-02-25 18:51:09 +00:00
drh
7fd6a7761f Improved comment on the codeDeferredSeek() routine. No code changes.
FossilOrigin-Name: 54f49f65ac943263a1622b1efe519c8a61f30f23694fd4fec89ad2bf0e17b473
2022-02-25 13:29:56 +00:00
drh
d1f0a86c12 Fix unimportant typos in comment text.
FossilOrigin-Name: 393460132994d6ca133e52af57374e43a2795a9e7fc7781bd9dea752a2b52c6a
2022-02-25 11:30:29 +00:00
drh
9606a13432 Invoking SQLITE_TESTCTRL_INTERNAL_FUNCTIONS causes the flags field of the
PRAGMA function_list to show all bits, including internal-use-only bits,
rather than just the bits that are part of the API.

FossilOrigin-Name: ad1be34828726bfef0dbc0ce16090400cf3530e7b5077849af96774d7428387b
2022-02-25 01:23:17 +00:00
drh
c45924ebc2 Remove unused P4 types on the Opcode object. Saves a few bytes of code
space and simplifies the code.

FossilOrigin-Name: aca538435939e6146f9a42e72e3a65030bbc5f646a0bbc7684e43688a0339888
2022-02-25 01:10:57 +00:00
drh
a7c9dd546b Change the OP_Next and OP_Prev opcodes so that they invoke
sqlite3BtreeNext() and sqlite3BtreePrevious() directly rather than through
a function pointer, for improved performance and a decrease in code size.

FossilOrigin-Name: 9d13cbbef3cf64f281d3e100f23f1b2ed6e8d65920c7517a84e1e4f964ceff2e
2022-02-24 14:44:23 +00:00
larrybr
b2d594a19b Spell fix, no code change
FossilOrigin-Name: f2597fae3c2b8f77f98a3ba9420b309f649b4008f9530d3cfaeeba1e2bf5d8a3
2022-02-24 11:09:08 +00:00
drh
cdc59c82ad Fix an assert() so that it is still valid following OOM with the latest
enhancements.

FossilOrigin-Name: ecf832f71fbaee36ee10f6da5bde19a8af9f90adbba06e8c5706d18b768bae1f
2022-02-24 01:41:14 +00:00
drh
fc4fe5a837 Update the version number of version 3.39.0 for the next development cycle.
FossilOrigin-Name: 9542e9bebbd25b20228fa2366b76d55845a40f12fdc4bbd077d1cb48e32b8cf2
2022-02-24 01:08:53 +00:00
drh
19ae01be13 Add a new subclass for MemPage.xCellSize specifically for the case of a leaf
page in a B+Tree, that is optimized for that cases.  This gains a half million
cycles or more at the cost of less than 200 bytes of code space.

FossilOrigin-Name: 7ad829224adbec5d74ff9e5ab040eb2ad3e17fe45da7a2cf0cca770a0731401a
2022-02-23 22:56:10 +00:00
drh
009a48e0ad Optimize calls to get2byte() in btree.c for almost a one-million cycle
performance gain and a few bytes less code.

FossilOrigin-Name: 41061f29969dc546c2702f7f412127070a4dd54593827692df93a83c939dfb61
2022-02-23 18:23:15 +00:00
drh
eac750e9a6 Defer the check for error check Pgno zero until after the page fetch misses,
to gain a few CPU cycles and a small size reduction.

FossilOrigin-Name: ece326db50201937eb688809df39edc7fb97413b4614d2e2e783418192f7b02a
2022-02-23 17:16:30 +00:00
drh
584bfcaeb6 Store the page number for the PENDING_BYTE page in the Pager object, rather
than computing the page number every time it is needed, because it turns out
that number is needed quite frequently.  This saves a few hundred thousand
CPU cycles and a few bytes of code space.

FossilOrigin-Name: 5aa9c3eb45514d5eb7b32696d25a9aeb7dad485e1ea5adb833fac6d1f2105f1a
2022-02-23 17:00:44 +00:00
drh
f2a777fa5d For the "PRAGMA database_list" statement, do not check to see if the schema
is up-to-date and do not try to reload the schema.

FossilOrigin-Name: 710de6a2137c872812effa43ea888aa77d339362ca0b6c8990d4426c8fb20689
2022-02-22 20:29:31 +00:00
drh
98095e3949 Version 3.38.0
FossilOrigin-Name: 40fa792d359f84c3b9e9d6623743e1a59826274e221df1bde8f47086968a1bab
2022-02-22 18:58:40 +00:00
drh
60f3657b4a Fix an undersized memory allocation in the test harness for RTREE. This
error was in test logic only, not in the SQLite library itself.
[forum:/forumpost/35470a0a72a005e1|forum post 35470a0a72a005e1]

FossilOrigin-Name: 7e3c9594390ac8defaf9825e14b4c19ef8c123b747971dd3d4df16110f443d3b
2022-02-22 15:47:55 +00:00
drh
16f56e8416 Fix compiler warnings for older compilers (ex: gcc 4.0.1 powerpc-apple-darwin).
FossilOrigin-Name: 5c188243d769681c68938c8e432155c8ec838d9e32fe8d1b12286ebc9d0e87f1
2022-02-21 14:30:59 +00:00
drh
a12500005f Remove stray tab characters from auxiliary source code files.
FossilOrigin-Name: e25e33582b69289a2c3a6bc403e3911de22a3b529db1a565efb9f1af01b9e382
2022-02-21 13:44:51 +00:00
drh
91260dcf83 Add SQLITE_OMIT_JSON to the compile-time option test sequence.
FossilOrigin-Name: f36325a6e21c4d3b6ab48ebfb2efabda089281344d1e61949d1c9290e88395b1
2022-02-21 13:02:23 +00:00
drh
d01a1bd94a Do not allow error messages from sqlite3NestedParse() to leak up into the
main parse.

FossilOrigin-Name: 9c4e21abdca664d6b7bcf0043fe9ec05ef8b2949ba6ee7208abaaec1ff4ed679
2022-02-21 00:23:49 +00:00
larrybr
a7919add6a Improve .backup and .save help text
FossilOrigin-Name: 741651fd4b1b776b4dea156cdc987f426f7c668ece203bda6654b2c7117c8933
2022-02-19 21:25:48 +00:00
drh
1ff855b22e Add a NEVER() to a branch that is unreachable for STAT4.
FossilOrigin-Name: e4e97505af4016c48465009686bfeffe9627e225a5b2082a5bf4baeee40db5c9
2022-02-19 15:57:28 +00:00
drh
b15a3940d1 Enhance the documentation on sqlite3_stmt_readonly() to explain that
EXPLAIN and EXPLAIN QUERY PLAN do not affect the return value.  Add test
cases to verify this.  Add new test cases and requirements marks for
complete requirements test coverage on this interface.

FossilOrigin-Name: a6fbb7ba0583b3981e2d8b809006b902b3e97e516dbd3ab7d905c5ea73df2272
2022-02-17 17:24:39 +00:00
drh
dedd51aed4 Remove references to the now-defunct SQLITE_ENABLE_JSON1 compile-time option.
FossilOrigin-Name: db950192c93db7f5eb4ffcce41d0ea374c58450405945cfb8ebe0c93070b7c48
2022-02-17 14:33:13 +00:00
drh
24ea5fb3e8 Fix a testing error on Windows that was recently added to shell5.test.
FossilOrigin-Name: 6cace54320997dcbbdd49017f20eecafa88ebcc4b264ee800954f25d9605023d
2022-02-17 14:29:39 +00:00
drh
be4e3c88f5 Make the sqlite3_error_offset() interface accessible from TCL using the
new "erroroffset" method on the sqlite3 object.

FossilOrigin-Name: 3454a1222bedefba527af98c0284ed0bfbd28dd941885d9a0ac9a44aea2fc8ec
2022-02-16 15:11:01 +00:00
drh
537a6bf189 Improved rendering of floating point numbers without a fractional part in
".dump" output from the CLI.
[forum:/forumpost/550d877659f37cb2|Forum post 550d877659f37cb2].

FossilOrigin-Name: 9edaeed56f2282fd4da935454178c38ab49d259aed96d4e720aae09050a53006
2022-02-15 13:23:09 +00:00
drh
0ca0988355 New assert() statements to help prove correctness of memjournal.c.
FossilOrigin-Name: d74ec88c2f9b9e056988add8322186750229e14a609d1a6969ba393a5b8c5174
2022-02-15 11:46:31 +00:00
drh
e63b7bdac8 Generalize the in-memory journal so that it is able to accept writes that
begin at any offset less than or equal to the current file size.

FossilOrigin-Name: c039d5476e0836c16d8c1ad99a2620f7fd04eb4b0e5dcb2246b42dde2ae1f95a
2022-02-14 21:11:17 +00:00
larrybr
7d5113f0a3 CLI .import can auto-rename non-unique column names when it creates a new table
FossilOrigin-Name: 4b5d07ea7e6f5d6f1279c88bc474ee4bc8bd2cebe38a268f211f47e44569e4b1
2022-02-14 18:55:19 +00:00
drh
9a4e88604c Minor correction to the early corruption detection added by
[a6fda39e81d0da98|check-in a6fda39e81d0da98] so that it works even if
the page being cleared in page 1 of the database.

FossilOrigin-Name: a5ec16907ef6ab50e041101d87c5756c71469923872a86c3ab383f188673d7a5
2022-02-14 18:18:56 +00:00
drh
0aa0945111 Fix a bad assert() (it needs an "||CORRUPT_DB" term) in b-tree, discovered
by dbsqlfuzz.

FossilOrigin-Name: f5f263cc626d6a8bea3e85e28bb716e3eac0d9cd199cc060c0c8b0c77b280a45
2022-02-14 13:53:49 +00:00
larrybr
3363386145 CLI's .import column rename made more minimal, and reports renames.
FossilOrigin-Name: c626cff7f99ec502ebd46f9cdafc3d088697544ef5d6559b6b3ae85679b4f9fa
2022-02-14 01:12:46 +00:00
larrybr
42de1c52dd Sync w/trunk, fix zAutoColumns placement blunder, all to pass all TCL tests
FossilOrigin-Name: 67dc59f46d742ad69742fb34540a3074af163a3f1a0f9093f83db2276bf944ca
2022-02-13 22:18:22 +00:00
dan
dfcb11de18 Do not run merge1.test with SQLITE_OMIT_VIRTUALTABLE builds.
FossilOrigin-Name: bf8dbfd499e732f14c7a8efee527e8ce155937dbb2a3e85213f8aa64ac497189
2022-02-12 18:56:24 +00:00
dan
02ede43da2 Fix a possible user-after-free in ALTER TABLE found by asan.
FossilOrigin-Name: 9252619d410293ddefd108f5cf81b6fb4932bd3f2ceaaa92abb7542e34f66111
2022-02-12 16:02:37 +00:00
dan
8443505dc9 Update fuzz.test to account for a change in error message made in the core.
FossilOrigin-Name: c57601b51f9b59e9d8f0eb06580fa14f49525e56bd0190c02865e478bd1f48e7
2022-02-12 13:45:02 +00:00
dan
af7b8dcb58 Avoid dropping SQLITE_TOOBIG errors in the quote() function.
FossilOrigin-Name: 115c3051a1ff7567e84f14fc4c49efe61bc2850248533449b0195c305ab6516e
2022-02-12 13:37:27 +00:00
larrybr
43a196a3bb For .import auto-column, aid build-time override of rename decoration.
FossilOrigin-Name: 433e5ead2b711d1e3b0b62cf8cb5a8a65e2474c68ef2173317ed4323fc8bdc58
2022-02-12 13:12:03 +00:00
larrybr
0a704c3145 Fix auto-column bug noted by post https://sqlite.org/forum/forumpost/d102c15d63
FossilOrigin-Name: 689137e1b5bc78b0f16e5db86d16415b9fa77d22ded59e93d75e7033b465e673
2022-02-12 10:48:42 +00:00
larrybr
78138397b5 Sync w/trunk, allow build-time override of auto-column decorating character
FossilOrigin-Name: caaef4c592c980889efb349fa73b61303ec493172d90cd67d54ffde0855e4138
2022-02-12 02:15:37 +00:00
drh
f17f607556 Fix a test in without_rowid1.test so that it is disabled without
ALTER TABLE support, as it uses ALTER TABLE.

FossilOrigin-Name: ca22a64e6f05a6688974f4cff1a0ff2c873aad1947f3cf6ffaeee8bb074b2627
2022-02-11 21:20:46 +00:00
dan
7b57aa3da9 Update some OOM tests of the ALTER TABLE command to account for an error message which may be returned if opening the temp db fails.
FossilOrigin-Name: 3409fd4150df059d7308f79fa3672a330af9cefe2ad9120c3da5ef1413921e96
2022-02-11 19:41:03 +00:00
drh
eba21cd4be Load recent dbsqlfuzz finds into test/fuzzdata8.db.
FossilOrigin-Name: b275ad250d8aa286829647967ab7e75fcd2b5674caab1a34eab59d8486a34cd5
2022-02-11 17:47:58 +00:00
drh
11fc3c0fa7 Reference the wayback machine for the dead hyperlink to the MS support
page in the comments about why the extra typedef for va_arg().  No code
changes.

FossilOrigin-Name: ab1a9b5b78de7c00b38357b1df08e82ce5608a14f8c675ac20c5f2dad5212f50
2022-02-11 17:47:25 +00:00
drh
4ba1c5cc49 Fix an assert() in the pager by adding "|| CORRUPT_DB", in as much as the
assert() is not necessarily true if the database size in the header is
wrong.  dbsqlfuzz f2f996065b90988aa9b0ae425b66dbb296546a08.

FossilOrigin-Name: a51402e8c29fad2b24e32de55b10691fb0ebd6c2cebac941e43e54be211d5d39
2022-02-11 17:33:02 +00:00
dan
63a47336af Fix a problem in [c006515ae6faff65] causing an assert() to fail with some build configurations.
FossilOrigin-Name: d7ff262d6d1fd8b855bcb8f6f54ab1833663a4d8187701ddf045f6b5a62a5d1d
2022-02-11 16:10:18 +00:00
drh
85548fac8d Use the enhanced SQLITE_TESTCTRL_LOCALTIME_FAULT (2) capability to do better
testing of the 'localtime' and 'utc' modifiers to date/time functions.

FossilOrigin-Name: f38071946ac2e5bb61e6c0620507e4c94464999ac700d86c1a704b94eb1c009a
2022-02-11 14:08:05 +00:00
larrybr
a03372745e Upon .import column renaming, issue message saying so. Test this.
FossilOrigin-Name: 8b6ca9304bff9a5b2897a6517ce77e4cd32f337b6c849b73ead5f757228d8ac8
2022-02-11 13:40:25 +00:00
drh
fa3ee3b10b Fix the bind2.test test script so that it works even if
SQLITE_ENABLE_PREUPDATE_HOOK is not defined.
Fix for test-case breakage from check-in [c006515ae6faff65].

FossilOrigin-Name: 937d3a45b3fef354dbdea2085fbb7d9c752a96e8ebb62f61931deb5a64132946
2022-02-11 12:06:37 +00:00
drh
0d58ae010c Work around the MSVC bug that prevents the use of function pointer types in
the second argument of va_arg() by adding a typedef.

FossilOrigin-Name: eae3ab0a050079d050f339b2510eebd55afe4464e9b410ddacb7523f89981144
2022-02-11 11:37:12 +00:00
larrybr
4c5c6214b1 CLI auto-column rename revamped after forum discussion.
FossilOrigin-Name: 2da1f8e45eb0cb1ead6049df6a31a903bfad5a7abd27e92cd3dac25fe355aec3
2022-02-11 01:21:09 +00:00
drh
b30af022da Fix SQLITE_TESTCTRL_LOCALTIME_FAULT so that it works even if mutexes are
enabled.

FossilOrigin-Name: 64537a0669553e8a6b610b9e9703ec084472516c86cfc22a7a6c73b6c66131ee
2022-02-10 23:12:58 +00:00
drh
d7e185ce5d Enhance SQLITE_TESTCTRL_LOCALTIME_FAULT so that is able to install an
alternative localtime() interface so that the localtime logic an be better
tested.

FossilOrigin-Name: 6e25cb0890e8cdc63c9a21e841844d066267fc32ad143527843f7c8d05612b53
2022-02-10 21:26:53 +00:00
drh
eadccaa926 Performance improve to the 'localtime' and 'utc' modifiers for date/time
functions.

FossilOrigin-Name: 85cb6014751a0572d28ebd839331d5d7a78de45c9e522adcd834a8a85746f32e
2022-02-10 15:40:40 +00:00
drh
522608d3a2 Faster implementation of the date(), time(), and datetime() functions.
FossilOrigin-Name: fa1b393bdb66b985f6552190a8242ed878f91d653a03352f65aa8d750de3cec4
2022-02-10 12:57:53 +00:00
drh
ddd3fe6fc4 Fix the test harness so that it builds without SQLITE_ENABLE_PREUPDATE_HOOK.
Has been broken since [c006515ae6faff65].

FossilOrigin-Name: 4565f711291bae5daaff6dd2b7b2991b17e139a576b1b73bb1f81f08a4c1a13f
2022-02-10 12:31:37 +00:00
larrybr
58a53d6e7b A CLI feature. auto .import (new table) columns. WIP
FossilOrigin-Name: 7e3be36dfcb65c87a87344cf91c0c8f8d1aff0f2e4bcc23444a8f6b8ddcdae69
2022-02-10 03:21:48 +00:00
larrybr
208b7141d0 Create new branch named "auto-column"
FossilOrigin-Name: 066febe8931c5d90c009f05fe9ad0924ad35ec25a61ab42db63a9b9dbb1cecce
2022-02-10 02:09:43 +00:00
drh
0d36368601 Fix a typo in documentation. No code changes.
FossilOrigin-Name: e97c6ad4c915c82c2f0b347a0cdc8f80942c345194675a88174047ce0d0a43ad
2022-02-10 01:01:31 +00:00
drh
e2adc0eea1 When process first moves a database into WAL mode and then tries to run
sqlite3_wal_checkpoint() without first performing a transaction, first
try to run a synthesized transaction to get the Pager caught up before
attemptingn the checkpoint.
[forum:/forumpost/fd0f19d229156939|forum post fd0f19d229156939].

FossilOrigin-Name: eee6de1967609f0b590ee4dbec088c3e7b03b08753267ed2909c5b03d60a0e18
2022-02-09 18:47:09 +00:00
dan
252fe67bdd Fix a problem with using sqlite3_bind_value() with sqlite3_value objects obtained from sqlite3_preupdate_new() when an integer value is written to a column with real affinity.
FossilOrigin-Name: c006515ae6faff6525d589827d99092b06004472e32b7f586845c00c4732d695
2022-02-09 18:42:15 +00:00
drh
9f4ce3b19f Writes to the subjournal should be all-or-nothing. Fix for
dbsqlfuzz fe3c397fb90029313446c4e0f4a6cd0c81dd9621.

FossilOrigin-Name: 22cc55e84f67f6f39b7dba07a4ef7ae958b2d926633faec91a278922053e50c6
2022-02-08 15:14:18 +00:00
drh
4e532958c1 Provide sqlite3_error_offset() data for some new errors.
FossilOrigin-Name: 1269206db810460e55a52e178ba3332add42a11f66c5f292f8f0d29ccd61a4b8
2022-02-08 13:41:23 +00:00
larrybr
07fc85a2bf comment-only change to sqlite3.h
FossilOrigin-Name: f815cf4a5f97778f177d373814700e8f2f6429dc467b68b799b5b349cc00b7a2
2022-02-08 12:24:43 +00:00
drh
633c798283 Do not show the error code number of CLI error messages unless the error
is something other than 1 (SQLITE_ERROR).

FossilOrigin-Name: b471601892df98c5103bb55132bbdecf3e4dfc428aaecc47bfec1e1d51e583c7
2022-02-08 12:13:16 +00:00
drh
3e46db21d4 Improved error message formatting in the shell. Distinguish between
"Parse errors" and "Runtime errors".

FossilOrigin-Name: ae3e322a029952f575e49c73fb50b46bbea55be6792cc225cb94f5e0cbd046d9
2022-02-08 11:52:45 +00:00
drh
e1c4743121 Disable the sqlite3_error_offset() when the error occurs in a trigger or
view or some other bit of text that is not part of the original statement.

FossilOrigin-Name: 0e909e34fa74e7b9b7954e4ed4c39dd293c1d413b58fda03607faab74aa382ad
2022-02-07 18:52:56 +00:00
larrybr
6e85b27cbb When create table/view fails due to name taken, say which took it.
FossilOrigin-Name: 9a206e37fb49a203a7b5fdc93c41acc39e9ceb37144c78432a235e2f0d54a210
2022-02-07 01:09:49 +00:00
drh
5d20a21814 Fix unreachable branches in the sqlite3_error_offset() logic.
FossilOrigin-Name: 031381aea371892a35737e550121846af41241711a36c1a2086af3b0c11bf7b6
2022-02-06 23:54:41 +00:00
drh
51896e6fd7 The sqlite3_vtab_in() interface should return false for a vector IN constraint.
FossilOrigin-Name: 245d0241c78870c6a41af3e02b82b13151472e2102fbd62989672f8122feca73
2022-02-06 22:13:35 +00:00
drh
89e9baa2ca With the new ALTER TABLE under PRAGMA writable_schema=ON processing, do not
ignore non-parser errors such as OOMs.

FossilOrigin-Name: 36653ccef68cf61b6001000a713b06e951cb6fddced6b6a906c3b17d70a8af87
2022-02-06 21:13:59 +00:00
drh
2ef111168f Faster computation of Expr.nHeight.
FossilOrigin-Name: a7a5af327ba8bafcd58b828e3e7a10d0008bb780d55a6c573aa15896dcc8ab89
2022-02-06 11:51:23 +00:00
drh
17a93ae1b8 Record the error offset on INTEGER tokens.
FossilOrigin-Name: 38e057a580613be176552e230e40b4434a9ed57a82d407e92a23c7b8e62c0b0e
2022-02-06 11:26:51 +00:00
drh
62fc069eb4 Further improvements to localization of errors in input SQL.
FossilOrigin-Name: fa34676042720161ca03f3926814152eb1d144ec12fd2b44e5429408ea4ad5b0
2022-02-06 00:30:04 +00:00
drh
4f77c9208a Enhance sqlite3_error_offset() to report the position of unresolved
identifiers.

FossilOrigin-Name: 5b8d2577907abda10de29884716bacc10bff0df1451228a0ac40342dbea6d589
2022-02-05 23:11:19 +00:00
drh
796588ae07 Record the position of many identifiers in the parse using the new
Expr.w.iOfst field.  This is done with the idea of providing offset
results for sqlite3_error_offset() for a more kinds of errors, though that
part is not yet implemented.

FossilOrigin-Name: 32a3a53b62ab09ac2212905e7f42fe6f1b09d891e015203e5caf4cb16262f18e
2022-02-05 21:49:47 +00:00
drh
4734b3f9b7 Update stale evidence marks on sqlite3_vtab_rhs_value() test cases.
FossilOrigin-Name: 46744b83d5e1335bcbc59f9625e8ade3f360469d17f34e8d996f077ba9afa89e
2022-02-05 13:27:52 +00:00
drh
dfce5b6dd5 When PRAGMA writable_schema=ON, allow ALTER TABLE to proceed even if there
are entries in the sqlite_schema table that do not parse.

FossilOrigin-Name: fc4c82e5694cbdae13f2cb90e5368ba9f6b826a220a81de32ead2ffe1bc5f31f
2022-02-05 12:39:17 +00:00
drh
569c10566e Fix a NULL pointer dereference that can occur after OOM. Problem
introduced by check-in [197cbabf1767d060].

FossilOrigin-Name: d4e6b9f0f7567b76760a667a701bca4d6158ade39f9a69d205b583c5a1c0c7f4
2022-02-05 12:05:43 +00:00
drh
6c758900c2 Fix documentation typo.
FossilOrigin-Name: 1a7d8bb5ea0d0e0c250312f89a701c0274cfbcaef9cd71995fb83bf939668504
2022-02-05 11:13:26 +00:00
drh
d515ea5b56 Typo fixes in documentation.
FossilOrigin-Name: 1ec747d1c34ced9877709dd306e674376e79145de08b9c316d12bc5e06efc03e
2022-02-05 01:01:07 +00:00