Commit Graph

8832 Commits

Author SHA1 Message Date
drh
c7fc08f69a New FULL JOIN test cases. No changes to code.
FossilOrigin-Name: 13e89ef6649475815d3f4e4aef73a4be1157dd388e55c7f856faeb4b7387774b
2022-05-31 18:18:09 +00:00
drh
aa03c69591 More JOIN test cases inspired by the problem fixed in [3869fd9a2b9483cb].
FossilOrigin-Name: f2d224c5fa06de70f6f22e159a3b7065d4c6b004f9accc13004b9ac1f2fd5549
2022-05-31 17:24:56 +00:00
drh
d69820c42b Many new PG-confirmed test cases in joinD.test.
FossilOrigin-Name: 481e89c764ad8906cd21c8fbe58df57ae40bb3f261fa4892ea7ce7762786ad26
2022-05-31 14:19:04 +00:00
drh
b1f08bc690 Add test cases for
[forum:/forumpost/c2554d560bac97c5|forum post c2554d560bac97c5].

FossilOrigin-Name: e66d5ae86c09cbe581b8f4f1bff33376cc680bba3da24f85384dd6c3eb85ddcf
2022-05-31 10:48:02 +00:00
drh
404bf6bac6 For an outer join, then ON-clause constraints need to be evaluated at just
the right moment - not too early and not too late.  Fix for the problem
reported by [forum:/forumpost/3902c7b833|forum post 3902c7b833].

FossilOrigin-Name: 3869fd9a2b9483cbbf83d8f369c1744abc42f12e63abba402be35dd7e136161c
2022-05-30 17:33:22 +00:00
dan
ca29bbce2f Fix another problem with ALTER TABLE and UPDATE...FROM in triggers.
FossilOrigin-Name: 33cf12235e6469ba17cfb72cef0e480dfd0dea81ed412fb1fb24b05dbeb8dc02
2022-05-27 15:33:51 +00:00
dan
4209d553e7 Fix further issues with ALTER TABLE and triggers that contain UPDATE..FROM statements.
FossilOrigin-Name: 53fbc269ddbabc4a97d297e881e5f9cd2bfbcd24af4af1b7cf9db412a3a51813
2022-05-27 15:04:43 +00:00
dan
b8bbe3e2db Fix issues with ALTER TABLE and triggers containing "UPDATE...FROM" statements.
FossilOrigin-Name: 2fba0d41b781d226915fa2bf888a7bc640c046ce22670ceb53f62a09f3975259
2022-05-26 19:10:11 +00:00
drh
26c4df0fb0 Correct handling of outer joins in the FROM clause of an UPDATE statement
that occurs inside of a trigger.  Follow-on to [98b3816bbaf539ea].

FossilOrigin-Name: 664a49fa813144b6fa5a7ae3f65af5412f150dd5def261c4d581d706b39f7846
2022-05-26 17:33:42 +00:00
drh
724e298e9c Slight increase in the accuracy of log10().
FossilOrigin-Name: c48a735bd4a1dbd541aed5937c25fc0c606c4263d8ee94cae30a06b1a7b26d9a
2022-05-25 13:10:29 +00:00
drh
7bfbd2508c Do not allow the right operand of a RIGHT JOIN to be reordered with other
FROM clause terms that are even further to the right.  Fix for the issue
identified by [forum:/forumpost/5cfe08eed6|forum post 5cfe08eed6].

FossilOrigin-Name: 4be0c60e38edc5d5bfd72bb35a3c91c55240b4e6313a40614beb60f1ab9d9f4c
2022-05-25 12:49:59 +00:00
drh
fb98dac04f An attempt to get UPDATE FROM working when the FROM clause contains a
RIGHT or FULL JOIN.

FossilOrigin-Name: a124e4f96f883d8682ba7a253d33a9565ed0fc3580525225b95733bd3782a806
2022-05-25 02:32:11 +00:00
drh
6af03b469e When an ON clause on an INNER JOIN references a table to the right of
of the join, just convert the ON clause to an ordinary WHERE clause term,
in order to be compatible with older versions of SQLite.  See
[forum:/forumpost/687b0bf563a1d4f1|forum thread 687b0bf563a1d4f1] for details.

FossilOrigin-Name: 2b6ebba26d936ae7b9acf7d4bd15e82cbfabda22e1044b3dd838c7b07095100e
2022-05-24 16:05:41 +00:00
drh
ea488b1258 New test cases to further demonstrate the difference in name matching rules
for LEFT JOIN versus RIGHT JOIN that protect legacy behavior.
[forum:/forumpost/e90a8e6e6fa652ac|Forum thread e90a8e6e6fa652ac].

FossilOrigin-Name: 2c586060a016f5481bad29bfb8f4ac4e1204075afdd0fa1851fbbcf2abda4893
2022-05-23 12:37:54 +00:00
dan
5348fbe332 Avoid treating constant expressions like "? IN ()" or "? NOT IN ()" as integers if they appear in a GROUP BY or ORDER BY clause.
FossilOrigin-Name: d8b249e8cdf0babe1427d0587dbdc27a52ec06a5ef3a20dfb05a0ea4adb85858
2022-05-17 15:01:01 +00:00
dan
07576c3fe8 Fix a problem in test file swarmvtab3.test causing occasional failures.
FossilOrigin-Name: f935c155ef205802c16b4ebea4a3fb01bf5689662b7b4f2af56f0f9021d6d4b1
2022-05-16 16:10:04 +00:00
drh
96d5549778 Do not allow an index scan on an index-on-expression for a RIGHT JOIN because
the index might not be positioned on the correct row when running the
the right-join no-match loop.
dbsqlfuzz 39ee60004ff027a9e2846cf76e02cd5ac0953739

FossilOrigin-Name: 2277f9ba7087dd993ac0f4007c523aa9cf74dba187f53af03d8c164886726fee
2022-05-14 19:05:13 +00:00
drh
c93bf1d462 Improvements to the decision of when to check ON constraints for an inner
join that is an operand to a RIGHT JOIN.  Fix for issue identify by
[forum:/forumpost/c06b10ad7e|forum post c06b10ad7e].

