Commit Graph

24373 Commits

Author SHA1 Message Date
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
361e0ede47 Add in a VdbeCoverage() macro accidentally omitted from [d64ae49a1f251317].
FossilOrigin-Name: 18b5cea0392a28f694b8931a80e93518f8d3d297d787fa44d1544e373f76838e
2022-05-25 11:17:13 +00:00
drh
ddcdf0b0dd Fix the UPDATE-FROM logic so that it works the same as PostgreSQL when the
FROM clause contains an outer join.

FossilOrigin-Name: 98b3816bbaf539ea745456e1c0064e47d2903d33ee0ceb029bdb97d56fcde937
2022-05-25 11:09:07 +00:00
stephan
26542e722b Got the sqlite3-api JS bits wrapped up in deferred-load module. Whether that's going to be easier to use, in practice, remains to be seen. Consolidated two of the test-related JS files.
FossilOrigin-Name: dd83cc05f2522d221641807dd66b33df48ac9264f27e5b6f63f312084f109801
2022-05-25 08:51:07 +00:00
stephan
e599cc427f Renamed EXPORTED_FUNCTIONS.sqlite3 to EXPORTED_FUNCTIONS.sqlite3-api to avoid any potential confusion about that file (not) being an sqlite3 database.
FossilOrigin-Name: 3d6245c6f9f2ef4ca6746639d300cc5795598b119034439dfed671de3da638fb
2022-05-25 04:38:35 +00:00
stephan
085c5c6b43 Add the ability to import/export db files into/from fiddle.
FossilOrigin-Name: e0c30438a4f1372afb93a0488bae17b3f85d535717b215f494a83ae909871d2c
2022-05-25 04:35:22 +00:00
stephan
d0b22b81c8 Further minor cleanups and docs in the fiddle app and worker.
FossilOrigin-Name: 199e01799dfa48e3fddafb7f2ae5360604150a44186d5c5a977e158ad8e7e657
2022-05-25 04:20:08 +00:00
stephan
79669c25c4 fiddle: refactored so that it no longer exposes any global symbols. Doing so with the main sqlite3.api module will be much tricker.
FossilOrigin-Name: cd227be805d0cd4b6e3c72ed0992ad3aec3db9c366909d9d82c6d3a29009c6eb
2022-05-25 03:08:22 +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
stephan
80bf86967f fiddle: added support for exporting (downloading) the current db file. To do this we had to fall back to named dbs, instead of defaulting to an in-memory one, but the virtual filesystem is an in-memory FS, so the end effect is the same.
FossilOrigin-Name: 7c7fd34c8a05832a3973aaffe696250cb4d2a0b1646c9bfbe83970daf33cd817
2022-05-24 22:16:12 +00:00
stephan
de1e02ee52 fiddle: initial work on loading a client-side db file. Works but requires some cleanup. Export is not yet implemented.
FossilOrigin-Name: 0fa8378c006fcf2311772d36cf2e3c2cd8e8648f671de89ee9832e2e1a06ef49
2022-05-24 19:01:21 +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
stephan
73c6ad1920 MoUse re descriptive var names in ext/fiddle/Makefile.
FossilOrigin-Name: 2f9a42fb141d386f6edd03a37da3b0cef63dcc9fbfd076076b5330a8aa7d45a8
2022-05-24 14:45:16 +00:00
stephan
400ee2ecef fiddle: lots of generic refactoring, restructuring, and cleanup in the higher-level code. Added push-fiddle ext/fiddle/Makefile target to push the fiddle app to a remote server via rsync.
FossilOrigin-Name: ed19fef3459499abb0a4a010f368b4576d6e068d930c8480446ea677ac87c1c1
2022-05-24 14:36:45 +00:00
stephan
2f6a729d55 wasm/JS: minor doc updates, corrected bind()ing of the undefined value to behave as documented, removed some superfluous code.
FossilOrigin-Name: 526c8c728019b317624a93f6f07840ca524bca84e7c03ce5e86e38953146236f
2022-05-24 01:15:21 +00:00
stephan
64f0e9376b wasm/JS: documented DB.selectValue() and corrected the fetching of NULL columns via Stmt.get().
FossilOrigin-Name: 70f91fab825d365f505750acdb8d3ae532880c4cdb64d1e61bb21b24a115958b
2022-05-24 00:35:18 +00:00
stephan
a240a24ad0 wasm/JS: added support for scalar UDFs. Fixed a deallocation problem with bind()ed strings/blobs.
FossilOrigin-Name: 325a9ee31ad7abae563c4da5cd8228e151b00aa9afcac7e9bca5efaa9d48e107
2022-05-24 00:22:10 +00:00
stephan
e145136a4e wasm: minor refactoring and doc updates.
FossilOrigin-Name: 6044605b2a712da73600cabb967797a03ed1915dc0ab0b10edbd52525e548196
2022-05-23 19:38:57 +00:00
stephan
325b56b504 fiddle: cleaned up and documented the status-loading progress mechanism in prep for reusing it in the sqlite3-api worker.
FossilOrigin-Name: 107e3497869d757265f2a4235082bf324ba1220075d1096c2a82021a5d348a6c
2022-05-23 16:54:18 +00:00
stephan
dc5888e04a wasm: added missing 'use strict' and fixed an undeclared var use caught by that.
FossilOrigin-Name: c16a7f4950d47c2f5177db7dc5d83f0f11eb0cafdce1ec688d6f1bd740d92733
2022-05-23 13:55:39 +00:00
stephan
192201d2ed wasm: corrected isSupportedBindType() to behave as documented.
FossilOrigin-Name: 7e2d2e807272e98e9a3c9c9ba492b796a603f36b7cc12b16923cd8a9e6579851
2022-05-23 13:52:36 +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
drh
51e5d447ba Add an assert() to clear a harmless static-analyzer warning.
FossilOrigin-Name: 919ba2f0472e12c2d1e82364c1481e778b24ea406615b08992964a4eb80abee7
2022-05-23 11:51:10 +00:00
drh
43baa1de76 Do not run the subroutine that materializes a view or subquery until just
before the materialization is actually needed, so that if the materialization
turns out to never been needed, unnecessary work can be avoided.

