drh
fe14699765
Further improvements to USING() processing for RIGHT and FULL JOINs. All
...
currently known issues are now resolved. Performace is improved.
FossilOrigin-Name: 9fd3f22e2228dfba127f6ffe549109f3a4e910fa124adcc9c5483931bd6d5cd7
2022-04-17 18:46:17 +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
drh
052953a4e6
Fix the USING to ON translation so that it works correctly for a sequence
...
of two or more joins where one of the joins to the right-hand side of the
list is a RIGHT or FULL JOIN.
FossilOrigin-Name: 9ffc2b231956cde1bc90519aa174b0e2dc30ef671ed745f4f3ffa9fbb7ffab4b
2022-04-16 22:57:41 +00:00
drh
fdc621aece
Since the query planner is unable to cope with a LEFT JOIN on the left-hand side
...
of a RIGHT JOIN, detect that situation early and raise a parsing error.
This is a temporary measure that needs to be fixed.
FossilOrigin-Name: 6d5d6e0403241c99ab4a47d7b6eedcd8ebc615a8ca8d66d7e81171f901b170d7
2022-04-16 19:13:16 +00:00
drh
cebc8009ed
Additional SELECT trace logic: Show the tree after result-set wildcard
...
expansion but before name resolution.
FossilOrigin-Name: a7babf75418adffa27dec7a9d382a60e1b9364fb51d72b0a10e2769b308b3c54
2022-04-16 18:33:22 +00:00
larrybr
2d27d36cba
Make shell auto-column work with lots of columns when log() is missing.
...
FossilOrigin-Name: 82366436ef74838dae1f379f3e5b8ad187225a30ec58fb49f047ab7c08a263cf
2022-04-16 17:53:25 +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
be60896485
Revamp the USING clause processing so that it works (mostly) with RIGHT
...
and FULL JOIN.
FossilOrigin-Name: 719c8d920b435b0f234d47467a2abe2941ab7d55ecca886e211cfce577ae648c
2022-04-15 19:53:35 +00:00
drh
e62d9149a6
Avoid deleting substructure of the Expr node in lookupName() until after
...
the error message is generated.
FossilOrigin-Name: b8e717663957dfd84e580bf21bc8e8881b33fdb94a2cc0c664a230e54d5e5076
2022-04-15 19:49:28 +00:00
drh
bb3c62a758
Progress toward a working USING for FULL JOIN.
...
FossilOrigin-Name: fed2646adecb0a05dd674dc1cd2c0ae205078fe552ba93b8d68891c728c67637
2022-04-15 19:27:02 +00:00
drh
4ce7bf9156
When expanding "*" in the result set of a SELECT, do not attach a table name
...
to columns that are in subsequent USING clauses.
FossilOrigin-Name: 91530990e018580ec5322ace6f0c369a32a3529a0bfb4defb25ca20223a2a80f
2022-04-15 18:30:48 +00:00
drh
22c4bc8991
The sqlite3ProcessJoin() routine converts a NATURAL JOIN into a JOIN USING so
...
that henceforth the NATURAL keyword can be ignored.
FossilOrigin-Name: 8378e1e0d289627fb294ccd3f5865ef49df3a42b8a5aa211e21be1b42d9da753
2022-04-15 17:08:40 +00:00
drh
a99e325468
Enhance the IdList object to exist in a single memory allocation (rather than
...
a separate allocate for the base object and the array of IDs). Also permit
an IdList object to store an Expr pointer together with each name.
FossilOrigin-Name: 40f3c95871e6f40f287ef2756abafb8fc56dffdd0af69436e5c7d8e95022d94e
2022-04-15 15:47:14 +00:00
drh
358424aeff
Add the "3" in the name of the sqlite3ProcessJoin() function.
...
FossilOrigin-Name: b925f72b6f679c61b0d6be16fabe64dc7605550b7bd86f35c586dcecd8217673
2022-04-15 15:15:01 +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
b3ebf3043f
Cherry pick subroutine indentation improvements and the hardening of
...
OP_Gosub from the right-join branch back into trunk.
FossilOrigin-Name: 12645f100d902690630a2925674aedbb01d41a53426a26a2f56de5b8fdec955f
2022-04-14 19:48:32 +00:00
drh
79f60034ee
Another instance of indenting a subroutine.
...
FossilOrigin-Name: 73f4036b04798660b30e540cbab69420078df9fb62a6a39944e078c36272f905
2022-04-14 19:05:17 +00:00
drh
d549a702b3
Check for interrupts and invoke the progress handler following a Gosub
...
opcode, to avoid and recover from infinite subroutine loops.
FossilOrigin-Name: 647211e044a5856ceb6bf3e7b78e650fe7d81f8b7bf34568b99b346405ba520c
2022-04-14 18:19:06 +00:00
drh
2c31c00bfa
Rerun the subroutines that compute row-values if necessary from within
...
the RIGHT JOIN body subroutine.
FossilOrigin-Name: 9b9038bcd0ab5c4f01661456635526cef764f854ff24018a5e6e43825d07eb59
2022-04-14 16:34:07 +00:00
drh
37f5584a2f
Adjust the output formatting of bytecode listings so that subroutines used
...
to implement subqueries are indented one level.
FossilOrigin-Name: 079b7b125206fb295720612f4853a5b786ec431ab595d35407195844779c149d
2022-04-14 15:55:34 +00:00
drh
d345dcf39a
Disable autoindexing for the RIGHT JOIN loop.
...
FossilOrigin-Name: 402a89e33e39b00352dc9fb3301d03c6f75d8bb5c2ad540cd22506bff10b4d85
2022-04-14 14:58:50 +00:00
drh
375f182b1d
Adjust assert() statements to account for the new always-NULL cursor type
...
added by [4526c5d316508093].
FossilOrigin-Name: 7822faa48a058c0b0313b9241d290153fbe74ab84f58369a70014118a9085d1d
2022-04-14 14:40:29 +00:00
drh
c504f677b6
Previous check-in accidentally inverted a test on an assert(). Fix that.
...
FossilOrigin-Name: 5ec4f806c569428851b6f0159451aa3ed66b3bc61a845fd7c543cffb694b882d
2022-04-14 14:19:23 +00:00
drh
eab6c125bd
Fix assert() statements associated with artifical null-value cursors
...
created by RIGHT JOIN.
FossilOrigin-Name: f5bce5f152259767497ae6826c558003822d976b3f35f4d74edee59a3490efb2
2022-04-14 12:59:25 +00:00
drh
95b1036e9a
Fix a harmless (false-positive) unused variable compiler warning on MSVC.
...
FossilOrigin-Name: 63b04c63de680261a0d3eaf27154a1e8e77e3e166c3f2dbaea985603991c74f7
2022-04-13 19:00:57 +00:00
drh
b60d1fbe8e
Make the sqlite3TreeViewSrcList() routine a no-op if called with a
...
NULL SrcList object.
FossilOrigin-Name: 185d2720e7775e3060a1647353c10aada435244db53a0732ee786788a6ecae3f
2022-04-13 18:32:04 +00:00
drh
7c96039492
Fix an assert() in OP_Column so that it accounts for the new type of
...
pseudo-cursor that always returns NULL for any column.
FossilOrigin-Name: 371ddc97bef8e0d88ad965f00d27e010880174312ea36c4f1165dcf08441f40a
2022-04-13 18:20:23 +00:00
drh
3ac624344d
If the OP_NullRow opcode is given a cursor that has not yet been opened,
...
then go automatically open it to a special pseudo-cursor that allows returns
NULL for every column. Used by the new RIGHT JOIN implementation.
FossilOrigin-Name: 4526c5d316508093b7f3aeda1ce9d16ceb0be79842015a6d51f28c22b4473ca2
2022-04-13 17:41:03 +00:00
drh
f7ecd956ce
Move the explain comment for the RIGHT-JOIN post-processing loop to the
...
verify beginning of the loop - to make the start of the loop clearer to
human bytecode readers.
FossilOrigin-Name: 7ed2a271e6fcbb5e69a7f3a88d3f45fe6318819c0cc6a0dcc06c3dae5aa1503f
2022-04-13 16:46:35 +00:00
drh
94e615a6ac
Add support for RIGHT and FULL OUTER JOINs.
...
FossilOrigin-Name: fa9d206f904280e3eafc6f4ba6c0c7325948364c62eeeb9f0fdc5825d622ec35
2022-04-13 12:34:54 +00:00
drh
12c35ec322
The rows of a RIGHT JOIN might come out in any arbitrary order. So disable
...
the ORDER-BY/GROUP-BY optimizations if a RIGHT JOIN is involved.
FossilOrigin-Name: d168f245ecf497368feea4697769930c00420ef47a584904dac85371b61fb78a
2022-04-13 12:12:01 +00:00
drh
3b79f7580a
Fix an assert() in btree.c that might not be true for a corrupt database file.
...
FossilOrigin-Name: dbd8e2e46cfb2de0ebdbb62cda2fe669df3eda98f5d6112d541f581995b1361d
2022-04-13 10:49:50 +00:00
drh
146e64d2e4
Add missing VdbeCoverage() macros on new branch byte-code opcodes.
...
FossilOrigin-Name: 218c7167e562f5c327124f02a92de85079315320a221fb0508310d927596b14c
2022-04-13 01:52:32 +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
949e2ab49a
Factor out the RIGHT JOIN non-matched row loop from sqlite3WhereEnd(). This
...
reduces the register pressure on that routine and helps it to run faster
in the common case where there is no RIGHT JOIN.
FossilOrigin-Name: beeecf1604d4fb11e45058f48cb2289c6542e0bc218d63a245198113d8d5476b
2022-04-12 18:04:29 +00:00
drh
57d4b5bde1
Merge the latest enhancements from trunk into the right-join branch.
...
FossilOrigin-Name: b3e57ba120067c79e0398e39da9f00ecb11a5e18c36479da4c36a39e88a78a27
2022-04-12 17:43:30 +00:00
dan
6625d6d873
Earlier detection of corruption in balance_nonroot(). dbsqlfuzz 9191ade77ebd3b7a3356e074957aa85b0c669d14.
...
FossilOrigin-Name: bff4f083eb1c35544988493a5d73a42e646c4250b841f5aae38c2183f0867a0e
2022-04-12 17:02:27 +00:00
drh
61dac44eb9
The multi-index OR optimization does not work for RIGHT join, so disallow it.
...
FossilOrigin-Name: 34c2f7b237fa4e0e1cd94fb9c44ebe194b86b88dc575055cc46c7f3695d02756
2022-04-12 14:23:45 +00:00
drh
a70782407d
Always explicitly set each table cursor to NullRow before doing the RIGHT-JOIN
...
unmatched row pass. This is a cheap opcode, and it adds an extra layer of
defense against incorrect results.
FossilOrigin-Name: a3d14e61ca22167296fee125a3e9aa63413408955e03bb3f9d85fa9f22df1b79
2022-04-12 13:46:21 +00:00
dan
f7413d9acf
Modify utility function sqlite3SetString() so that it may be used safely on Parse.zErrMsg. Fuzzer test case "crash-1604e5d76c92574e21e437049dab9b672e06b767.txt".
...
FossilOrigin-Name: 09c5a4ec13b02efd6207e26dab7beaf184f0d8ccea0bd0dfe94fc803fe5636ce
2022-04-12 11:02:06 +00:00
drh
b087de063b
Fix RIGHT JOIN for virtual tables.
...
FossilOrigin-Name: 75a9116e98b9ac5c1a4c62a01143a016d9ba6a0b495ff7af7468c11947a3e888
2022-04-11 21:00:38 +00:00
drh
c133bab72a
The query flattener must add TK_IF_NULL_ROW opcodes on substituted values
...
that land on the left operand of a RIGHT JOIN, just as it already does for
the right operand of a LEFT JOIN.
FossilOrigin-Name: 8e02cdf5b1128f5e5b82d93903063415ec312694e5ccdd19e99fa35433f1b68a
2022-04-11 20:15:52 +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
b77c07a715
Fix some comments that refer to LEFT JOIN that should refer to OUTER JOIN.
...
No changes to code.
FossilOrigin-Name: 5be5ede5cca1cd5ef863fe0feb2b4a990f4a42865281a6c2e4eb816f48847dc6
2022-04-11 11:59:25 +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
d198526289
Rename the Expr.w.iRightJoinTable to just Expr.w.iJoin, so that the words
...
"RightJoin" in the former name do not lead readers to believe that this has
something to do with RIGHT JOINs in particular.
FossilOrigin-Name: e8c00442d2daedec079748d13147bf73b0ec3c3cf432bce2cdccb706bdff2853
2022-04-11 11:25:28 +00:00
drh
79d2658671
Ensure that the JT_LTORJ flag is preserved when flattening a subquery that
...
is on the left side of a RIGHT JOIN.
FossilOrigin-Name: ccb61fb1f30e2741b19c1a0cbd2951715224852c86234a3c6a4bbd2e1187634a
2022-04-11 10:38:28 +00:00
drh
8a28ce7bc2
Show the JT_LTORJ flag in TreeView debugging output.
...
FossilOrigin-Name: 21eb44919f38abad30b75181ca8aec38b453b94dba2815caf7e946e07faa40d7
2022-04-11 00:54:30 +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
62ed36bb5d
Minor improvements to the sqlite3SrcListShiftJoinType() routine. This started
...
out to be an effort to convert RIGHT JOIN to LEFT JOIN if the join was on
the first pair of relations, but that messes up the "*" expansion and so won't
work.
FossilOrigin-Name: a48902c71ed30c83de7dbd26d1c7956136c35dc53b1076bc8b1ebcba568a3fd3
2022-04-10 20:28:41 +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
de24dd706e
Bug fixes. A basic FULL OUTER JOIN now works.
...
FossilOrigin-Name: 34bbeeb77bd530b2b1f0390e9e552f65ae35f09a74d80a09dd327e64f9be51a1
2022-04-09 18:48:11 +00:00
drh
86c1beb402
Add byte-code that computes unmatched rows on the right table of a RIGHT JOIN.
...
Compiles, and the code looks semi-reasonable, but still does not run.
Incremental check-in.
FossilOrigin-Name: 2db5a498e74241dd19ef51c601f1a2b3b687faed3e1be2d1e3ada737406ac8e9
2022-04-09 14:48:35 +00:00
drh
7c1734b09e
The interior of the RIGHT JOIN loop is now a subroutine.
...
FossilOrigin-Name: 549f5a7ee639de80f049445002f58e93c805f9a3d3db1987ec9d139ccef4805e
2022-04-09 12:27:20 +00:00
drh
c2308ad2a0
A few bits and bobs of code generation toward getting RIGHT JOIN to work.
...
Much more remains to do.
FossilOrigin-Name: 55b4543122646997d928598343bc467c993f971e86e9037c85430cc948750576
2022-04-09 03:16:26 +00:00
drh
c187163090
Merge the sqlite3WhereMalloc() routine from trunk into the right-join branch.
...
FossilOrigin-Name: b1b3845aa38f469a27f07c8f6e8a98334f7967b19661ee4cf155d6997afd9d4c
2022-04-09 03:12:52 +00:00
drh
f8bdcfa3f1
The sqlite3WhereMalloc() routine allocates memory that is automatically
...
deleted when the corresponding WhereInfo object is destroyed.
FossilOrigin-Name: f237e1d8cc41b937f34288daebfacf5f7b0990a807a805e0cb6b45bc730192d6
2022-04-09 03:06:01 +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
7d0ae00361
Enhance the sqlite_dbpage fix at [/info/642a0b4752743216|check-in 642a0b4752743]
...
from about a month ago such that it still takes a transaction on all attached
databases, but it only starts a read transaction for read-only operations,
rather than starting a write transaction for everything.
FossilOrigin-Name: 8efd61e8518594e3e9c84681fc35796a78fe8885a97ad4dd19f1573ee8065b18
2022-04-08 17:01:29 +00:00
drh
81a23623d8
Improved explanation and commentary on the sqlite3JoinType() routine. One
...
of the error messages changes slightly, but besides that everything works
the same.
FossilOrigin-Name: 48f2e5a1fbaa8ceb32e08066766be74233b0c67ab430bbf7adfdff42cdb7b8ec
2022-04-08 15:11:10 +00:00
drh
ce5dd9e8d6
Fix two unreachable branches introduced by the recent
...
sqlite3TriggersExist() optimization.
FossilOrigin-Name: 1b5475d212cf9de0bff69eee8c607b4fcd8e04bf4df72171429e7609c4153951
2022-04-07 20:45:38 +00:00
drh
e603ab00ee
Enhance the EXPLAIN output formatting in the CLI so that the subroutine that
...
implements the loop body for the multi-index OR optimization is indented.
FossilOrigin-Name: c2965fea9df7076b235d3eadaf84f0a36242476d0329030b0e57557b66e2540c
2022-04-07 19:06:31 +00:00
drh
da4c7ccc07
The ".testctrl optimizations 0x400000" command disables the generation of
...
OP_ReleaseReg opcodes. OP_ReleaseReg opcodes are usually only generated for
SQLITE_DEBUG builds and are used to verify that registers are descoped
propertly. But they can get in the way of code understanding when studying
bytecode dumps. So this new optimization setting is provided to
temporarily turn OP_ReleaseReg opcodes off.
FossilOrigin-Name: fa5276725f246cef9d58b27c1e617ee3f873f7a9b88284a4e8fc453ebda338bc
2022-04-07 18:17:56 +00:00
drh
db08a6d13c
Fix the parsing of C-style comments in Lemon, as reported by
...
[forum:/forumpost/b6edc69548|forum post b6edc69548]. This has no affect
on SQLite itself.
FossilOrigin-Name: 201569e09b000919ccb463bd581fb2ecd5320e7f584fdb1bc2aaba111061d5c3
2022-04-07 14:13:32 +00:00
drh
a744167956
Optimization to sqlite3TriggersExist() saves over 700K CPU cycles.
...
FossilOrigin-Name: 5043a3507e0781878e0e1bea5095a33273958820baead4af8fc2929e9d7c07ee
2022-04-07 14:03:07 +00:00
drh
4cd8296f39
Avoid compiler warnings about the new sqlite3Show() debugging routines
...
begin "defined but not used".
FossilOrigin-Name: 47ddc26974fbad8233c953d435e79d4f5dd5e09fbd684ea5f4ad32f4cae6cae6
2022-04-07 13:48:34 +00:00
drh
9c949b1c46
Omit an unnecessary initialization in tokenExpr().
...
FossilOrigin-Name: 8f6ae686019c61a03fe70eb78d2b529b1cf126215b45513a97cfdf7086f82f54
2022-04-07 12:10:00 +00:00
drh
c381056e6d
Fix harmless compiler warnings.
...
FossilOrigin-Name: 61095b5bcb5c30d29f03efa5b4809e3a0b780ed57e35227c292aab9dd1cfe3f6
2022-04-07 10:11:35 +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
200adc9e75
Faster parsing of the FROM clause in joins for the common case where there
...
is no INDEXED BY clause.
FossilOrigin-Name: 848b7a0ea99ddc52091b78313f018c07d00a0e28aa6da8c1cae709c1d03468fe
2022-04-06 19:46:20 +00:00
drh
c2d0df95ba
Improvements to the display of AST for DML statements.
...
FossilOrigin-Name: 84c239a071cfaf8af107646f01ef269e2915fd2384e95927d484f2e408ba6bbf
2022-04-06 18:30:17 +00:00
drh
2a7dcbfbb0
Attempt to show triggers in the TreeView output from DELETE, INSERT, and
...
UPDATE statements.
FossilOrigin-Name: b0939d6f4d94b45dce53ace6295508a67d574cc72bd6977623bf77065b3c4e64
2022-04-06 15:41:53 +00:00
drh
c16a5686fe
Corrections and updates to the header comment describing the
...
TriggerStep object. No changes to code.
FossilOrigin-Name: abb34c0830a49d4f4e277ddd17e710529e87cba7061f3546079dbba2f82b020e
2022-04-06 12:54:41 +00:00
drh
8f1eb6f5e4
Add the sqlite3Show() family of debugging interfaces under SQLITE_DEBUG.
...
No changes to deliverable builds. Rename SQLITE_ENABLE_SELECTTRACE to
SQLITE_ENABLE_TREETRACE in ctime.c.
FossilOrigin-Name: bc33168cf1f48caf848c2dc5c3ae15e4efff8c0378f944eb5398a245139a2b35
2022-04-06 12:25:04 +00:00
drh
5e431bead8
Rename debugging defines and variables from SELECTTRACE to TREETRACE (and
...
similar) since the functionality has how expanded to include data structures
beyond SELECT statements. Should not affect deliverable builds.
FossilOrigin-Name: 393fa32e188a017f431372b54037cb31e885030542f00d0bfd59da9d9db5c014
2022-04-06 11:08:38 +00:00
drh
f8ef2dbd7b
Add additional tree display routines for DELETE and UPDATE. No changes
...
to deliverable code.
FossilOrigin-Name: fbd288ff3d4ea47cd324b5952e7754a465901844f2d950f0860d4488d5b6eb9f
2022-04-06 10:37:44 +00:00
drh
7d2c1d24b0
Add new diagnostic "sqlite3TreeView" routines for IdList, Upsert, and for
...
INSERT statements. This is all debugging code. There are no changes to
release builds.
FossilOrigin-Name: f3084122039bcb30c8617f5f432009a49be8b488235850a1f10ef862c91560b2
2022-04-06 00:29:21 +00:00
drh
ec534e6a23
Small performance and size improvement to OP_Found.
...
FossilOrigin-Name: 81587a18b7c0516628453000172a0c58e74ee173c15f655d035799d84d4e2d81
2022-04-04 20:20:22 +00:00
drh
50f22d17a8
Tag an always-taken branch using ALWAYS().
...
FossilOrigin-Name: ad8bc3d7443ff57ce5a8756428e717ac42ec0295191a9b4d7ae44846d8fa03a2
2022-04-04 19:58:55 +00:00
drh
b834e0de59
Optimizations to the OP_Found opcode save about 600K cycles in speedtest1.
...
FossilOrigin-Name: 5c3357ad62843fe982b9c2d31dbf02018f2948ceab2c85dac917cd9ce1e97dd6
2022-04-04 19:43:57 +00:00
drh
36d2d09023
Use unpacked keys for OP_Found in foreign key processing.
...
FossilOrigin-Name: 328dc76657eb5317f0201859d2b3abe6918103b894f7beaed0aca3058a9f2b64
2022-04-04 18:17:59 +00:00
drh
0de10ac11c
When constructing the JSON Path for the "fullpath" column of the
...
json_tree() and json_each() table-valued functions, be sure to quote
object labels where necessary.
FossilOrigin-Name: 0fbbe7881cadf0b3c211653c7a0797e0a90c7c24da78ecc8a27140c05f89f2ed
2022-04-04 15:15:45 +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
a81a9f78fd
Performance optimization and stronger assert()s in the comparison opcodes.
...
FossilOrigin-Name: e0305e640b9078c7eed9ab0bcc14f4515b54e7cd9ade3306bc2d1660f05b2725
2022-04-04 11:38:49 +00:00
drh
1c8486301f
Only invoke sqlite3VdbeClearObject() from a single location, so that the
...
compiler is more likely to in-line the code. Performance increase and
size reduction.
FossilOrigin-Name: c6947a96e61f71aa61ca3d70d9e2612d784ab04d60fa88852b03cfce86b1bf2b
2022-04-04 01:12:11 +00:00
drh
8703edd3e9
Performance optimization in the sqlite3VdbeHalt() routine.
...
FossilOrigin-Name: 9564d72a0820dbcb38f905fcd42ed4c858ea8fb5f648b189ceb65380a14a785b
2022-04-03 22:35:13 +00:00
drh
8bb93daca0
Performance optimization and size reduction in the OP_Halt opcode.
...
FossilOrigin-Name: 21948e6e1ccd2ce128742415d21759604ecb8902226ec4707dbd75585450f208
2022-04-03 20:39:48 +00:00
drh
18bcfb999a
Omit the Vdbe.runOnlyOnce flag (simplifying the prepared statement
...
implementation) and accomplish the same result by adding an "OP_Expire 1 1"
opcode to prepared statements that would normally have runOnlyOnce set.
FossilOrigin-Name: 6e20e1c46d17ac6aba21e02b57649af51cfa415d83d0c001b30677d2fd1f1dc1
2022-04-03 19:13:40 +00:00
drh
8ee75f7c3a
Performance optimization and slight size reduction in the OP_Transaction
...
opcode.
FossilOrigin-Name: 7bee8c195f3fc27aaab13e493ad446a4f19201de3ac064ed6d8a3cbda7c69ee1
2022-04-03 10:42:06 +00:00
drh
c2808f39d1
Expand the getVarint32() macro in a few places, as the C-compiler seems to
...
be able to optimize better when that macro is expanded manually.
FossilOrigin-Name: cd4fe34b98bf5ce26f3596c717edb73932f3b46ad6e9b4934d06b7b3c176a0d6
2022-04-02 22:47:47 +00:00
drh
1f416db292
Fix harmless compiler warnings.
...
FossilOrigin-Name: 8a3a3486358d076c34e515ac92663a04f0c7ff10f405094cb5b6ada0d5f05cdc
2022-04-02 20:08:48 +00:00
drh
d13527daed
Ensure that a zero-blob does not cause in invocation of memcpy() with a
...
zero length and a NULL source pointer.
FossilOrigin-Name: 35441eb5e1447e01f2031837a4ede705bce34f87be27912278cc730abce6cf05
2022-04-02 19:21:58 +00:00
drh
2c144b0f63
Minor loop optimization in OP_MakeRecord.
...
FossilOrigin-Name: 4350983b37879d3280432d90fef04f5cc4be1b3110b5435123d897e31b34db8a
2022-04-02 15:19:02 +00:00
drh
d859dc2b25
In-line the sqlite3VdbeSerialPut() routine into the OP_MakeRecord opcode.
...
This allows some duplicate comparisons to be omitted, resulting in a size
reduction and performance increase.
FossilOrigin-Name: 6f4d6f212a3558c27be6e9dcf71cec43c424d445e5889c6e91dde84a19c5a2c1
2022-04-02 14:30:58 +00:00
drh
b47b1f67dc
The putVarint32() macro does not optimize well. So expand it into in-line
...
code in places were performance is an issue.
FossilOrigin-Name: 390c239e53cf936a97b268dce8171f0b17050542ae64735ca8ef375fec2c9544
2022-04-01 21:01:37 +00:00
drh
759e507ce5
Loop optimization in the OP_MakeRecord opcode.
...
FossilOrigin-Name: 47a61fbd63928021098fbe492283f1afda7c293b3b2706c001192ae4ff1b2cbe
2022-04-01 20:39:40 +00:00
drh
3b8b5be3b7
It is not necessary to de-ephermeralize the output registers in the
...
OP_ResultRow opcode. Omit that step for a size reduction and performance
increase.
FossilOrigin-Name: 8a07745aed1d0a4eead55d43f1923597b12371f307ecf5bc19c5a1db9a107a50
2022-04-01 20:19:36 +00:00
drh
35e9e350ca
There is no need for sqlite3_step() to check for an OOM condition prior
...
to starting up.
FossilOrigin-Name: 44be7f46ba89289683ed0e123169ca9adb1018de03071d66de480c910a23d074
2022-04-01 19:13:39 +00:00
drh
a24832b7b2
Omit the Vdbe.doingRerun field for a slight size reduction and performance gain.
...
FossilOrigin-Name: e93297a9d775688e6274c54ba75b19fc1fe8b29b73b9b5e7f94f3f2ca37f045f
2022-04-01 19:04:13 +00:00
drh
cf6e3fd787
New macro ROUND8P() which works like ROUND8() but assumes that the input is
...
already a multiple of the size of a pointer. It becomes a no-op for
64-bit machines, giving a small size reduction and speed boost.
FossilOrigin-Name: d126f304cde66ebfe21a4967c22dcba0bac27cbce56318b14bd50051e49c978c
2022-04-01 18:45:11 +00:00
drh
473571b083
Provide and use a version of sqlite3VdbeFreeCursor() that guarantees the
...
cursor pointer is not NULL. This saves a few bytes of code space and a
few CPU cycles.
FossilOrigin-Name: cb5e6f8e265c91221227e5f15b95798c688773262407dd138d414103184702f6
2022-04-01 18:19:04 +00:00
drh
2fb448f2c8
Remove an unnecessary branch from sqlite3VdbeReset().
...
FossilOrigin-Name: a7d79560a0efd6221ba59ce84bcb4fa94024a901ac4a45e192ddecc6e1b5c78c
2022-04-01 17:23:17 +00:00
drh
17c4865b83
Refactor the Vdbe.iVdbeMagic field into Vdbe.eVdbeState. Split the RUNNING
...
state into separate RUNNING and READY. This gives a size reduction and
performance increase.
FossilOrigin-Name: 5a50a42fde9477868fad31099f5fe976437825fac44f8b3a4cf6c739c7667bbb
2022-04-01 17:01:57 +00:00
drh
00946d7953
Avoid a harmless uninitialized variable warning in PRAGMA incremental_vacuum.
...
FossilOrigin-Name: 6d976f90dfe4886c3f4c062151af5c5ca7454d34b71172401b8c67acd2d663a0
2022-04-01 16:22:41 +00:00
drh
659fdb4da8
Have the sqlite3_context object carry the encoding for the prepared statement
...
that it represents, so that sqlite3_result() and similar can set the encoding
according to the prepared statement, even if the database encoding has
changed.
dbsqlfuzz c409b10d0a6bccf78ab00f47e1d29d42ee5b3565
FossilOrigin-Name: d4e19314f564126e180e091f9135c7bc55a10442edb46fbd3a4cfad21201dfa6
2022-04-01 15:31:58 +00:00
drh
99a218282c
Split out the RUN state into separate READY and RUN states.
...
FossilOrigin-Name: d698826b08b88e227eb83f84b3cdb19f17306b532eccfa162090abccdf3c63d8
2022-03-31 21:15:09 +00:00
drh
66181ce2b8
Rename Vdbe.iVdbeMagic to eVdbeState. Remove unnecessary states. This is
...
a preliminary step toward splitting RUN_STATE out into several other states.
FossilOrigin-Name: ff91191d232305d44ae6c0fbca2542a749422dc716fa1fd5d54f58c7d6052c14
2022-03-31 20:04:49 +00:00
drh
c4c0ff8664
Fix harmless compiler warnings.
...
FossilOrigin-Name: b916087aacba53530d2bd19eef2a4fd7a253bf7fa87b49e0df17f7987d7164ae
2022-03-31 16:09:13 +00:00
drh
89cf958c00
Refinement to [3f9887d4a58cbfdb]: The SQLITE_CONSTRAINT error should only
...
be returned if the prepared statement came from sqlite3_prepare_v2(). The
legacy sqlite3_prepare() is documented to return only SQLITE_ERROR.
FossilOrigin-Name: f2d9262e4427ab37ba26c004fc7a4790c86c1856d695a6b4ec3e72732ea54c09
2022-03-31 11:12:56 +00:00
drh
7e62146b13
Faster and slightly smaller implementation of sqlite3Step().
...
FossilOrigin-Name: c6901a8c78838228f8135c9346b214e638b72086fd85367b9ff482273e62ece6
2022-03-30 17:56:27 +00:00
drh
66f58bf38d
Small size reduction and performance increase in sqlite3FinishCoding().
...
FossilOrigin-Name: 9248ce50f57fb9c4ba67949fdf9c9567c3e626cd9dd1b41b71c602d29c77c43e
2022-03-30 17:36:40 +00:00
drh
c55b62d4cb
In setResultStrOrError(), if the input string pointer is NULL and hence the
...
value gets set to an SQL NULL, then the Mem.enc field is uninitialized. So
do not read it. This is a harmless OSSFuzz/ASAN found problem.
FossilOrigin-Name: 47d0b1c4cfc3d2d8f57a02079276bb70a205ffd0f18007dd39c92f813d4c87f5
2022-03-29 22:57:00 +00:00
drh
4cb32b70ed
Ensure that sqlite3VdbeMemSetStr() always leaves the value in a consistent
...
state even if there is an error.
FossilOrigin-Name: c86ab289ec31ce9ae0abaf103a829b8d1e5ed632f493456f1f40607aeb91b41c
2022-03-29 20:50:20 +00:00
drh
555db979f6
Reverse the order of two tests to stop a harmless initialized value
...
warning from MSAN - reported by OSSFuzz.
FossilOrigin-Name: 800b8fdad73b67105e416b4b5c6a5c5ded7d6a43b4eacd6b67d690cab7584b0b
2022-03-29 19:19:23 +00:00
drh
de9484858e
Avoid unnecessary calls to balance() from sqlite3BtreeDelete().
...
FossilOrigin-Name: d0966d1bdd474e27cb048884d340184f0e81a4fab65eb6b74682b20630caddf8
2022-03-29 13:16:32 +00:00
drh
fb92e07186
Fix the sqlite3_result_xxxxx() routines so that they all check for and
...
perform any necessary text encoding conversions and check for oversize
strings and BLOBs. Thus those checks can be done where they are most
efficient and avoided in cases like OP_Function where they are more
expensive.
FossilOrigin-Name: d50b162b2f2e320af0889b931351f9443580465a933f6657fa98f437b6579277
2022-03-29 01:43:09 +00:00
drh
bcedbb2781
Further size and performance optimizations for sqlite3VdbeMemSetStr().
...
FossilOrigin-Name: 310a3e102d8eedf92ee63ffffb48621abfb1e2736b96bd2a676d63cca0f40598
2022-03-28 18:34:40 +00:00
drh
f4dd18ea36
Slightly smaller and faster sqlite3VdbeMemSetStr().
...
FossilOrigin-Name: 06928e745c7bcb26ec46a17989f30efe3536fd48a74c8a1cd423cc9ff6feccb5
2022-03-28 17:34:46 +00:00
drh
60a512d923
Performance increase in the loop that frees an opcode array.
...
FossilOrigin-Name: 4ccebb86aae178dbce905d782f04d98211f8fce9aacd71c12b8694c92a4f5c40
2022-03-28 15:06:36 +00:00
drh
cea170ec96
Another small performance gain by using sqlite3DbFreeNN().
...
FossilOrigin-Name: daa924af987253345bdb1c71b13378681bd252521e94d01f5d4629601232c352
2022-03-28 14:56:47 +00:00
drh
da3ec15f3c
Use sqlite3DbFreeNN() instead of sqlite3DbFree() in a few hot spots for
...
better performance.
FossilOrigin-Name: b12de0ecc78a4f654c8e7b2b17cc2201688808a4f516908e9563a216677e655c
2022-03-28 14:18:03 +00:00
drh
f5a8386c32
Performance optimization in the memsys5 memory allocator.
...
FossilOrigin-Name: 949133231f8f751aa86518d0d3f6f03d7827fec085bfef3929fa3d57369d0216
2022-03-28 13:22:54 +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
5705b41fb8
The "PRAGMA writable_schema=ON" flag should not allow OOM errors to pass
...
while parsing the schema.
dbsqlfuzz 9cc49e1a53e1cef8e3a1496a88c683aa20483163.
FossilOrigin-Name: a7abb725c7c783331e73837597917e25e5ff692aac8ec97a0a8c0e30db62d68b
2022-03-24 14:01:55 +00:00
drh
8ad3c43257
Use trickery to code the UTF-8 BOM for the --bom option on .output, .once,
...
and .excel in the CLI, to work around a warning in some Microsoft compilers.
[https://fossil-scm.org/forum/forumpost/bd0844268f0fab71 |Fossil forum post bd0844268f0fab71].
FossilOrigin-Name: 43143ad131f17734fd2eff849e0a1bc2e26daf6a28c7e07d697d38732e6af5fc
2022-03-23 10:04:52 +00:00
drh
500d7e542c
Ensure that database corruption does not cause the cursor passed into
...
sqlite3BtreeDelete() to be invalid.
dbsqlfuzz 209bf3de9ee11ae440848ab9bc9c13858f9be2e4.
FossilOrigin-Name: a85126f96614c53b030c6e6c43ff239eae458048597a10e9a0361fcec8628ecf
2022-03-22 23:33:20 +00:00
drh
56d88aad29
Harden the xShmLock method of both the unix and Windows VFSes so that they
...
are robust against being invoked when the SHM file is not open.
FossilOrigin-Name: 67d8b434f628d44c4a90ce8ff5ab2e381f500bb42bdbfab9a17d21925a2ec6cd
2022-03-22 19:41:55 +00:00
drh
6fad5776c0
Make the sqlite3_serialize() and sqlite3_deserialize() interfaces accessible
...
to loadable extensions.
FossilOrigin-Name: 81f8746bc65828fb91e170393f22f1f4e9c587a8938e8c11b72315fcd6131403
2022-03-22 11:22:55 +00:00
larrybr
b5bb769c27
expose sqlite3_{deserialize,serialize}() in sqlite3ext.h
...
FossilOrigin-Name: da874180d35aacdeb9c06f5b425e8909d833e2765179c4337854d56b8a624fd5
2022-03-22 03:03:13 +00:00
larrybr
cb0854a380
Create new branch named "extapi-serializing"
...
FossilOrigin-Name: a1220a2170a09075a42d1d6c4b502ffa7cc92856779b9eb2ecb9e05c09ccedac
2022-03-22 02:53:34 +00:00
drh
a753a3a2be
Do not allow an #ifdef inside of an assert(), as gcc tells us that is
...
not portable.
FossilOrigin-Name: c7a2047e93df36c172be0be773f9a04150dafe7ba1773269d74016418d262fc4
2022-03-21 20:08:13 +00:00
drh
c63e40956b
Some branches are no longer reachable after the previous change. Mark them
...
accordingly. Also improve comments.
FossilOrigin-Name: 88d69f60cceb22bde42cfe43c23259c7bad47b8e06f918a79bd089a77b480d46
2022-03-21 18:48:31 +00:00
drh
bd5fb3a888
Strengthen the defenses against corrupt databases in the
...
sqlite3BtreeInsert() function of the btree module.
[forum:/forumpost/c7ec29905f|Forum post c7ec29905f].
FossilOrigin-Name: 4df301c8610c4c36b4eb360d49ccaef873c63ea719ccb14b357754ff0b3ea5ef
2022-03-21 18:17:09 +00:00
drh
67aa2318c1
The previous assert() fix was not correct when building with
...
-DSQLITE_ENABLE_OFFSET_SQL_FUNC. This is the fix.
FossilOrigin-Name: c0a4767fef27cfe4fdc1d8a29342998095894769a63d84e37ec47ced7ce4e5f7
2022-03-21 15:42:42 +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
drh
ef07f96faf
Fix an assert() in sqlite3TableAffinity() that might have been false if there
...
was a prior syntax error in the query.
FossilOrigin-Name: 23fdb169ca1622369cd44fd641946c37fef09071625838b3b9c86c31244ed205
2022-03-21 11:32:45 +00:00
drh
9198f5afac
In the CLI, disable the zipfile and sqlar extensions in --safe mode.
...
FossilOrigin-Name: d8b65a2dab97392ff81bcc33ff707b4e626a10d84a258c6452e45f90cd2c7f45
2022-03-19 15:19:35 +00:00
drh
d5c35f6d69
Fix the zipfile extension so that it knows that a zero-length BLOB returns
...
a NULL pointer.
[forum:/forumpost/ae86934905|Forum post ae86934905].
FossilOrigin-Name: 5f6d56737caefa78e542a7af2f95646e3a818e0ecdd8e838f3c2978500ce960c
2022-03-19 12:48:14 +00:00
drh
389e056bfe
Change a conditional into an assert() due to the change in
...
[387ab17b8a0a4b87].
FossilOrigin-Name: 13b584869f40ea6aa2190dbac64709695ee8d72b27bc5afb8b39ab3763b9c46a
2022-03-17 23:49:58 +00:00
drh
b45e1d674a
Add a 4th output code (value 3) from the sqlite3_vtab_distinct() interface
...
that indicates that SQLite wants distinct results that are sorted.
FossilOrigin-Name: 135d8b97b01f9b5204f486f828c274c2d779c17723e79171ca61f738746adf8e
2022-03-17 22:09:17 +00:00
drh
d6df8550b2
Updates a comment and an assert().
...
FossilOrigin-Name: 0c5be14aac07222b9cd2404ae485b6587f8cb2899e776bc45f1f1117bdd7e9b7
2022-03-17 18:03:08 +00:00
drh
494317ad57
Another fix for a corner-case in sqlite_offset() - this one having to
...
do with computed virtual columns in a WITHOUT ROWID table.
FossilOrigin-Name: 84ddd19bcec99f04b43b1a823477457758a2d93ea9beda43598e1234ea07776c
2022-03-17 11:23:13 +00:00
dan
247d09462e
Add extra test cases.
...
FossilOrigin-Name: 0a922d141749cf3ef672f56449001e03f1a7e31822b66dcaf8550bb6e1b88cd3
2022-03-16 19:28:18 +00:00
drh
2f3e34624a
Update the sqlite3_vtab_distinct() documentation.
...
FossilOrigin-Name: 88929d85e2ae81c51634ddb65ebec439958b63581016f9ccb4f5388715b3fe3f
2022-03-16 14:51:35 +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
836652952f
Calling sqlite3_value_dup() on a pointer value results in an ordinary
...
NULL. [forum:/forumpost/ae8592cc73|Forum post ae8592cc73]. Test cases
in TH3.
FossilOrigin-Name: fff1243b594c190d15f14b7ca4e60d23519cd15134f275991c685966fcc24145
2022-03-14 23:50:38 +00:00
drh
d024eca323
Fix an assert() statement in the covering index optimization for the corner
...
case of dealing with an sqlite_offset() SQL function call.
FossilOrigin-Name: 3950b7d006add571579158c751247a9435801e53eafd84b43dd3046e01da8ee6
2022-03-14 22:58:04 +00:00
drh
1a25be1a9a
Disable trigger coding while running sqlite3_declare_vtab().
...
dbsqlfuzz 97e1865771b4226f29e6e482411c1cae14133f50
FossilOrigin-Name: 387ab17b8a0a4b87903aab52abc7da79098b882aff2ab687a554d5794e9d183e
2022-03-14 20:31:57 +00:00
drh
90402d4d54
Foreign key constraint failures should return SQLITE_CONSTRAINT_FOREIGNKEY
...
even if there is a RETURNING clause. See
[forum:/forumpost/e6be6e82c86aa59b|forum thread e6be6e82c86aa59b].
FossilOrigin-Name: 3f9887d4a58cbfdbabf2a37e975c81ba660f373414058920b379f3a81e6e1c2c
2022-03-14 16:54:05 +00:00
drh
5a1f761218
Add a comment linking a part of the UPDATE constraint checking code to
...
one of the corresponding TH3 test cases.
FossilOrigin-Name: 0606e8e93edb5de4d154f377dbf91f15295d25ca9013c0f1612ae6d63a0139ea
2022-03-11 15:42:05 +00:00
drh
27e456458e
Fix a harmless compiler warning.
...
FossilOrigin-Name: 5d739aff96c47146dba72fd76fed62d4e43ded09b32246fdde13d5467f713135
2022-03-11 15:16:50 +00:00
drh
605137aae6
Fix a harmless compiler warning and restore performance in the
...
sqlite3BtreeIndexMoveto() last-page optimization.
FossilOrigin-Name: 8b032293b384c3728c27b0658ee634c028c0d231d067de8b747d2e9e4ae704a7
2022-03-11 14:20:06 +00:00
dan
7ef4d75bd2
Fix a case in fts5 where a corrupt database could cause a crash.
...
FossilOrigin-Name: 5e95df261cce275adb5b2226e9584f4c389bb0d53c3b4feafd5a14be8d02ce63
2022-03-11 12:02:18 +00:00
drh
3946561a7f
Another corruption detection case in the sqlite3BtreeIndexMoveto()
...
last page optimization.
FossilOrigin-Name: 531e6ad0389c6c820bb8c64db5049fb6b0bffd30bd394fd8ee7412959b1752e2
2022-03-10 23:37:58 +00:00
drh
463edb6275
In the sqlite3BtreeIndexMoveto() last-page optimization, make sure to return
...
SQLITE_CORRUPT if corruption is detected.
FossilOrigin-Name: 4ef19ba9b5cbda435c0bb9f2faddf8f7fac5d51399ff69bd049571c2ca3d9357
2022-03-10 22:54:32 +00:00
drh
fde3043200
Stronger defenses against corrupt schemas in the ALTER TABLE logic.
...
FossilOrigin-Name: 13fbde28173332522a7ad307c1aad2b83c9aa1fe737583afa2b29f6da4de6370
2022-03-10 21:04:49 +00:00
larrybr
551b650236
Amend sqlite3_column_*() doc table. (no code change)
...
FossilOrigin-Name: 1f473099776249f774a285fa117316636e00c3ff030ba0f22ed5bd05641c1bc9
2022-03-10 19:44:04 +00:00
drh
5e121a50b3
Prevent a NULL-pointer dereference when trying to parse a illegal
...
schema entry that contains a window function while doing a RENAME COLUMN.
[forum:/forumpost/ec2a2e0deb|Forum post ec2a2e0deb].
FossilOrigin-Name: 58de3c2b1a773a71b2d6a5d9a4dc0f839185d78d64519e7d267ad133b9830120
2022-03-10 16:26:00 +00:00
drh
105dcaa503
Refactor Window.pFunc into Window.pWFunc to disambiguate from other uses of
...
the variable or field named "pFunc".
FossilOrigin-Name: d9475ebcde169272ad7b1d3a82b2326df55dafc68217bfecd9fcd1f2b89efbd9
2022-03-10 16:01:14 +00:00
drh
7931f0a3d8
Only run atof1.test on x86_64 machines.
...
FossilOrigin-Name: 4173819cd285a1c133645eda27b9f6dc5a2247eaa0c834bdc60058ef3109b102
2022-03-10 11:48:16 +00:00
larrybr
a1d60e6c8c
Mention that sqlite3_column_text16() returns have native endianness
...
FossilOrigin-Name: 25b7f88fcb2bb1908abde109c1167c462efbb156b4a8a8f94d36202bd93ea433
2022-03-10 02:23:43 +00:00
drh
6a51e70c5f
Check-in [642a0b4752743216] fixing sqlite_dbpage is not exactly correct.
...
This patch should fix it.
FossilOrigin-Name: 6ba36714ca5e5457bc424273129f2814b62b7fae38926aa6eeeeec81020d7f70
2022-03-10 01:10:28 +00:00
drh
6563d0c11a
Further refinements to the sqlite_offset() fix from [6029514b08b88e3f].
...
FossilOrigin-Name: 6f838305e2c848a43b210bd1b7b962fb9e3c41de34de778675e6578fcd99f397
2022-03-09 18:29:19 +00:00
drh
46dc631a32
Fix the sqlite_dbpage virtual table so that it starts a write transaction
...
on all attached schemas.
FossilOrigin-Name: 642a0b4752743216271e4f855a465515ef7f6a985f280251e18d67e3d5fb694b
2022-03-09 14:22:28 +00:00
drh
b528a5a04e
Do not use va_arg() as an l-value, because
...
[forum:/forumpost/45e39c1311|AIX does not allow that], from what we are
told.
FossilOrigin-Name: 46d1a6de620f26fef9d0e2de6e9ea032790016441e4e6228a2f8cb30e20c9a51
2022-03-09 13:22:53 +00:00
drh
577f0a1e45
Improve the defenses against bad pathnames input into the findCreateFileMode()
...
function of os_unix.c in order to quiet static-analyzer warnings. There
are no demonstrated problems in the prior code, but this change makes the code
easier to prove correct and more robust against future changes.
FossilOrigin-Name: a9cda38997a692e25d2fe994a9a3fb9472c00ba04323c82e706fdb1112d4244e
2022-03-09 12:20:40 +00:00
drh
32135d7e0a
Fix a minor typo in a comment.
...
FossilOrigin-Name: cf61419f8816377f40ea032e1e3fb8b765ff7eb5b3a5ece8f7b59acffc5d3f05
2022-03-08 15:49:17 +00:00
drh
e684ac6f12
Fix compiler warnings.
...
FossilOrigin-Name: 5e30c6ea707f9d381127e8b2bb59e0b39bc00997da2c14d32a0e302d0121203b
2022-03-08 13:59:46 +00:00
drh
ec9b622fbf
Disable an assert in moveToRoot() when the database is corrupt.
...
[forum:/forumpost/e9a176b7bd|Forum post e9a176b7bd].
FossilOrigin-Name: ae464a18d74bf44fc95bc335e75e6a57dc974f6d6a3d603133594039fb589af2
2022-03-07 18:32:08 +00:00
drh
42bb09c412
In the stay-on-last-page optimization for sqlite3BtreeIndexMoveto()
...
(check-in [0057bbb508e7662b] about 16 hours ago), be sure
to clear the BTCF_ValidOvfl flag, since the overflow cache is invalidated
by the search on the last page. OSSFuzz issue 45329.
FossilOrigin-Name: 0021bebc162e001b788786703ce634e7b8fcd3976f7047a5956e82140791e765
2022-03-07 17:19:40 +00:00
drh
4c460bbffd
Do not allocate new Trigger objects in the parser following a syntax error,
...
to avoid violating invariants associated with Expr nodes. See
[forum:/forumpost/2024e94071ef1531|forum thread 2024e94071ef1531] for more
information.
FossilOrigin-Name: 5e0ed49b3d739d292f5df3e498449ae8f4357cbb83394181fb34f98ed8372707
2022-03-07 16:22:31 +00:00
drh
6d6ea42a25
Fix the code generated for vector IN operator constraints on virtual tables
...
so that they work even if the "omit" field in the sqlite3_index_info object
is off. This has apparently never worked correctly before. Presumably, nobody
has ever before written a virtual table that can use vector IN operator
constraints and that relies on bytecode to double-check the constraints.
Test cases in TH3. Problem discovered by
dbsqlfuzz cab8e26194a40147627094f3c6849c0a7b1e0310.
FossilOrigin-Name: 21b656572d066b640ff5774205a4f0db13e1b08a35d0fd484da9130e759b0c26
2022-03-07 14:51:29 +00:00
drh
c5a55db75d
Optimizations to sqlite3BtreeIndexMoveto() avoid unnecessary comparisons if
...
the cursor is already near the end of the table and is not moving far. This
case is more common that you would expect. The optimization saves almost
4 million CPU cycles.
FossilOrigin-Name: 0057bbb508e7662b0da19e981c07ef10236cb616bda952745de3aa2d1c286289
2022-03-07 01:29:36 +00:00
larrybr
41f46703b8
Disentangle variable use in last checkin
...
FossilOrigin-Name: 4c3a02600f10926da1f88ddbd457bb1486e6e02dee366b5cfc89e498a10daa6f
2022-03-07 00:14:52 +00:00
larrybr
53e1186da9
For CLI .import, revert to importing into temp or main when given table is found there and no -schema option used. And plug an obscure leak.
...
FossilOrigin-Name: bf9d1278846dce9255f9a11ddfc5dfac1acea2eadcb20816a19d59f7bccaec0f
2022-03-06 23:41:21 +00:00
drh
eab1064f04
Fix obsolete but harmless comments in btree. No changes to code.
...
FossilOrigin-Name: 4838b888e431f794b8a5ee65e797b3bf0616c03261de4e1fc9499287eb3e1265
2022-03-06 20:22:24 +00:00
drh
97a985e0c5
The sqlite_offset() function should be non-deterministic.
...
dbsqlfuzz 3df8230bb940870db87ffca2c0fc759c1e7fa356.
FossilOrigin-Name: e1a185e60afd32d3b25278dee42049920759ccd8fe709161007f5daa4a048693
2022-03-06 11:43:06 +00:00
drh
dc9513601e
Remove a NEVER() associated with sqlite_offset()>
...
FossilOrigin-Name: e29dffcdba6f68af5cb76ca250e06a42183d9db92b60a16b2337b0d43c68bf2e
2022-03-05 23:52:05 +00:00
drh
ea840117af
Fix the 'localtime' modifier in date/time functions so that it preserves
...
fractional seconds.
[forum:/forumpost/2ffbaa2c3fd7fb82|Forum post 2ffbaa2c3fd7fb82].
FossilOrigin-Name: 1c875b0764ab00e95c92f0ee329659e88041763e125c2891201d80f68c41f717
2022-03-05 20:12:53 +00:00
drh
8f32d92786
Further improvements to the sqlite_offset() function.
...
FossilOrigin-Name: 4230e2f5e068f2151fa33be25bb06123d41273dbe497a5ebc7173f8d7f81d160
2022-03-05 19:36:29 +00:00
drh
a275e76696
Fix the sqlite_offset() function so that it gives the correct answer even
...
if the argument is a virtual column in an index-only query. Test cases
in TH3.
FossilOrigin-Name: 6029514b08b88e3fb3c0163813af38358490a6b6070b90f69975a324481394e5
2022-03-05 14:44:12 +00:00
drh
768ab1f296
Update obsolete text in the ICU README.txt file talking about SQLite's
...
robustness (or lack thereof) in the face of corrupt database files.
FossilOrigin-Name: dc88fc62f096bcf4df91406f565197f335333388121f860ba4424d9c881b0117
2022-03-05 11:57:28 +00:00
drh
ff55da360d
Do try to evaluate the Bloom filter on a LEFT JOIN early, as doing so
...
essentially converts it into an INNER JOIN. See
[forum:/forumpost/544af7eee2|forum thread 544af7eee2].
FossilOrigin-Name: d46d0e67c96bd49add4f71194496804a31209f2027a2e48eaf36dde26c1ca7df
2022-03-04 20:54:09 +00:00
drh
6f9d68817c
When setting an sqlite3_value object to a pointer value, make sure any prior
...
memory allocations associated with that object have been cleared first.
dbsqlfuzz 33f842d1a09afaad5f078c3e1162a54b78e5f2ab.
FossilOrigin-Name: 31e1bde4b20bec4242b4101adad29bfa85648ea703d6e8c5c75e8c49b54a3a0f
2022-03-04 16:28:24 +00:00
drh
07559b2716
Restore the ability to push-down OR subterms of the WHERE clause when
...
processing a multi-index OR.
FossilOrigin-Name: d71fb6fdc32d2fce73059b6ab86d7d7bbc812c637469755dd45b6794aadc3a80
2022-03-03 19:40:21 +00:00