FossilOrigin-Name: 9d17233c7d98bf25c1a518d067e778708b3db6d6302edd8d7e376ba0ba4f1c30
2022-05-14 15:59:42 +00:00
drh
f69dad8c53 Walk back the optimization from check-in [cc458317bd77046c] that tries to
reuse the same ephemeral cursor of a list subquery when that subquery is
reused, as it does not work in cases where the list subquery is used both
for lookups and for scans.

FossilOrigin-Name: 12ee29d632ae4b585ef6bc07d3289d00c121268945dffd5673b251d95874e3f8
2022-05-13 19:50:29 +00:00
drh
f8d2745f99 Corrections to the header comment to the new joinE.test script. Add the
generator TCL as a comment at the bottom of the script.

FossilOrigin-Name: 2f4456f67f64f131fc852ad9a7420eb43b57b879a9bec7e4b295f1dc0d7bfa56
2022-05-13 15:36:47 +00:00
drh
d383557960 New test cases for outer joins. Case joinE-32 currently gets an incorrect
answer.  See [forum:/forumpost/41cc3851d8|forum post 41cc3851d8] for the bug
report.

FossilOrigin-Name: 02b24863e6dc617c9260f79292a96b7c861d088268e77fd17204570515eb792c
2022-05-13 15:31:30 +00:00
drh
d631c6af80 Ensure that ON clauses are applied to the correct outer join.
FossilOrigin-Name: c7e3a13a3288c577209be99c630fbe924e19880e8af1aa8a83b517acaa8b43d7
2022-05-12 11:56:44 +00:00
drh
902e2602c2 Add IS NOT DISTINCT FROM and IS DISTINCT FROM binary operators which are
equivalent to IS and IS NOT, respectively, for compatability with PostgreSQL
and hence standard SQL.

FossilOrigin-Name: db27611e172102483eaede3981d473e3d5bf93d98bc68f480398b1573876349d
2022-05-12 11:45:20 +00:00
larrybr
f4874818a4 Change .echo on effect so that SQL is echoed before prepare. This slightly alters echoed output when multiple SQL statements are submitted at once. Also sync with trunk.
FossilOrigin-Name: c1eff632c41809214edea2850a93852fff66da3ca0dc393e8fe55e0976d422fd
2022-05-11 19:59:31 +00:00
larrybr
51b011d8d5 Sync w/ trunk
FossilOrigin-Name: 1284225b0a8c7b630416be5348e99f7280f6443548ec97ffb1c85be23352b2bc
2022-05-11 03:29:52 +00:00
drh
cc212e4450 Fix a bug in the sqlite3WhereMalloc() routines that were added by
chekc-in [f237e1d8cc41b937].  The bug was detected by dbsqlfuzz
test case 4c5e3e89bc251d28378be88233f531b84ec66901.

FossilOrigin-Name: 764b71267e0b31ff7eaf2a0def7526a1a02dce4d5b456dea060d97ed342efdd1
2022-05-10 23:28:12 +00:00
larrybr
73b7af0437 Make tester.tcl work on more Windows Tcl installations. And sync w/ trunk.
FossilOrigin-Name: d25fbdf8772f1c8283828424b208fc1758c82e9e28e0e52122c87db4af1c672d
2022-05-10 22:32:27 +00:00
drh
825ecf9c05 New requirement marks.
FossilOrigin-Name: e8479e56c615a6eb38b58e6d360bea8528ec14a9d7b0798b95d3eb513bd08f0f
2022-05-10 18:43:54 +00:00
drh
0338f53b05 Fix a stale requirement mark.
FossilOrigin-Name: fcda7fb1f184a31a67572aae15f3cdcd60f8aac199106a7b0f90aca251ca7017
2022-05-10 18:18:45 +00:00
drh
d2b960cf41 Fix a stale requirement mark.
FossilOrigin-Name: 3eda4030f73384abf18b97cd8a4606e10b23e382d1b72dff7526aebfde23e0af
2022-05-10 17:42:55 +00:00
larrybr
527c39de80 For CLI, add ".echo sql" dot-command.
FossilOrigin-Name: 35cef458ca114649ee16e00714d817d57673b96c007454946cc411ae90fd06ce
2022-05-10 14:55:45 +00:00
larrybr
be7777f4a5 Sync w/trunk
FossilOrigin-Name: 536691ed0f76ac37f3d86e4f5b1cff15ce4c011f84cd3452b5b45bafb6bf2522
2022-05-10 06:04:48 +00:00
larrybr
f015a3d19f Cause most shell tests to be run under Tcl suite valgrind config.
FossilOrigin-Name: cd085b36ff777396ac2705c030c1518f8094a70a0b0ba4a628776429524d20f0
2022-05-10 01:11:51 +00:00
drh
f71b8123df Minor STAT4 test case change due to the ANALYZE enhancement of
[eb59c46a5aed69bc|check-in eb59c46a5aed69bc].

FossilOrigin-Name: 8ce2fecb580da53fc01c53d8de10e2cc99499094215429ba925e777717e369b2
2022-05-09 17:55:34 +00:00
drh
77874e782b Simplify a branch in the "*" expansion logic. New test case for an
INSTEAD OF trigger on a RIGHT and FULL outer join.