FossilOrigin-Name: d64ae49a1f2513171d678259928c67741d79b2ae595078299525641a676cc46b
2022-05-23 10:57:20 +00:00
stephan
71eacead76 WASM: removed the in64-related bindings, as MDN says that calling a wasm function which has an int64 type in its signature will currently throw because JS has no 64-bit integer support. Those bindings now use doubles and simply hope that the user doesn't exceed their integer precision (2^53-1, approx 9 quadrillion).
FossilOrigin-Name: 392e84828275ec203bc713d3a5d4790852add57539add6b29b5f6de1da2dc97a
2022-05-23 01:11:49 +00:00
stephan
c21c0e2af9 WASM: an arg handling fix for DB.exec({multi:true...}).
FossilOrigin-Name: 0d6332f706ec5c34cc6a9ff79878f4e10a9ad81b24cc7d743b52168586285811
2022-05-22 22:10:38 +00:00
stephan
744a65cf7d WASM: added exec(), execMulti(), and several getters. Various touchups and fixes.
FossilOrigin-Name: b790c91b85e9cf8eecce86ac1717e8ccd2c3b6b98a1ad6a5d64eefc94ee86f9d
2022-05-22 22:00:39 +00:00
stephan
f6868562ce Implemented Stmt.get() and friends for WASM OO #1 wrapper. Added basic tests for prepare/step/get. Restructured module init output to introduce only 1 global-scope symbol instead of 2.
FossilOrigin-Name: 601dc3fa29c2ce2ede5a8320c79050305f3774b6d7bc759247c5021f3b74aaec
2022-05-22 19:09:59 +00:00
stephan
40b5b19a0f WASM: added bindings for sqlite3_compileoption_get/used(), moved OO #1 into sqlite3-api.js since it can only be used from the same thread as that API and separating them complicates client-side use. Started adding test utilities and tests for the OO1 API.
FossilOrigin-Name: f3bc0328c87cac7d50513b0f13576d8fe7b411396f19c08fbe7e7c657b33cfbf
2022-05-22 16:25:43 +00:00
stephan
d60b7275c3 WASM OO wrapper #1: prepare() and bind() APIs are in place but are untested, pending fetch/get APIs.
FossilOrigin-Name: 84c8f63a1c446331a3afe52b0c8bdfa6980f24aa4cf600f576877fef5e650c39
2022-05-22 14:07:44 +00:00
stephan
166542cc98 Build refactoring for the fiddle/wasm bits. Set up wasm binding of a chunk of the core C API and added some infastructure for creating test pages for it.
FossilOrigin-Name: dea098b64eb95c395b346ebcae687afe42b7d21df48833527808c02226300a66
2022-05-22 00:27:19 +00:00
stephan
4ec29fc115 Minor fiddle-related build restructuring to support upcoming development of the C-style wasm sqlite3 interface, plus some commentary about the plans and goals for that.
FossilOrigin-Name: c7cfdd4c3682659352642461d3307bf8180703b121ec1802ba5881f8e1ef9809
2022-05-21 21:13:44 +00:00
drh
40822eb262 Defer materializing a view or subquery until the materialization is actually
needed, so that if it is not needed, not useless work is performed.

FossilOrigin-Name: 16bf350683fd6ac906dbd02b21fb8bf1b1014ed05594cacf108645acd383ae65
2022-05-21 18:03:33 +00:00
drh
660dfbdcfb Fix a typo in a comment.
FossilOrigin-Name: 34d7045b2cc8ef16fd4115499888703a376d2c3a289e7fdd117f8341ffa586c3
2022-05-21 15:54:45 +00:00
drh
b800bd63aa Use the newer OP_BeginSubrtn opcode instead of OP_Integer to start the
subroutine used to matrialize a view.  This does not change execution but
does make the byte code a little easier to read.

