Commit Graph

8588 Commits

Author SHA1 Message Date
drh
529394e5c1 Cannot use an automatic index on the right table of a RIGHT JOIN because
automatic indexes must be WHERE_IDX_ONLY, but the RIGHT JOIN post-processing
does not know how to work with an index-only scan.

FossilOrigin-Name: beb4401dc09fb68e85ddcf3f99598527691535d0eb7693168f440e5a5a076e3f
2022-04-10 23:48:47 +00:00
drh
9debb58e48 Revisit [f84b2beca7197589]: disallow co-routine implementations of tables
that are to the left of a RIGHT JOIN, to avoid other complications.

FossilOrigin-Name: cf00ebfc4b77f45ec466b0d57d7c22c7f48acab19e4e55b168eb4b53f390d887
2022-04-10 23:01:20 +00:00
drh
fcde633f7c When the left-most table of a RIGHT JOIN is implemented as a co-routine,
make sure all its columns are flushed to NULL when it finishes so that
they appear to be NULL during the RIGHT JOIN post-processing.

FossilOrigin-Name: f84b2beca719758979d7a5a63c3d16d5121a7518b3fbe5039af474a83dd569c2
2022-04-10 19:51:22 +00:00
drh
e21e36dd2c More test cases and bug fixes.
FossilOrigin-Name: 140e97fde94fdc3babdd456ce1b22900ead0e40e2afe63d89d21ccdbf141b607
2022-04-10 17:14:48 +00:00
drh
a20c71e9e8 More RIGHT JOIN test cases and a bug fix.
FossilOrigin-Name: 19e8ad690a140ca40838bf31a377c19010fcbbc2554a4f1746737543043e334b
2022-04-10 16:13:37 +00:00
drh
ac8c438a79 Add a simple test case. (It is not difficult to create additional test
cases that assert, at this point.)

FossilOrigin-Name: f2201d5dcfc552bdddd0780b3f466bdaa886e557f147335c085395bfc001f6b0
2022-04-09 20:11:05 +00:00
drh
a76ac88af8 Preliminary code to support RIGHT JOIN. Everything seems to work, except that
the code to compute the unmatched rows for the RIGHT JOIN has not yet been
added, so the result of a RIGHT JOIN is currently the same as an INNER JOIN.

FossilOrigin-Name: 415abd6731b8e8a605adabfa6066c8a852a8531c300df41325d5f7e75cae5a70
2022-04-08 19:20:12 +00:00
drh
d44f8b2385 Improved technique for parsing the ON and USING clauses of a join is faster
and uses less memory.

FossilOrigin-Name: 158156a3e3d50042cafc75dea3aaaa68b1f2efb9c3d178518ea6e68e32e0d21c
2022-04-07 01:11:13 +00:00
drh
b07fb4f1c2 Fix the JSON Path parser so that it will accept zero-length object labels.
[forum/forumpost/c082aeab43|Forum thread c082aeab43].

FossilOrigin-Name: 84fe95d2a5b4d232d657e3b8110027a698a9bcd597f205cc535cfa97bc299f21
2022-04-04 14:24:14 +00:00
drh
be341502db Fix the Bloom-filter optimization so that it does not use IS NULL or
IS NOT NULL constraints from the WHERE clause when operating on a LEFT JOIN.
[forum:/forumpost/031e262a89b6a9d2|Forum thread 031e262a89b6a9d2].

FossilOrigin-Name: 1a6328f2a5b4973094e5f85787145d652119822c86ec01a61f3f985c9d2903f2
2022-03-25 01:23:37 +00:00
drh
75c493f767 Fix the assert() that attempts to verify that the table-reference to
index-reference translator finds all required translations.
[forum:/forumpost/929168fdd6|Forum post 929168fdd6].

FossilOrigin-Name: fa9bd1fce47e8db1cfc4cd8efd2c09f8711ea917ce7d116dc7226c575cb9a6d4
2022-03-21 13:47:15 +00:00
dan
247d09462e Add extra test cases.
FossilOrigin-Name: 0a922d141749cf3ef672f56449001e03f1a7e31822b66dcaf8550bb6e1b88cd3
2022-03-16 19:28:18 +00:00
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
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
fde3043200 Stronger defenses against corrupt schemas in the ALTER TABLE logic.
FossilOrigin-Name: 13fbde28173332522a7ad307c1aad2b83c9aa1fe737583afa2b29f6da4de6370
2022-03-10 21:04:49 +00:00
drh
7931f0a3d8 Only run atof1.test on x86_64 machines.
FossilOrigin-Name: 4173819cd285a1c133645eda27b9f6dc5a2247eaa0c834bdc60058ef3109b102
2022-03-10 11:48:16 +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
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
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
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
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
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
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
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
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
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
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
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
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
larrybr
4c5c6214b1 CLI auto-column rename revamped after forum discussion.
FossilOrigin-Name: 2da1f8e45eb0cb1ead6049df6a31a903bfad5a7abd27e92cd3dac25fe355aec3
2022-02-11 01:21:09 +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
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
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
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
62fc069eb4 Further improvements to localization of errors in input SQL.
FossilOrigin-Name: fa34676042720161ca03f3926814152eb1d144ec12fd2b44e5429408ea4ad5b0
2022-02-06 00:30:04 +00:00