FossilOrigin-Name: d2717348f43b571c7bb58498e0c723331abf85de174189e66aca2c438ca26d5f
2022-05-09 12:59:16 +00:00
larrybr
2f5f674066 Simplify .import leak plug and arrange for CLI to be run under valgrind.
FossilOrigin-Name: 0d3e2380197aa3e725591266acaeb0d43a7e794ca9153e6c56253cdcf60720b1
2022-05-09 12:29:47 +00:00
drh
c915b9c46f Improvements for name resolution for parenthsized joins.
FossilOrigin-Name: 006b2d9c52201c9e836b649018519acfb47f793f70b968722440f00084e9d846
2022-05-04 18:43:39 +00:00
drh
b2cc3cf36e Merge ON-clause constraint usage fix from trunk into the joinD branch.
FossilOrigin-Name: 0a20d4a85964fb5f2060b9522356ad2711f41d0d526ba3d2e58fc51029878298
2022-05-04 14:46:08 +00:00
drh
11d63ebf2c Fix ON-clause constraint usage for FULL and RIGHT JOINs.
FossilOrigin-Name: 544268a723cafdf0460221f5f018e752836436bad0fac90852cec70e63d9dcde
2022-05-04 14:45:19 +00:00
drh
3b52f80237 New test cases using various join types and Bloom filters. Two cases
differ from PG and need to be resolved.

FossilOrigin-Name: befa8cbc0682bc3269f87e392a1f3d4baacf4db7c716ea84192bb9c13c99490b
2022-05-04 11:49:26 +00:00
drh
eeada07457 Merge Bloom filter bug fix from trunk into the right-join branch.
FossilOrigin-Name: 72131ad1bda3d087e59cd4a51d87f10f65a55e658645397e1ede15f9fb1f5143
2022-05-03 16:26:50 +00:00
drh
8aa7f4d813 Fix the Bloom filter pull-down optimization so that it jumps to the correct
place if it encounters a NULL key.  Fix for the bug described by
[forum:/forumpost/2482b32700384a0f|forum thread 2482b32700384a0f].

FossilOrigin-Name: 6eda9b1a7784cf6d58c8876551f67ab98e78a08e726a0579d4def5ba881985bb
2022-05-03 14:01:48 +00:00
drh
85f93850f7 Merge the latest trunk fixes and enhancements into the right-join branch.
FossilOrigin-Name: afbcf075c1e09ae064c7b16e63501cd1d374711812664aef76bd35d02d64a2b6
2022-05-02 15:10:38 +00:00
drh
7497364749 Simplified fix to the problem with subroutine reuse in the RIGHT JOIN no-match
logic for a subquery on the right-hand side of an IN operator.  The code still
needs simplification.

FossilOrigin-Name: a193749730d6cfba617f2a64e7254c78f92bbf29b109c19055fc33f6cc643d4c
2022-04-30 18:40:22 +00:00
drh
2aa1086cab Preserve the COLLATE operator on an index on an expression when resolving
the use of that expression into a reference to the index.  See
[forum:/info/7efabf4b03328e57|forum thread 7efabf4b03328e57] for details.

FossilOrigin-Name: a8da85c57e07721dc1c918d67433d6c99ce48421e369123cc3194d855e55f7e8
2022-04-30 12:35:51 +00:00
drh
a25bbaf74a Further improvements to codeEqualityTerm() for cases when an IN operator with
a right-hand side subquery is used as a constraint that needs to be processed
by the RIGHT JOIN non-matched logic.

FossilOrigin-Name: bb2798be3fb5737827eec505db2d4c8cb510d227d98fc26ce748bf2da7e8b382
2022-04-30 00:06:52 +00:00
drh
3d5665366f Enhance the codeEqualityTerm() routine inside the code generator so that it is
able to reuse an IN operator that has an invariant subquery on its right-hand
side while coding the non-matched loop of a RIGHT JOIN.
dbsqlfuzz 19f1102a70cf966ab249de56d944fc20dbebcfcf

FossilOrigin-Name: 56dd3065469e49320b13af039471b3f0b85e6f7368cfd97b1cdc0cf8fa8e1956
2022-04-29 19:00:11 +00:00
drh
4bea8c6b56 Tweaks to the name resolution on parenthesized joins. A small number of
tests fail now due to extra columns appearing in the expansion of "*".

FossilOrigin-Name: c86804917e3fffcf0c19bbf11875667f7968275210fc768e650826bd9c87a5d2
2022-04-28 17:35:58 +00:00
dan
5487cdcc0a Update corruptL.test so that it works with SQLITE_ENABLE_OVERSIZE_CELL_CHECK builds.
FossilOrigin-Name: b1bec72043f798f4d4d30e6b60a45ed4dc521115c8a9f97bb8228e3f089deefb
2022-04-26 19:16:11 +00:00
drh
a9cdb90421 Fix a problem with automatic indexes introduced by
check-in [664b461bb5063d980] and reported by
[forum:/forumpost/0d3200f4f3bcd3a3|forum post 0d3200f4f3bcd3a3].

FossilOrigin-Name: 7ca3456c00998a429418ff29cf251b381586b330b88344c94a40c5df0b71da85
2022-04-25 19:40:33 +00:00
drh
ecb386b71f Prevent the ORDER BY LIMIT optimization from running if the innermost loop
is a right-join, as doing so will get an incorrect answer.

FossilOrigin-Name: 3aefc874d31885c64a5e02868edb2aa56a2b4429252d494e67e4088a9298ce5b
2022-04-23 19:21:47 +00:00
drh
da653b897d Improve EXPLAIN QUERY PLAN output and comments on bytecode listings by
distinguishing between "subquery" and "join" and using consistent names
across EQP and bytecode.

FossilOrigin-Name: a2d3ee92420ec564e31eb0005367cf7ff3d00bfaed5a98ffdbe17c91c95d9d97
2022-04-22 17:36:10 +00:00
drh
67f70bea06 Honor the MATERIALIZED keyword on a common table expression by not flattening
the CTE into an outer query.

FossilOrigin-Name: 8d631a6b9eb06b54b10eda595a4c588ca38f909b4afa653b24d1f720b55d72f7
2022-04-22 16:15:48 +00:00
drh
1c69bc912d Previous fix to join8.test needs a return.
FossilOrigin-Name: 7b4cd705a0339ddacad19564b07e50e4f68f54bf14dd2cd5d59b39314a4d2523
2022-04-21 23:34:35 +00:00
drh
abb4e7598c Disable join8.test if the build lacks support for virtual tables.
FossilOrigin-Name: 94e1916a2f594e6b8a54734027deb99688244d05cefb3c78f23afab49af1e08f
2022-04-21 23:01:24 +00:00
drh
11140addbb Add support for RIGHT and FULL JOIN.
FossilOrigin-Name: f766dff012af0ea3c28a8ce4db850cd0205729a8283bce1e442992aded7c734b
2022-04-21 19:38:17 +00:00
drh
503ad9c72d Make sure the code generator knows to invoke row-value subroutines which
running the right-join post-processing loop.