FossilOrigin-Name: cebd4fd606f967de527cff79df8e80e16d06eec257939322f16d21303868fb4d
2022-05-21 15:12:41 +00:00
stephan
4257373f6d fiddle: refactor into main thread (UI) and worker thread (wasm module). Added bits needed to support triggering sqlite3_interrupt() but do not yet have a second SharedWorker to test it with.
FossilOrigin-Name: 5ff3326856bc190cee15a5fca5ded89aacc4bf931a8df98726a872b310e2a4fc
2022-05-21 14:19:05 +00:00
stephan
0592b20faf fiddle: add a selection list of example queries.
FossilOrigin-Name: 74abf03977e1ff8c6043defa38211cdfcfbba1979771b90ed9d3dbc99750fe9f
2022-05-21 00:45:46 +00:00
stephan
2eb454147a In the shell WASM build, call open_db() early so that we can get access to the global db handle from certain experimentation-only function without having to first run some SQL code.
FossilOrigin-Name: 31706ef851f7d55e2fe865933ec03f42dfa8b49e6d1f12b6c016b5c1d3460504
2022-05-21 00:01:45 +00:00
stephan
056b72a988 Added the standard sqlite license header to the the fiddle JS files. Minor internal renamings in those same files.
FossilOrigin-Name: 67e40d99ff84a6cb23c68bf0722a4f9dee29b8ad18d9e7aac7d1665e99901ba1
2022-05-20 13:50:04 +00:00
stephan
e26d162402 #if'd out the '.nonce' and '.check' commends in WASM builds.
FossilOrigin-Name: 326f79ea54566a9302be99d920856f13b48f2c2ed265fa87d78ced367d4b1946
2022-05-19 22:04:23 +00:00
stephan
1c0dcec4c5 #if'd out the the '.cd' and '.clone' commands for WASM builds.
FossilOrigin-Name: fa391868dd626ffdb220bed6834d0a10c7336f0fc4ca56055147784de1a4f99d
2022-05-19 21:56:50 +00:00
stephan
2f72d711ac fiddle: consolidated two duplicate CSS rules. Internal doc typo fix.
FossilOrigin-Name: d3175a793fb2d1ac9ecfd7a7c3b1627fe583effcd37740206a11b115f099d521
2022-05-19 18:14:34 +00:00
stephan
091fb16e09 Added a disclaimer about fiddle's experimental and subject-to-change/removal nature.
FossilOrigin-Name: 75b4f574089c4969d2f2c3615a52029e98515e36390c530cdf63f15f4f687a1d
2022-05-19 17:47:17 +00:00
drh
9d023c227f Merge the changes to support the "fiddle" extension.
FossilOrigin-Name: 58585f01aa4747d3a09771fb462066bd037914f435ff04fa16ed9b0571e7912a
2022-05-19 16:59:46 +00:00
stephan
d59ac28d4f When building fiddle from its own directory (e.g. from emacs instead of the normal build process), force -O0 the sake of compilation speed. The top-level build now defaults to -Oz, which is more appropriate for that case.
FossilOrigin-Name: 56b82ae806c61b95e62042ca70ed952ce01832b02da55c2b315f9201989514ab
2022-05-19 16:49:15 +00:00
drh
7db1289b0f Tweaks to the fiddle make target so that it builds with all of the same
extensions as the standard CLI.

FossilOrigin-Name: d46a6cb97406d90b9ad1da66369454e9b8f387ffbebcdf1c386c3c21f790c16f
2022-05-19 16:42:41 +00:00
stephan
2d0a85c5de Added a toggle to swap input/output field positions and simplified setup of checkboxes which toggle a CSS class on a given element.
FossilOrigin-Name: eae3ab10c813d6f051d497271be2df05f54005ec54b19a2a27d04d632bccbeac
2022-05-19 16:30:03 +00:00
stephan
e9e0208561 Default to top/bottom layout with input on the bottom. Offer a toggle to swap input/output positions.
FossilOrigin-Name: 362d236aca31ca2004d1e81d8e306f7a12a6cb4eeb2bab432a9c2aae5206ddd7
2022-05-19 16:11:35 +00:00
stephan
38240592ad Numerous layout tweaks, the most significant being that the layout now adapts to the window size. Swapped positions of the input/output areas. This version supports, by uncommenting a few bits, a jquery.terminal-based view but alternatives to that 300kb dependency are still under investigation.
FossilOrigin-Name: 1aad3642c9fc14c25223628a309d84decc8d73a123e42d6efdc36d855b5b0666
2022-05-19 15:58:13 +00:00
stephan
6da6f31cca fiddle make target now accepts fiddle_cflags=... from the CLI to overrid -Ox and such for one-off builds.
FossilOrigin-Name: 4609a4f8626ae3d8179cae27e391bd06ffda18e9ef9e1b78745b36c7e8dd25db
2022-05-19 10:58:59 +00:00
stephan
403445be23 Ensure that the output area is cleared of any init-time messages which the emscripten bootstrapping process emits when downloading of the wasm module is slow.
FossilOrigin-Name: 1d8d0593573f9fc8e0990a292a4b3317d8a4c323d60514d0768543dd65c24d1e
2022-05-19 10:38:54 +00:00
stephan
618a375e9f #if'd out the '.log' command in WASM builds. Cleaned up the user-visible parts of the WASM module initialization.
FossilOrigin-Name: b5fa12f824690c1022e4d69b0f5c3949324b311557a7412810741731db7e2cce
2022-05-19 10:24:50 +00:00
stephan
0fb074ab61 Split the fiddle JS code into separate pre-/post-init files to simplify editing. emcc will combine these into the final fiddle.js, so the number of output deliverables does not change.
FossilOrigin-Name: d3d8ea011868bcfa11bb3fe2db78eea6e77ac1005534d9c091f9a81e03f0a7e6
2022-05-19 09:55:14 +00:00
stephan
b8a2b20509 Added an option to auto-clear the output area before submitting the input. Experimentally inverted the colors in the input/output areas.
FossilOrigin-Name: 1a1e4e7fdbd0ec61218c3a311164086316d825181f3fc1c1ec235b63488746ef
2022-05-19 09:22:16 +00:00
stephan
9af6beb977 Replaced the toggle for the notes/caveats section of the fiddle UI with a button to remove that section.
FossilOrigin-Name: 6661d60527820417bbfd01c782d242c5190252ea703fc6f56376537d5c8f6a1e
2022-05-19 01:12:23 +00:00
stephan
29f2458aae #if'd out the '.import' command in WASM builds. Several minor cosmetic UI tweaks.
FossilOrigin-Name: e4f87eb7c3ed16b7e431f86b7d337bb4097246d20780207b43e28fffda3d8a61
2022-05-19 00:38:34 +00:00
stephan
348f7420b3 #if out the '.load' command in WASM builds. Several UI layout tweaks.
FossilOrigin-Name: 67d98297f01d4274c510f5c5cb2a219aeb36fcbb7ce78b8b9ed65639a4561c73
2022-05-18 23:40:27 +00:00
stephan
02520cc8f6 In wasm builds, ifdef out shell commands which require file I/O, pipes, or which trigger an exit() (.quit and .exit). Documented some of the quirks and limitations of the C/WASM crossover. Keep the JS code from calling into the C code after an exit() has been triggered.
FossilOrigin-Name: bee436e62a956e49b0df4a92abff2c89f2b44e21d8f593716df0331f8fc49814
2022-05-18 22:58:34 +00:00
stephan
b0dae2b3c3 Improved handling/reporting of conditions which trigger an exit() from native code, e.g. calling the '.read' command. Added a Help button which simply submits the '.help' command. Added commented-out variants of various -Ox flags to simplify experimenting with them.
FossilOrigin-Name: bf06ddf4125d2726019fa16d312726c8551094be991509499b5688f6a68a7747
2022-05-18 21:18:21 +00:00
stephan
0076e49700 Code style fixes: s/char const/const char/.
FossilOrigin-Name: 9bf042b2eb2137239a59e421e89eb463e719b264eac3db2adae44e321b9a4ad3
2022-05-18 18:10:17 +00:00
stephan
8ae45e4c6b The fiddle input/output areas now stretch and shrink as needed to account for their available space.
FossilOrigin-Name: 4eec05457fabe8248b8fd48d6187e772b69429ed64e99f02d0ad6b1230b5835e
2022-05-18 17:40:19 +00:00
stephan
9f69b9411e Increased default size of the fiddle output area, changed the .nullvalue default in the input area, and minor CSS tweaks.
FossilOrigin-Name: 281aaae73167828bdf0bb2c07f83622475ab29b5755ac7fb8584c8e919c0a09b
2022-05-18 17:22:02 +00:00
stephan
f8cd3d2b5c Initial version of an sqlfiddle-style application using a WASM build of the sqlite3 shell.
FossilOrigin-Name: af9c21c9e0caf05adac7a9fcde39a9164c89f1c78b767b6fdd74a1405a3d373f
2022-05-18 17:14:24 +00:00
drh
b8b2d9c5e1 Fix harmless compiler warnings in the new unixFullPathname implementation.
FossilOrigin-Name: f7e1ceb5b59a876cfd04a8aac0ee2b322c970555b9c361b4953d711ef6596e37
2022-05-17 15:11:57 +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
drh
ff16267d7d Add the sqlite3_db_name() interface.
FossilOrigin-Name: 2ad152236c408cbb1f942b221de4bf3cbaa9c35313d7eb07a63f46b6040fc981
2022-05-17 14:59:05 +00:00
dan
c7d7ebd755 Add memory barriers to multi-threaded code in test4.c.
FossilOrigin-Name: 9260f4e0fdc8066b4772999bacb5f4130ef714d4ac1967029ceacff618bc48ff
2022-05-16 16:55:22 +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
d83997ba7f Improved debugging comment generation for the OP_Column opcode.
FossilOrigin-Name: 3e073bfddfcd652dfae8656d8978a4de427d21847fdaccfce53b6b895ad33f01
2022-05-14 17:40:47 +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
086b800fcd Change an unreachable branch into an assert().
FossilOrigin-Name: 778e57a558dc3f819ca57623bcb85f58c8fbeb28bc12a1e2edbdd1244e9107c5
2022-05-13 23:01:28 +00:00
drh
556527a154 Transitive equality constriants do not work on a RIGHT JOIN, since the
right-hand side might be a non-matched row.