FossilOrigin-Name: fd328e52aee1dace12b1c2f44b6f7e9d15d8f77c8e9d9e3d85840a129a4b1808
2022-04-21 14:48:40 +00:00
drh
825a6bffc4 Ensure correct fg.isNestedFrom values even on crazy parses.
FossilOrigin-Name: e611e8e62c948d28cd3f28452d3096bab06998a685ed9434061cc2054f5cac32
2022-04-21 14:08:29 +00:00
larrybr
6403e77d3b For CLI, fix how columnar mode fills in empty portions of wrapped row outputs.
FossilOrigin-Name: 77aed89192bdbad819ac17bf5d08728278a9b8cbbbef1d805df230caff79b417
2022-04-20 22:41:10 +00:00
drh
e60ffa3350 Merge window function fix from trunk.
FossilOrigin-Name: b6b9e185f8c44b5f2f51111f7c5e4e2d77c8b853c5be271467ce138e8066340c
2022-04-20 16:54:47 +00:00
dan
41150bf35b Fix a problem with using multiple SQLITE_SUBTYPE function as window functions in a single query.
FossilOrigin-Name: 9430ead7ba433cbfce99f4f364a0c08499230e3a04f167326b0f131f098ffa09
2022-04-20 16:42:57 +00:00
drh
befbb40f44 Merge the ALTER TABLE fix from trunk.
FossilOrigin-Name: d5ceaef3fca8cb4791ead9cbfe00d0eafa1bdc2b0522c3599c68b40fe6a7efe2
2022-04-19 23:00:32 +00:00
dan
cbde37d8e4 Fix a problem in ALTER TABLE with handling "table.*" expressions within SELECT statements in triggers.
FossilOrigin-Name: 24755fd0657252e49793bb1fe906973a2dd84a1bde03bea9a762de36cc96c2d2
2022-04-19 20:47:18 +00:00
drh
de75638b33 Add 512 new join test cases derived from PostgreSQL output.
FossilOrigin-Name: 78d58e461f99366d2749ccd6d02ab4cba0cab20bb80c097e7128da1e50303549
2022-04-19 15:01:57 +00:00
drh
d737b16f92 Add the omitted "finish_test" to the end of joinA.test.
FossilOrigin-Name: 0907505cc9bb051280108fe5074211374b31836fae1ae6667a3de69f9d83fc01
2022-04-19 02:03:18 +00:00
drh
3b8c7545df New test cases for RIGHT and FULL JOIN.
FossilOrigin-Name: 5c2f670e0fb35648e1d6e1c48f4d8af815cd57d59eac6ba22e253511bb078870
2022-04-19 00:24:52 +00:00
drh
1c2bf41a12 Fix the query flattener so that it does not flatten a RIGHT or FULL JOIN into
any position of the outer query other than the first.

FossilOrigin-Name: 837322aa95b1c46201b7dd0c2e6c7b9915b4276d997949f1ecf961fb7f3514cf
2022-04-18 23:20:02 +00:00
drh
ec39c96473 New test cases, including one that gets a different result than Postgres.
FossilOrigin-Name: 49ea11a4a5fd630db44f458304d4f45fa103529ed6b36d538c78074965e8d799
2022-04-18 22:51:24 +00:00
drh
7466d5665a Even more test cases.
FossilOrigin-Name: 5f4310a104443ac3fc56f9d9cd2d428dd3e7a2a0285c8e74de6f499439fd6868
2022-04-18 19:34:41 +00:00
drh
23f240b325 New test cases for parenthesized NATURAL FULL JOINs.
FossilOrigin-Name: e34250efd34b526373bf072a43a7984ca19690836d7d2464dea8338066eaee8f
2022-04-18 19:28:08 +00:00
drh
a20922cb20 New test case demonstrating the ability to invoke OP_NullRow on a cursor
that has never been opened.

FossilOrigin-Name: d173edc242f295f5812a58cad184695881d9b1b160cd5b25e303e22848e90ce1
2022-04-18 18:01:38 +00:00
drh
25f2ce6e71 Merge the btree bug-fix from trunk.
FossilOrigin-Name: a333c0b50c3af7cd818470a647d78c7c691ef15418ec7cffe80dd88405393069
2022-04-18 16:23:01 +00:00
drh
2e1bcc9dd0 Fix problems with WHERE clauses that follow multiple FULL JOINs. This
introduces some new faults in the tests, probably due to something
unrelated.

FossilOrigin-Name: 95b242d4c2fed7c713299565ac1010f8a7534a5695589e87d5a0204c7bf5f3dc
2022-04-18 16:10:07 +00:00
dan
1942d1f236 Avoid an assert() failure in allocateSpace() triggered by a corrupt database. dbsqlfuzz f022eb0ce64d27808574d1dcde5cf7d002dabde8.
FossilOrigin-Name: 2de7f8cc7fe18f0828bb53f1fd11f5eb828faf4d6dfaf39693dff4f8926c1c7a
2022-04-18 15:56:58 +00:00
drh
41db500274 Merge the latest fixes from trunk.
FossilOrigin-Name: 1ba3b3ccf145d84fa75afabe2fa925f65e43f815b25b15bd60073a41aa97bf57
2022-04-18 14:41:24 +00:00
drh
01a6c16e0c New RIGHT JOIN test cases, one of which is currently failing.
FossilOrigin-Name: 9168cbbedd1c9d735279295a78212d830e24269f6d7e445e71faa2c06973223d
2022-04-18 13:08:17 +00:00
drh
a1848a5d22 Change the row-value initialization subroutine call from within the
right-join body subroutine from an issue to an optimization opportunity.

FossilOrigin-Name: 829d49f27c041651ffeadc1397e4dd87a9994c9290e13b93542dbd2c514769cd
2022-04-18 11:22:46 +00:00
drh
d875c7eefe Do not allow an empty table bypass to jump outside of a right-join body
subroutine.

FossilOrigin-Name: 1549dcd2353903b70abadd428eeef971ab940df04fb05a6b83b04ee30932db6d
2022-04-18 10:26:50 +00:00
drh
6fda176ba6 New test cases, one of which is failing, indicating a bug that needs fixing.
FossilOrigin-Name: bd5fd68435ff068c18d7d46b33cf7591263a03c32a917a7df7c087b08c573cc8
2022-04-16 23:38:29 +00:00
dan
b192970809 Fix a problem with "ON DELETE RESTRICT" and "ON UPDATE RESTRICT" foreign keys in attached databases scanning child tables in the wrong schema.
FossilOrigin-Name: 04d5b637f087520cd58211505f9b5c086ff96d864a1908f60464b6fe22c62b7d
2022-04-16 15:46:23 +00:00
drh
977eef6cdc New test cases. One of the new test cases shows a flaw in the base design
of RIGHT JOIN.

FossilOrigin-Name: 4c3ce6475a67b1e207a5b63d9e2d38ee5bc45c899ad00ee327f292bf59039b9c
2022-04-16 13:55:48 +00:00
drh
bdbda1eb1f RIGHT JOIN USING now appears to work the same as PG-14. Legacy tests pass.
FossilOrigin-Name: 5bfb862419541de955dae35fc91f6e9fc70e2744bb786d49fa26bede80b9091d
2022-04-16 12:40:52 +00:00
drh
a51379ad78 Record the three known big issues with the current RIGHT JOIN design in
the join8 test module, with tests that deliberately fail in order to remind
us to fix the issues.

FossilOrigin-Name: 2c4ee723f4d0591d09776adfb82246bfa89153ab390b8b3f1878d1cdc43d68c8
2022-04-14 20:43:22 +00:00
drh
f7309bce10 Ensure that the JT_LTORJ bit in the SrcItem.fg.jointype is preserved during
query flattening.

FossilOrigin-Name: 61259050152321bc57dbdfdc3edcabb4f18c021b1ee0491c1e04ae24c7a59d89
2022-04-12 20:20:54 +00:00
drh
0879d5f9e0 For the bad join type error message "unknown or unsupported join type"
remove the "or unsupported" clause, because we now support all valid join
types.

FossilOrigin-Name: ab0a0562dd3594cf50ee56f6b3a5847fa5dcadf69146d560e3e7a95651b8f405
2022-04-12 18:40:14 +00:00
drh
ec27077c4f New test cases added.
FossilOrigin-Name: bdd1499c0fa4f8aadf4857a0ccc0d839c250369f29766ebef80330964905e63b
2022-04-11 18:54:23 +00:00
drh
6134b2dff2 Fix handling of "continue" and "break" from inside the loop for the right
operand of a RIGHT JOIN.

FossilOrigin-Name: b6e773a26c2c6ee76ea61acb059b4e676d07ea62f6db9c513638f8986557cf04
2022-04-11 17:27:38 +00:00
drh
ff02ac7f07 Do not attempt the LEFT JOIN strength reduction optimization on a FULL JOIN.
FossilOrigin-Name: 7ef3e99a73d70405a185d5d31f2d97d3bd99568fd6f10941e75d6c0baa27dc4f
2022-04-11 14:43:11 +00:00
drh
c583719b65 Show LEFT and RIGHT JOIN processing in the EXPLAIN QUERY PLAN output.
FossilOrigin-Name: d91faeffea5cf0585fb71e5311fdcc6b8be85c7e9c732050b4448e617c970101
2022-04-11 14:26:37 +00:00
drh
37259f4e6b New test cases.
FossilOrigin-Name: d5f6791b86f946b348f5ddc9cedc0df4a86b17854a97554140799caf74c602f3
2022-04-11 13:13:57 +00:00
drh
3a6e4c59c4 Make a distinction between (1) WHERE clause constraints, (2) ON/USING
constraints on outer joins, and (3) ON/USING clause constraints on inner
joins.  Formerly, there was no distinctionb between 1 and 3, but RIGHT JOIN
needs to know the difference.  Make RIGHT JOIN aware of this difference and
add test cases.

FossilOrigin-Name: 0f6f61c3664cc87209c2a6f9b6df3a750d1510723fcde209c33db8feaf48bcf3
2022-04-11 12:38:06 +00:00
drh
189c065942 Merge the Expr.w.iJoin name change from trunk into the right-join branch.
FossilOrigin-Name: 29927926eb32acd963e2c496ad67d55177615ec4150fd218afaf2f9a730cabec
2022-04-11 11:48:17 +00:00
drh
41798d5bbc Do not allow query flattening nor the push-down optimization on the
right operand of a RIGHT JOIN.

FossilOrigin-Name: 5aa0c9ea9cf53c13bf266278b479b2e7af3aa5c6b144bd49ff155a4eb3c23c96
2022-04-11 00:21:53 +00:00
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
larrybr
039132be20 Fix .import bug reported at https://sqlite.org/forum/forumpost/14db09d7e765b819 . zAutoColumn made to deliver characters, not bytes.
FossilOrigin-Name: 21e96600d90c1cda84777abe22a11058eba46c9faefeb05f8c31bc0e7fa84b19
2022-04-09 18:51:49 +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
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
bcd60d20a3 Test case for permissive ALTER TABLE RENAME when writable_schema=ON.
FossilOrigin-Name: 7ee44f66c896cdc7b6980811e8e4537dbd63b23060ead0104f25132d955890af
2022-02-04 20:16:00 +00:00
drh
0fab10991b Add a compile-time option to include vt02.c in fuzzcheck.
FossilOrigin-Name: c404c8c72600c11b181519d269bf949aff304eaafb90a50d1415c6fe84d2b092
2022-02-04 19:13:18 +00:00
drh
5a80050dd3 Allow ALTER TABLE RENAME COLUMN to proceed even if there are errors in
the schema, as long as PRAGMA writable_schema=ON is active.