FossilOrigin-Name: 0f96810b840dd6f209562635b21f55a7ed6210c01336fcfeb3b79e08a615a28d
2022-05-13 20:11:32 +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
767bc8de8e Defer generating WHERE clause constraints for a RIGHT JOIN until after the
ON-clause processing for the RIGHT JOIN has done its own row elimination.
This fixes and incorrect output from some RIGHT JOINs that was identified
by [forum:/forumpost/41cc3851d864c5e6|forum post 41cc3851d864c5e6].

FossilOrigin-Name: 238d9c247cf69cc77fdb1af9d42ebe258610a533ac4204e2ddf8af17f24d18c4
2022-05-13 17:45:52 +00:00
drh
a6e8ee12e2 Redefine the acccess rules for the Expr.w union so that the Expr.w.iJoin
member is accessible on either EP_OuterON or EP_InnerON.

FossilOrigin-Name: 6f741d6cfb8831a3ac966257ac4519bcc8156293447bf50323c2d9b170125974
2022-05-13 16:38:40 +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
67a99dbee8 Improved names for flags on the Expr object: EP_FromJoin becames
EP_OuterON and EP_InnerJoin becomes EP_InnerON.

FossilOrigin-Name: 1ffea07ff98b894729c698b681cc7433df3bbfccd8a0529a706908602a636937
2022-05-13 14:52:04 +00:00
drh
8b0e5c3c7e Fix a harmless compiler warning in the CLI.
FossilOrigin-Name: 7a2ac303d1436a423a635db63d195097c88160ff46855194f6e630f9d3b3fa82
2022-05-12 17:09:33 +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
drh
d59a388b61 Fix the ".echo" command of the CLI so that it shows the results of input
lines immediately, before invoking sqlite3_prepare().

FossilOrigin-Name: cf7fdabdba3a7600ea730263ca80ba80154645dfa15c31c037b780d6cb70e530
2022-05-12 11:01:41 +00:00
larrybr
175fdcb912 Zap stray --help output from intermediate version.
FossilOrigin-Name: deb7372b18cc8fb9d305085498fd24b3c2c17bd920ae2d03fa885af02ad47008
2022-05-11 20:29:32 +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
drh
6868bca6c5 The unix interface now resolves all symbolic links in filenames before
actually using those filenames.

FossilOrigin-Name: d55273e36e312336b8fc77dc771657d3b2c3437fbbd79f3be37701982560d634
2022-05-11 17:57:43 +00:00
drh
b302c065d8 Use osReadlink() in os_unix.c, not readlink() directly.
FossilOrigin-Name: c3da4c1611cebd9f9d695892a3ffddc47d5f0db1a1ea8bd2b4f83ef7673b68de
2022-05-11 17:45:50 +00:00
drh
e8346d0a88 For the unix VFS, rewrite the xFullPathname method so that it automatically
resolves all symbolic links, rendering a canonical pathname that contains
no symlinks.

FossilOrigin-Name: 40c9273d0e0e74e1df22e996a5d486e838f4320defd2121e2d95eeed8aea6235
2022-05-11 16:46:27 +00:00
larrybr
d647819034 Fix .import leak in CLI and add shell leak testing to debug builds and the Tcl test suite.
FossilOrigin-Name: df842ebc796a2b0c913d19d873e88d048808dc5283465271369e302a680317e4
2022-05-11 03:42:38 +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
drh
de695eab88 Fix a harmless UBSAN warning.
FossilOrigin-Name: 8f9355028bc7baeeb10ee9a5e29f093adac6c2f149596dec0be827be4ce491cb
2022-05-10 15:55:10 +00:00
larrybr
1607ac3357 Sync w/ trunk
FossilOrigin-Name: b7285f92bb9bfd8471e51ee5b6dbd7030b1f731683876e8ecca4a8c033688736
2022-05-10 14:57:38 +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
adef15986a Simplified "hidden" and "no-expand" handling in the *-expander.
FossilOrigin-Name: c6c3115f3a008cf9b0d7c5c812f17e38c8a75a904032c5f05f0bea03a7340527
2022-05-10 00:24:01 +00:00
larrybr
1a53219981 Create new branch named "echo-sql"
FossilOrigin-Name: 042f2935c9d07668eff6ad8a071c82aa12ccbf9a783dff7b74ddd6b4c82cf573
2022-05-09 18:33:14 +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
4077b006ad Add ALWAYS() on two unreachable branches in the * expander.
FossilOrigin-Name: 387c852375bba62df040330944c9e979a6993f95ece3443597c5fc66e34263ca
2022-05-09 16:29:53 +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
larrybr
fa5dfa8910 Stop a memory leak in .import, and add leak complaint to CLI debug builds.
FossilOrigin-Name: f5f09368b33b6af00f96e5b8f763e7ee2d00ba6af2aee0f2ca86bb58c03d0b71
2022-05-07 03:53:14 +00:00
larrybr
1e48d79f71 Create new branch named "import-leak-plug"
FossilOrigin-Name: 4a4cecab23ef2aab20b1db466d045d56921590eb67563ab5a31f7b0a0f75c533
2022-05-07 02:21:17 +00:00
drh
41724ebc5a Perserve the requested reserved-bytes size for the database file when
doing a VACUUM.

FossilOrigin-Name: dac6d87c71606f3ec7ce601be6d17357d323476ecb60dbb167030146783b62b2
2022-05-06 22:29:45 +00:00
drh
87b7ac0420 Prevent an infinite loop on SQLITE_ERROR_RETRY when trying to modify a
corrupt schema while PRAGMA writeable_schema=ON is active.
dbsqlfuzz ded83609f475cc989c7339d45efb5151c1495501

FossilOrigin-Name: 217b33234dc3dc36b5b6add50c170869421057a56a7576d1a61767956248d5c9
2022-05-06 00:43:06 +00:00
drh
744c17c482 Backout check-in [9fb20a21feb8f697] which was incorrect.
FossilOrigin-Name: 99225618a83b577efbd5d13c0d1ff73e9c5a71bb43c259d7c0f22cf3479c992f
2022-05-05 10:02:19 +00:00
drh
c915b9c46f Improvements for name resolution for parenthsized joins.
FossilOrigin-Name: 006b2d9c52201c9e836b649018519acfb47f793f70b968722440f00084e9d846
2022-05-04 18:43:39 +00:00
drh
049d239a8c New test cases for RIGHT and FULL JOIN, focusing on cases that make use
of Bloom filters, and a bug fix related to when ON-clause constraints are
applied.

FossilOrigin-Name: 67510354e69bab98bd8095f5bedd34aae619fe2c7885975d7a6a00b7df5ece4e
2022-05-04 17:43:59 +00:00
drh
95cb5ccf92 Code EP_InnerJoin constraints at the same time that EP_FromJoin constraints
are coded.

FossilOrigin-Name: b57033d2af2196e2f7e5305f3504fc20da5cadeb66026d38b999fe909cab8ac5
2022-05-04 17:30:51 +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
larrybr
b55776230d Fix CLI use of wrong allocator for free().
FossilOrigin-Name: 9fb20a21feb8f6979812f45691e06aa3e297d7370cf0d5820523e817a4e97863
2022-05-04 03:45:32 +00:00
drh
367c146b09 In the query planner, do not let tables commute across any outer join.
FossilOrigin-Name: 8cee5388232ade91ea627bb6857eb8937d7530b5ea519e0ae6da362c37c7ed35
2022-05-04 02:01:49 +00:00
larrybr
bc33519de6 Typos cleared from README.md
FossilOrigin-Name: be3a1879c865cff85d8b1f0cc7b95295019c28cce67c687692a3210eeea6e314
2022-05-03 21:58:24 +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
00e5d3d59e Fix a typo in a comment.
FossilOrigin-Name: c19c3c48698bf2543d775411c62d01e629791e2f3c5317970fdbb830eacafac6
2022-05-03 16:18:25 +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
207f626356 Add assert()s to show that jumps always land an an instruction that is between
1 and Vdbe.nOp-1.  Had these assert()s been in place before, they would have
caused an assertion fault for the byte-code error reported by
[forum:/forumpost/2482b32700|forum post 2482b32700].