FossilOrigin-Name: 197cbabf1767d0603928462fb75cf8100f6999f725e0db60d096c7ca20e3da28
2022-02-04 16:43:30 +00:00
drh
02e3e04134 For the MULTI-INDEX-OR optimization, when pushing down WHERE clause terms from
the main query into the various OR-term subqueries, do not push down slices
of a vector comparison, since the right-hand operand of the comparison might
have only been initialized in a different OR branch that was not taken.
dbsqlfuzz 80a9fade844b4fb43564efc972bcb2c68270f5d1.

FossilOrigin-Name: 9f67ad00cd38b7c5ec6d14b379e1a611777bbdf6901d843a80712ba7d94d6d33
2022-02-04 13:05:29 +00:00
drh
cc0db61364 Additional test cases.
FossilOrigin-Name: 733d81c3a6a513b0b893a7d14894f36aebbbca9da375c326db8a72df4f0c6238
2022-02-02 19:30:24 +00:00
drh
d96ab99588 Test cases for sqlite3_vtab_in() and sqlite3_vtab_distinct().
FossilOrigin-Name: 21afb81d0a73af39aacd9329b1441faa2b535a52a52036daec89fd303a8b344f
2022-02-02 19:15:53 +00:00
drh
ca1776b5f3 CLI: Add the --ww option as an alias for --wordwrap. Improve the wordwrap
algorithm so that it breaks at punctuation if it cannot find space.  Always
wordwrap with --ww even if there is a .width setting for the column.

FossilOrigin-Name: 1b528e31f8c62797e0814568b520c0680ff23a2ee877ca6aa70a167d40ebdf80
2022-02-01 12:28:17 +00:00
larrybr
cc4d55c9cb Add "--wordwrap on/off" option for CLI columnar modes, qwbox shortcut
FossilOrigin-Name: 10dbc278708cd2cce7fef90738082dbe31750d93e44b5fa5413a9a32dae7703a
2022-02-01 02:50:45 +00:00
drh
87fb37efce Do not attempt to limit the number of columns used in a table to a prefix
if the table will be used to construct an automatic index or bloom filter.
dbsqlfuzz 787d9bd73164c6f0c85469e2e48b2aff19af6938.

FossilOrigin-Name: f8766231d2a77bb8b95726b514736d4c2d20b056f7fe60bdbc98ebf5e5b15ae9
2022-01-31 15:59:43 +00:00
drh
e40f28618c CLI: Enhancements to columnar output modes. (See
[forum/forumpost/5b53cd851f66441f9|forum post 5b53cd851] for discussion.)
New output mode "qbox".  New output options "--quote" and "--wrap N".

FossilOrigin-Name: 539cef5214446a7181614793e9cf323e95ba00ba0f888585b14b598dd2ff0808
2022-01-31 14:14:29 +00:00
drh
92ecf306ec Fix an obscure problem in sqlite3_backup_init() caused by
[6a45d8fe8bfbc11a|check-in 6a45d8fe8bfbc11a].  See
[forum:/forumpost/8b39fbf3e7b5c278|forum post 8b39fbf3e7] for
the original bug report.

FossilOrigin-Name: 639fc7633bd740421d6b48617b9f68e6be525107e4049673fe720ea6158a393f
2022-01-31 12:29:14 +00:00
drh
e229ca0307 Always enable all JSON tests, now that JSON is included by default.
FossilOrigin-Name: 8c9f350182140604a71e11d226acb3f80d1f2b4f75e5c3b55ec8f8a7c02941f3
2022-01-30 11:44:17 +00:00
drh
ddd166a350 Remove a faulty NEVER(). Fix for dbsqlfuzz 4678cf825d27f87c9b8343720121e12cf944b71a
FossilOrigin-Name: d4e402458dd4cadb623a30158eb9ff5f24f011240b3b1bc5b1d6ae3c5b855892
2022-01-30 11:42:56 +00:00
drh
4b51e8bd68 Enforce the restriction that 'unixepoch' only works as the first modifier
after the time-value.  This has been documented since 2004, but has never
actually been enforced before.  Also add new test cases for date/time
functions with evidence marks.

FossilOrigin-Name: 64fa9e8c87179211cec248e6dfd7578502e6e969a19e91a4f0e21ed9b972a6bc
2022-01-27 13:52:01 +00:00
drh
a2417ec75c New dbsqlfuzz cases added to test/fuzzdata8.db.
FossilOrigin-Name: d1fbf63330830c4b9549d0e67f6cdc19fe7a9dc3fcf509795fd1175499fddc82
2022-01-24 20:20:35 +00:00
larrybr
b5d4473221 Fix testcase for CLI .read recursion.
FossilOrigin-Name: 53d4404458fb6f0b6b2b69c2225d66b39f09099c356ba3c3e990474f14aba31a
2022-01-24 14:01:31 +00:00
larrybr
d48e88e56d Limit CLI input redirect nesting
FossilOrigin-Name: 7a073931752d16ba71f1a606091461e427ca5ccf4d135d3c5141bfdd4e67e2d5
2022-01-24 06:36:16 +00:00
drh
68dc8151e0 Bring sqlite3_vtab_distinct() up to spec so that it works as described in the
documentation.

FossilOrigin-Name: 4289edf3c5e32a05b51f232020099b33f6f5e79b0ceca2b96baf1186168d9af6
2022-01-22 20:45:57 +00:00
drh
ec778d2724 An initial attempt to implement sqlite3_vtab_distinct().
FossilOrigin-Name: d571262d2345bb11e71bef395cf078e5d7303b974b38b4e319adda6194ccc1c5
2022-01-22 00:18:01 +00:00
drh
4d7f335e8b Update evidence marks for the latest changes to the documentation.
FossilOrigin-Name: 19247e919fab9748cae561cb12c4c3c106064390a37e32e724d9a9066cfaff8e
2022-01-21 19:26:18 +00:00
drh
a1c8151bab Fix some of the new date/time function features to comply with the spec.
Update requirement marks.