FossilOrigin-Name: 8f8a58feb7047d19522ca32efbe42fd9ddf49aaf9064f7373eb56a88982406a2
2022-05-03 12:11:16 +00:00
drh
d88fd53989 Organize the various flag bits of the ExprList_item object into a substructure
so that the whole lot can be copied all at once.  Faster and smaller code.

FossilOrigin-Name: 5341d4bbe9a943f9cdbbdea829e18f108e98972ebb706396c50fc62fcc6a6328
2022-05-02 20:49:30 +00:00
drh
689f1b9246 Merge trunk fixes into the right-join branch.
FossilOrigin-Name: e01f4c05c21e89dcc7985e00874f288d9ba5d5d932f7284f8d970bd3145ac0c2
2022-05-02 20:14:26 +00:00
drh
63879a2c99 Improved comments.
FossilOrigin-Name: 158b80bed61ade793ccfd979f26a5231fabc8c14697ca0141bba61bc13e3b2ba
2022-05-02 20:04:34 +00:00
drh
72d620bdb1 Name resolution and "*" wildcard expansion for parenthesized FROM clauses
seems to work the same as PG.  The code is chaos, however, and needs some
cleanup.

FossilOrigin-Name: 6f9c0b07aadc5189c65c3ee4e6938aac10fc0d98f1cb06980f5e5d7b0308f237
2022-05-02 19:59:03 +00:00
drh
56f38db700 Remove a testcase() macro taht was made obsolete by [a8da85c57e07721d].
FossilOrigin-Name: 053cf45ecaa7eac8cc64c7b2672807f736a45575a84b426263b2e1feb060b401
2022-05-02 15:47:57 +00:00
drh
c35f02d676 Document (in comments) that the SQLITE_FlttnUnionAll bit has a specific value
needed by TH3.

FossilOrigin-Name: bcaa4a44749d157c5953c6f54c88b1ba29b4035f4b21fce986b7efbea372e109
2022-05-02 15:31:06 +00:00
drh
7a8809907f Fix a harmless compiler warning in sqlite3TreeViewWinFunc() (a routine that
does not even appear in release builds).

FossilOrigin-Name: daff6070039e45df7c47b323a8352e56d1264a7bfb065fe2d79c58454c95a262
2022-05-02 15:23:59 +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
3a45d30ea5 Improvement on check-in [a193749730d6cfba] so that the subroutine call to
the IN operator right-hand side generator from the RIGHT JOIN no-match logic
does not generate unreachable byte code.

FossilOrigin-Name: cc458317bd77046c4328715ae9e3409f3f4cd422a01162cb33405ef3a142b0a3
2022-05-02 14:32:56 +00:00
drh
b94182bdc6 Bring the comments on sqlite3FindInIndex() into closer alignment with what
that routine actually does.

FossilOrigin-Name: 40f3274745b53bb72933c1052d0e85bc74be56d3a1068e9d54dc28763a2cfef9
2022-05-02 11:24:21 +00:00
drh
bae50d6719 Defensive code in sqlite3TreeViewWindow() to fix a compiler warning.
FossilOrigin-Name: b250c218b4b6327a1cae3edbc037625ba998f89ee13a9bfbc2cefd1edfc4b768
2022-04-30 19:55:28 +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
c64f0e71c1 Enhance the TreeView debugging output for Expr with opcode TK_IN so as to
show the RHS table and the subroutine address.

FossilOrigin-Name: aec1e4cd59ae874b66335e4f87322fbe31fbb752429e68bf41338db316d0a9ed
2022-04-30 00:05:37 +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
8e8e9de87e With TreeView, only show the table columns for a SrcItem if the data source
is a subquery rather than a persistent table.

FossilOrigin-Name: 7b4a0d0fa1d8facaf5e550650d9b261eda7eb7a2a413627f2751f01c5477e1f3
2022-04-29 17:45:39 +00:00
drh
0c0d0526dc Multiple enhancements to the TreeView output for SrcItem, cherrypicked from
the right-join experimental branch.

FossilOrigin-Name: 293afa81112e824eec2557d004a27319d484276f796936e16d64243fe24f6b68
2022-04-29 17:13:52 +00:00
drh
08e1a6a29b Show the USING clause as part of the tree-view display of SrcItem.
FossilOrigin-Name: 9cba3ce577e442f83d7a2d6926e38ffe6bc45953c88ecdd384f3455890303cce
2022-04-29 17:03:25 +00:00
drh
de7a820fd0 Minor typo fix in a comment, for the benefit of broken IDE syntax highlighters.
FossilOrigin-Name: 680ccecbc839373194ed2dcc1053e25512d9ea3f12f8c8963cb8fbd1a034d2f8
2022-04-29 12:09:43 +00:00
dan
07fd1bf323 Fix problem with SQLITE_OMIT_VIRTUALTABLE builds.
FossilOrigin-Name: a99ee612b9bd6d75b63e557ef5bdac2143425a558cf023a0480cc28c8300a9a8
2022-04-28 18:33:02 +00:00
drh
a087eb8f6d In treeview.c, show the columns of the table associated with each SrcItem.
FossilOrigin-Name: 3aafccb5c3c780c29090ee5eb428a6c3153627ce8bf834bbd392e79a30e9389b
2022-04-28 18:17:51 +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
drh
09121b0523 Merge trunk enhancements into the right-join branch.
FossilOrigin-Name: 3fd9706bba4a71cb5c7ce1341c3be0a7727941445820a073e7b2f0f32512e8ef
2022-04-28 12:52:49 +00:00
drh
22b541b55a Fix a harmless typo in a comment.
FossilOrigin-Name: e1f4a115df34e45cf1bcf98961c699b582f564a58a979e95853b219bda06212c
2022-04-27 18:38:46 +00:00
drh
609959285b When computing STAT1 values using ANALYZE, if a ratio comes out to be between
1.0 and 1.1, then round it down to 1 rather than the using the default rounding
rule of changing it to 2.  The reduces the estimation error for the
case where a column value is very nearly, but not quite unique.

FossilOrigin-Name: eb59c46a5aed69bc6fd096997bf24c082e533c1085439f6ec1fbe5ff78e8b374
2022-04-27 16:41:56 +00:00
dan
9684d71081 Fix a test problem in rbubusy.test causing a crash under some circumstances.
FossilOrigin-Name: bc5bbd9fa636cc9ef0cbbc0600b8fc1404b9732670ac4e7a8b5a230fbce758d5
2022-04-27 13:33:48 +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
3e4314b4f8 Fix a problem with automatic indexes introduced by
check-in [664b461bb5063d980] and reported by
[forum:/forumpost/0d3200f4f3bcd3a3|forum post 0d3200f4f3bcd3a3].

FossilOrigin-Name: 134cfb18ff930e4bccc1a7412a02be353bf67c6d5080bc0673afaac81afa889c
2022-04-25 20:56:55 +00:00
drh
0e464b5f51 Do not allow the push-down optimization on the right table of a RIGHT JOIN.
FossilOrigin-Name: 05917bfa02a7b6678c147d10fb53f55532ab15fd5d82d925ae921ae3759f0115
2022-04-25 20:47:58 +00:00
drh
5eb6e09795 The pushDownWhereTerms() routine should be using
sqlite3ExprIsTableConstraint(), not sqlite3ExprIsTableConstant().  This fixes
many problems, but still an error persists in join7.test.

FossilOrigin-Name: 10bf0e613809f71cc1a47ad40b517e2a66671212a6464e179c9d377e8b70d499
2022-04-25 20:38:42 +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
95fe38f2fc Add a new optimizer disabling bit to disable just the UNION ALL branch of the
query flattener.

FossilOrigin-Name: c0f9ebab5455d8541a562122d3270b95ce571c3fd870b0048dda2b036c2b66c0
2022-04-25 14:59:59 +00:00
drh
7f417569f7 Avoid unintended side-effects on Parse.nSelect in the
sqlite3ViewGetColumnNames() routine.

FossilOrigin-Name: 59789fe1e745bb6f81898176e7e9c6064ac9f4bbefb4dc3c8f3e4c1379568f69
2022-04-25 14:49:48 +00:00
drh
1a6bac0d2f Remove NEVER() on branches formerly thought to unreachable
(see check-in [71272caff5874137]) in order to fix the first bug reported
by [forum:/forumpost/28821db852|forum post 28821db852].

FossilOrigin-Name: bd6811d8110d5f00596e2eff6d4b02af8b6d8557d41990e6f50518ead0fa01fb
2022-04-25 10:43:19 +00:00
drh
7980fadcef Merge enhancements and fixes from trunk into the right-join branch.
FossilOrigin-Name: 2fb165cf8bd1e43248612aa2922bd311df30dcbb3c2f1daee73c363e409c501f
2022-04-23 19:26:34 +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
30d2aab5fd In debug builds, add extra code to verify that there are no jumps that try to
escape from the right-join body subroutine.

FossilOrigin-Name: 45fe919266ba1843f3eeeb511ab43126069d4976c9fc64e57e0390c21f110b6e
2022-04-23 18:46:03 +00:00
drh
6c7e89b48a Fix false-positives in sqlite3VdbeNoJumpsOutsideSubrtn(). All tests pass now.
FossilOrigin-Name: 1300d978d5a072780e0f16722e42461dc983de9b4dfb2f5a7023c74c92ab9bc8
2022-04-23 18:34:55 +00:00
drh
b77c312956 For debug builds, if the RIGHT JOIN body subroutine contains a jump that
escapes the subroutine, then abort the prepared statement with a descriptive
error and SQLITE_INTERNAL.  This extra sanity check causes many tests to
fail.

FossilOrigin-Name: 2c5bb2bff26cc70d8cac78ddd12d5ac37ab1472f5f88afbd975950a18ac2804d
2022-04-23 18:04:31 +00:00
drh
d63c07e6c5 Fix an operator typo - This indicates that the branch needs further
investigation and verification.

FossilOrigin-Name: f6ab67965b718b0c6d7faf769c7e47384cfd2ddbb03df518e0c5d367f8583387
2022-04-23 14:30:22 +00:00
drh
0748e8bf9a Correctly resolve left and right USING columns of an outer join in a
parenthesized subjoin.

FossilOrigin-Name: ea91aba88c31a042f4e32d66dfa089f95d0f9d316ab26f298085eb34dbf73e86
2022-04-23 07:31:50 +00:00
drh
ab843a51d3 Fix minor problems with the new join table name resolution logic.
FossilOrigin-Name: 3a6b0db4519072dbd41b1c105bf1a0c6b4dd90380e94a5662645d8d41483c707
2022-04-23 07:29:34 +00:00
drh
45e41b7371 Add the ability to access the USING columns of the right or left tables
of an OUTER JOIN even if the OUTER JOIN is in parentheses.  Prototype code
only.