FossilOrigin-Name: 2f5dc7a9eed89baf6814e9e123354b262c806c853dee1243c93286c564b9aba8
2022-01-21 18:57:30 +00:00
drh
e482fde6ee When computing a vector to be used as a key for an index lookup, do not
check for NULL values and abort until after all key values have been
computed, in case one of the later key values involves some initialization
that is needed by a LEFT JOIN.  Fix for the problem identified by
[forum:/forumpost/ab95010d410a0a55|Forum post ab95010d410a0a55].

FossilOrigin-Name: 4db5217a28ce767fa14ddfe51cf3ca25eceb72079d46a2fc00f7d6b8ae9abe0b
2022-01-21 16:41:11 +00:00
drh
991d1085e3 Add requirements marks and tuning.
FossilOrigin-Name: ac951490fd7d5864fe422a80ee8557478e823e79461bec2ee538f57b6733eb5a
2022-01-21 00:38:49 +00:00
drh
bd3a247c73 Test cases for sqlite3_vtab_rhs_value() based on the qpvtab extension.
FossilOrigin-Name: 577d3d66558368c34acab8a9e552957cf3fa054c348f1383a9121de6e8b281b7
2022-01-20 19:00:48 +00:00
drh
d6b44ec32a Fix the ability to read read-only WAL-mode database when -shm is present,
([00ec95fcd02bb415|check-in 00ec95fcd02bb415]) so that it works
for the case of 64K page size.

FossilOrigin-Name: f426874e005e3c23e8a00083b7c201408e072bca413e52bfc436da6483afb0cd
2022-01-20 02:04:53 +00:00
drh
29a7bbffba Fix a test result for alterauth2.test due to the recent fix to authorizer
calls for ALTER TABLE DROP COLUMN.

FossilOrigin-Name: e799a35f2bf85ce43b476738bfbd9b6b378bbf02fa0708dda0deba71dd37f608
2022-01-19 18:31:43 +00:00
drh
85b70e009f Fix ALTER TABLE DROP COLUMN so that it invokes the authorizer. Fix for
[forum:/forumpost/fd82b85947541dec|forum post fd82b85947541dec].

FossilOrigin-Name: aca6c61d79215519fb006af19d9011029df68f195a4ce65aff7a1bf4e36efb94
2022-01-18 16:16:32 +00:00
drh
1f3366cd68 Allow an "IntReal" value to count as a REAL when checking types for
insertion into a generated column on a STRICT table.
[forum:/forumpost/fa012c77796d9399|Forum post fa012c77796d9399].

FossilOrigin-Name: 1ec44d55da2ced1a1b0b78b489caff628652464f5709ee827e35409eb20ea794
2022-01-17 23:37:25 +00:00
drh
7d44b22d45 Fix test cases so that they all still work even with -DSQLITE_DQS=0.
FossilOrigin-Name: 4883776669ee2f2310ea82b0d6df4d008eebaa7cb252102539cf21a635402ebb
2022-01-16 19:11:13 +00:00
larrybr
738d7b9fc0 Add --schema S option to .import
FossilOrigin-Name: 38d9dbca166078013a44214c88805fc7cca578976ceed9fc62f5159a38ec96a7
2022-01-13 21:22:54 +00:00
drh
8efc6a8c09 When the result of a subquery is to be stored in a register and that
subquery has an ORDER BY clause and an OFFSET, NULL out the destination
register before starting the ORDER BY so that the register will be set
correctly even if the OFFSET is larger than the number of output rows.
Fix for the problem reported in
[forum:/forumpost/0ec80f12d02acb3f|forum post 0ec80f12d02acb3f].

FossilOrigin-Name: 9282bcde301cee2a5c3c068b5b0b7ce992c155ece894413a6a9a51a81e4133fd
2022-01-12 20:31:14 +00:00
drh
d83c90bd63 Implement the new PG-compliant versions of the -> and ->> operators.
FossilOrigin-Name: 39eff3b9bf1f318d3606d8e5361a2adb2ba8bc1ca2a436ce4f9a204aa4cf20dd
2022-01-10 15:43:13 +00:00
drh
cd379b8a53 Merge trunk enhancements into the json-in-core branch.
FossilOrigin-Name: ea755771699dcbffe0ddfd204d42fae9b6e79e107485c725b8eb6caab92aacb8
2022-01-09 19:36:39 +00:00
drh
6bcd58572b Add function format() as an alias for printf(), for compatibility with other
systems.

FossilOrigin-Name: 68bffc612c467b2419bf5fe85a8ca16b787003e0e8c11f7c051a879f5865b847
2022-01-08 21:00:38 +00:00
drh
a3f51d7b3e Reverse the meaningn of -> and ->>. ->> raises an error on invalid JSON
but -> does not.  This allows ->> to behave the same as PG and MySQL.

FossilOrigin-Name: 85f8170555ee0d4d28cb7e120a7062e9f64c331a936fdfa29fc0e67224eea7c6
2022-01-07 17:26:40 +00:00
drh
9956c18a81 Change the -> operator to use json_extract(). The ->> operator continues
to use json_nextract().

FossilOrigin-Name: b4c8a62381755b9f1447e10ab95df7209eebda91f9a4583ef1c093a13f6b4725
2022-01-07 17:14:35 +00:00
drh
338b1fde62 New json_nextract() function that works like json_extract() except that it
returns NULL instead of raising an error if the first argument is not
well-formed JSON.  Or if the first argument is not well-formed JSON and
the second argument is '$', then return the first argument quoted.  The
"->" and "->>" operators are converted to use json_nextract().