FossilOrigin-Name: c3a427575fe71de3061495059e253c72c7213e2925ee2873e4f59fc73bfae103
2022-04-22 23:18:21 +00:00
drh
f054c34372 Merge the latest enhancements and fixes from trunk onto the right-join branch.
FossilOrigin-Name: 7f8983345d1e3ac28d736fce9f90772aa0e4654670a1db3dd0ee45b55e92f2e4
2022-04-22 19:52:51 +00:00
drh
d6bb6000ef Make use of the "%!S" format when running ExplainSubquery.
FossilOrigin-Name: 9425d79cb407dedc259655625369e023d22a04ef7db606ea3eefe7e4d662be1a
2022-04-22 18:07:38 +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
dan
9b843f0ce0 Add test cases to check the handling of SQLITE_BUSY in rbu.
FossilOrigin-Name: 6fccc733c6041a2946fb3d37e4737ae37defae5c110225dd746cdc038cc64957
2022-04-22 15:18:41 +00:00
drh
1ca14b74ed Simplification of data structures in the wildcard expander for
SF_NestedFrom queries.

FossilOrigin-Name: f7c18262347ff430879d5afc7a118d2b9b0050c845c6b1fe6c047062ea2ba8fe
2022-04-22 13:34:45 +00:00
drh
9c2d7aa7d0 Minor simplification to the result-set wildcard expander for SF_NestedFrom.
FossilOrigin-Name: d942530a6550a0cbe31790e462b0f0d57b9b4a896161878b7d45d11cbc1cb7a3
2022-04-22 12:46:46 +00:00
drh
8318b55d87 Merge the latest trunk fixes into the right-join branch.
FossilOrigin-Name: c74dc574c3b24a7d3533202f33b15341b043cfd89a80250563e6771ab6b6b8a7
2022-04-22 09:57:57 +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
6dab33bf40 Fix harmless compiler warnings.
FossilOrigin-Name: 29255664127a975e5b0d5767cd4e56d93ff2ea1994702cdfbdca1b700952502e
2022-04-21 19:25:51 +00:00
drh
a74b4c4d45 Fix a harmless uninitialized variable warning in MSVC.
FossilOrigin-Name: b870d2a2fa54ddab6ffc9b9d95f52420a5a6831aeb73dac75355ca1ab15a190e
2022-04-21 19:20:38 +00:00
drh
7e9a56f70f Fix harmless compiler warnings in the CLI.
FossilOrigin-Name: dfd2100bc4f316825fd199b347849d1a2b941837f9eedcf36f3c3d280692b991
2022-04-21 19:14:23 +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
drh
18f8600fe6 Avoid materializing columns of SF_NestedFrom subqueries that are never used.
Other code improvements manually imported from the right-join-paren branch.

FossilOrigin-Name: cd8272fc2a34d1b245fd95208b9b601266ee7d2ff0f5ce52d03752f2c4e852a2
2022-04-21 13:11:26 +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
22b410d894 Small correction to the new bUsed logic of sqlite3ProcessJoin().
FossilOrigin-Name: ba04142e09bb1ccc86824760a2e11df47e070285a2d09c2f61b75255886597cd
2022-04-20 18:12:42 +00:00
drh
e60ffa3350 Merge window function fix from trunk.
FossilOrigin-Name: b6b9e185f8c44b5f2f51111f7c5e4e2d77c8b853c5be271467ce138e8066340c
2022-04-20 16:54:47 +00:00
drh
910e57b9df Remove an unnecessary assignment operation.
FossilOrigin-Name: ed46527aca170ccbe9ed9ea4ae065db72c82dec17da7b99c928fae4495f05c2b
2022-04-20 16:53:23 +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
bc656e220f Comment fixes and improvements in sqlite3ProcessJoin().
FossilOrigin-Name: 1118655f4d58da1273e83954c80d8bc17fa3bde7a39e81cb9947d59894d5ab93
2022-04-20 16:26:22 +00:00
drh
815b782e99 Improved tracking of nested SELECT objects used to implement
parenthensized FROM terms.

FossilOrigin-Name: 0da2232624571f4020c05d775ea518514d748fba8dacd4caba2e2e6ed1ae399f
2022-04-20 15:07:39 +00:00
drh
b465a83353 Also show the ENAME_SPAN value in sqlite3TreeViewExprList(), if there is one.
FossilOrigin-Name: c1d42861778d65f7014c43fbaf09972a69ff0d81bfc2f4720160a989489cf2c8
2022-04-20 12:15:51 +00:00
drh
d4e9caf987 Improved TreeView output for ExprList: Show the ENAME_TAB value, if there
is one.

FossilOrigin-Name: eb3f883b45f1bf3f388823360f4aec2d4b8776bfd96185b4fb44b7bc95c62318
2022-04-20 12:14:20 +00:00
drh
2627cbd4b5 Add a new comment to the body of lookupName(). No code changes.
FossilOrigin-Name: 22fa9b9b450fbbf7578597714eb1094f7d7433ac13497dc7d4a9affc4a2652ad
2022-04-20 12:02:52 +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
4d0d071a53 Improved comment on the JF_LTORJ constant definition.
FossilOrigin-Name: e0744da95fc010dc3a2e030ff491bcfa08a18691ee6ebc7d4e8aab3850f56eec
2022-04-19 19:51:51 +00:00
drh
3117b7b081 Fix a NULL-pointer dereference that can occur on an aggregate query that
uses FULL JOIN.  dbsqlfuzz 496a35dd4eefcd7935aaaeb0c69056bf49785d28.

FossilOrigin-Name: 63b8f8aec2a9ac3fbbd02715aa308eaf43c9ffde9d7c6db026d46edc575e7bdd
2022-04-19 18:23:01 +00:00