FossilOrigin-Name: dc00f5286d26524b149de071490320afaa203fec5777b3eb813f07963614861a
2022-01-07 17:08:48 +00:00
drh
a4e4e18494 Add the json_ntype() SQL function. Works like the 1-argument json_type()
except that it returns NULL if the argument is not well-formed JSON, rather
than raising an error.

FossilOrigin-Name: ed9956f5ddca68141eded81d5362847db603257329801622c4eb3b0732112f14
2022-01-07 16:03:00 +00:00
drh
12b9fa979c Accept abbreviated JSON Paths on the right-hand side of the -> and ->> operators.
FossilOrigin-Name: d15410900dccbb7159683c29f640fa321b1e019718827334f5fefe89da623008
2022-01-07 15:47:12 +00:00
drh
d5326c333f Add new binary operators "->" and "->>" to the parser that evaluate to
2-argument SQL functions by the same name.  Add new "->" and "->>" functions
to the JSON extension that are aliases for json_extract().

FossilOrigin-Name: c4e4e3a3fc5da0381ccb7930706e57d7831d87f9c63bafe49ae64117701e1cfe
2022-01-07 14:58:47 +00:00
dan
c6977c1c0d Fix an assert() failure that could follow an OOM when coding a RETURNING trigger. dbsqlfuzz case 5d3e2438f15dc32b473d9f29413157857efa1212.
FossilOrigin-Name: 7ae596dd4a73a09585c5dc9f4faf75d126d0733fc2fb32c1de64126a1088d967
2022-01-05 15:54:02 +00:00
larrybr
d0a9a46215 Test .mode quote blob output
FossilOrigin-Name: ef4dcd1080241a62a50eff28ef12c49da0116032f10843aaf048ae7ad3cdfd0e
2022-01-03 19:33:44 +00:00
dan
0f42f71da2 Fix an obscure problem with releasing savepoints stored in an in-memory journal that could cause subsequent savepoint rollback to fail.
FossilOrigin-Name: 73c2b50211d3ae26aeb89976ec7b9fcd7de9f152b283ec7d0809ad18bddc603e
2022-01-01 19:29:50 +00:00
drh
3ea82384ea Remove an obsolete assert() statement that no longer does anything useful
and which is not always true.  Fix for PoC #1 of
[forum:/forumpost/b03d86f951|forum post b03d86f951].

FossilOrigin-Name: c76a4c0b3cb625017ba09c8bccfcf1b5826df6873f1d3705d3345716079d5ec9
2022-01-01 17:21:55 +00:00
drh
3907560848 Fix a faulty assert() statement - adding a CORRUPT_DB term - based on a test
case derived from [562805cf488a455c].  Also add a test case to that prior
issue.

FossilOrigin-Name: 0dd6b5fccd554ebe4c0b081601863acd7b6ea81b51e14b508b23244f2a570e7e
2022-01-01 12:26:01 +00:00
drh
66306d86ab When a table has an INTEGER PRIMARY KEY ON CONFLICT REPLACE and some other
uniqueness constraint, and it participates in an upsert on that other
constraint, ensure that code that checks for conflicts on the INTEGER PRIMARY
KEY is well-formed.  Fix for the problem reported by
[forum:/forumpost/06b16b8b29f8c8c3|forum post 06b16b8b29f8c8c3].

FossilOrigin-Name: 2f09b51b1ff37bf98f958564cc1224968caa7e33147e6666b5c1ba20b2a7813b
2021-12-30 02:38:43 +00:00
drh
38cebe07bb When implementing a multi-way compound SELECT using merge, try to balance
the merge tree.

FossilOrigin-Name: bb8522fe0dc54282ec13672eba9b44ee08f9cb55c1663f1699a61bf96ec1fd04
2021-12-30 00:37:11 +00:00
drh
092ba22cca Minor changes to shell1.test test results to account for the new feature
of the shell that points to the specific part of the input line where the
error occurs.

FossilOrigin-Name: d4870c08893ea9984b1fa1c3a7d04893ad5ed4a2130e9287d169a306cc8ef0a4
2021-12-29 13:32:36 +00:00
drh
41584df573 Ensure that the affinity of columns is honored in the RETURNING clause.
See [forum:/forumpost/e0c7574ab2|forum post e0c7574ab2] for the bug report.

FossilOrigin-Name: 4711fb69547f4f17653ab116030c32fdcc2c836410349d1d025866ffc15704da
2021-12-29 04:31:54 +00:00
drh
6e627c44de Fix windowC tests to specify little-endian or big-endian UTF16, for
cross-platform portability.
[forum post 559b84a5c6|forum:/forumpost/559b84a5c6]

FossilOrigin-Name: adf3a1e6f7575964e467f6813ff980e802cf5a37aaa9e1736af702c493f276b1
2021-12-16 19:50:02 +00:00
drh
a91734894e Give the correct prefix to tests in the windowC.test module.
FossilOrigin-Name: fb43456324c26879767b08febf1b5a2b46a289f25398a3872f81d845afd5d84e
2021-12-16 19:43:16 +00:00
drh
aca5e49caa Fix a typo in the result of one of the new test cases.
FossilOrigin-Name: 4d02a129c4781c97981748f3c69564e1320d8085dfba4c207e54793390cd64ab
2021-12-16 17:21:34 +00:00
dan
2999068d2c Fix fts3 and fts4 so that they can still be used even if the other is dropped by a call to sqlite3_drop_modules().
FossilOrigin-Name: a0a8d6c9f0e91996003626e4f80dfac278e3c5bddd9ace5d442061e6c95e49dc
2021-12-16 15:29:49 +00:00
drh
52576b78f6 Enhance the virtual table query planner so that it is able to deal with
ORDER BY terms that contain COLLATE clauses as long as the specified
collation matches the virtual table.  This is especially important for
UNION ALL since a "COLLATE binary" is added to ORDER BY clauses if no
COLLATE clause exists in the original SQL.

FossilOrigin-Name: 5c3d398d20b86a1558720e995eddf11403aec2d160590571fa9525fe8f6efff9
2021-12-14 20:13:28 +00:00