1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-11 01:42:22 +03:00
Commit Graph

14444 Commits

Author SHA1 Message Date
drh
d901b168b5 Overnight, OSSFuzz helpfully pointed out a potential use-after-free bug in
yesterdays changes, involving continued use of a pointer after the memory
pointed to had been realloc()-ed.  Thanks Google.

FossilOrigin-Name: c422afb507dc875751e6a72e4ba5f4f0793097c0de4533c1600311f689e76ed7
2019-10-26 12:27:55 +00:00
drh
0660884ea0 Add missing VdbeCoverage() macro. Fix an off-by-one error in partial index
handling.  New test cases.  Ticket [c1e19e12046d23fe]

FossilOrigin-Name: 41cc8e3dab998f7efc898d18837ca7fdac94ea3f89954990c5231456bf725fee
2019-10-26 01:43:14 +00:00
drh
a407eccb61 If replace triggers are run during uniqueness checking, then rerun all
uniqueness checks a second time using the ABORT algorithm.
Fix for ticket [c1e19e12046d23fe]

FossilOrigin-Name: fbac0c65d8464b126d385262d176864add55452ec9e3d5eb76ffee06e820cb9c
2019-10-26 00:04:21 +00:00
drh
db561bceda Performance optimization in sqlite3BtreeCursor().
FossilOrigin-Name: ea068b099c96b8b9526114732d2a6be186cf381b7329d102778ad25b95510c9e
2019-10-25 14:46:05 +00:00
drh
06baba54b4 Correction to check-in [bec5b6d4d083556d] so that it detects *all*
triggers that might perturb the insertion cursor.
Ticket [50c09fc2cf0d91ce].

FossilOrigin-Name: 521f1d36282549488a47a434484a24924ee970d29f05a8ae499b7d536bcd692b
2019-10-24 19:35:26 +00:00
drh
269d322de2 When a vector comparison appears in the WHERE clause and the constraint side
has a COLLATE clause on the first term of the vector, be sure to honor that
COLLATE clause.  Ticket [135c9da7513e5a97].

FossilOrigin-Name: 978b2d20cf95d0b7143e3104ce1e9d5c85002867b554dc6b21deb528b730bbc7
2019-10-23 18:09:39 +00:00
drh
db36e255d5 Disqualify row-value comparisons for use by an index if the right-hand side
has an affinity that does not match the index.
Fix for ticket [6ef984af8972c2eb]

FossilOrigin-Name: 5c118617cf08e17a6edfdfba86e3fc49132a780990b68b52724c2aaeac85f506
2019-10-22 19:51:29 +00:00
drh
98c94e60d0 Previous check-in to fix [b47e3627ecaadbde] was incomplete. This check-in
completes the fix and adds a test cases.

FossilOrigin-Name: c7da1c01f1f239e68c2173ac5748b8c5798271e43bdcee68f51f97cd0ca92bd5
2019-10-22 11:29:22 +00:00
drh
a5d0911546 Move the sqlite3LocateCollSeq(), sqlite3FindCollSeq(), and
sqlite3GetCollSeq() routines so that they are all beside one another in
the callback.c source file.  No logic changes.

FossilOrigin-Name: 9ff80a9bf8fee776e2f282d0597215b77d48093ebc71d047ad1457da0582ddbc
2019-10-22 01:00:16 +00:00
drh
898c527eaf When flipping ("commuting") a comparison operator, set the new EP_Commuted
bit rather than adding extra EP_Collate bits, to single later processing that
the order of precedence for COLLATE operators is inverted.
Fix for ticket [b47e3627ecaadbde]

FossilOrigin-Name: 90f7c477354d67d22d5eb0da22dac579f384ab44743fdc19887220e32203ebc2
2019-10-22 00:03:41 +00:00
drh
2c3de90da1 Add a VdbeCoverage() macro that was omitted from check-in [eea1e7aa57e74c43].
FossilOrigin-Name: cd2317d04c1c4bcf5fe63aa02a6051bdfae8f5566a098e3f45bf9ec1dd0c3ea6
2019-10-21 23:41:56 +00:00
drh
491c5bea7a Enhance the ".imposter" command in the CLI so that the first argument
can be an existing WITHOUT ROWID table instead of an index.  The resulting
imposter is the same table, but with columns in storage order and with
all constraints removed.

FossilOrigin-Name: 9dc0d34586eebf6705d9bd81494c417ac76707b8625d1ff99eda18b4ca2d8a50
2019-10-18 15:58:50 +00:00
mistachkin
16fd04cdbe Enhancements to SQL query normalization for UPDATE statements.
FossilOrigin-Name: bba975c7af3de9aeb5c62fb8b05d61b96e4ecd0b030008442bbdd345e1e5f134
2019-10-16 17:46:22 +00:00
drh
2da8d6fe74 If an AFTER DELETE trigger fires when a conflict row is deleted by REPLACE
conflict resolution, make sure the conflict really has been resolved and that
the trigger did not recreate the row before continuing.
Ticket [a8a4847a2d96f5de]

FossilOrigin-Name: eea1e7aa57e74c4329003f4550168e2aed9e33d2301a3ba84b10781a9cebbc1b
2019-10-16 14:56:03 +00:00
drh
4ec3e820a0 Formatting change on a multi-line conditional, for improved clarity.
No logic changes.

FossilOrigin-Name: 7248e3476511ecd317f54edcfe1e87443bfdcc1b10c89c7734eefcabafec6c0b
2019-10-15 19:01:55 +00:00
drh
68748ec509 Futher improvements to the IN operator for row-values on virtual tables.
FossilOrigin-Name: bc751fb64d5b08e5ca4c85cd1c6fbf09590fa9dad7e176ba373082ea373655b5
2019-10-14 20:32:31 +00:00
dan
2d82269ca8 Fix a problem with row-value IN(...) operators and virtual tables.
FossilOrigin-Name: aa57d7abac0bb92d4d5fd4e093a11cf8efc04e4eed748b2a400d01f137250649
2019-10-14 15:15:50 +00:00
drh
a0fe5fe54f When Select-Trace is enabled (in debugging builds only) do not show the
result of Window function tree rewrites if there are no window functions.

FossilOrigin-Name: d1acf72ae1ea7484bb9c3a8630094f1a3a9597578c7b9d6e02fc0a4e3f59c57d
2019-10-12 23:38:00 +00:00
drh
a1698993e6 Futher improvements to LEFT JOIN strength reduction.
FossilOrigin-Name: 8a39167bd2d46496f7484cfec371e4bad22da882209b01da9459c4ed5877da25
2019-10-11 17:14:40 +00:00
drh
4a254f98e3 Improvements to the LEFT JOIN strength reduction optimization.
FossilOrigin-Name: 548082dfab5d9484279ccc11cd2833ac131b54b7481372b576d7c28bbb3294ea
2019-10-11 16:01:21 +00:00
drh
21f6daa2cd Faster response to sqlite3_interrupt() in the OP_IntegrityCk and OP_Count
opcodes.

FossilOrigin-Name: bf875dc59909f9c22f7c1fc843bc4d9e5d97af5cb4ef43c4fa1d566ddfdeaacb
2019-10-11 14:21:48 +00:00
mistachkin
6dcf9a451e Fix harmless compiler warning seen with MSVC.
FossilOrigin-Name: 73a82114733af2a316f20eb8578badef307d14286c6ec03197744a6793425161
2019-10-10 23:58:16 +00:00
dan
0287c95165 Prevent SQLite from assuming that if ((? IS NOT NULL) IS NOT NULL) is true, ? may not be NULL. Fix for [d51a8696].
FossilOrigin-Name: 7833feecfe745e237f239ee4c38a9e4bf7ad66a32919150208da87c00a826473
2019-10-10 17:09:44 +00:00
dan
3703edf110 Be sure to rewrite column references inside FILTER clauses and window frame definitions when flattening queries. Fix for [1079ad19].
FossilOrigin-Name: ccba7202b69d239724c3b589439c9c3b0e1bba237accfeb11c39d492522b8719
2019-10-10 15:17:09 +00:00
dan
da03c1e65e Avoid assuming that an expression that contains the sub-expression (? IS FALSE) or (? IS TRUE) may only be true if ? is non-null. Fix for [a976c487].
FossilOrigin-Name: eb7ed90b8a65748f0721aaf7bdddd2207f552be5015603fbfb7044d815ae2f36
2019-10-09 21:14:00 +00:00
drh
92a2824cc6 An improved fix for the dbsqlfuzz-discovered ALWAYS() failure following OOM in
sqlite3ExprCollSeq().  This time with a test case (engineered by Dan).

FossilOrigin-Name: 907f7965b335d8d5441f2e386bb190d1f93ffcd45ca98d2d1c621dede491fc5e
2019-10-09 15:37:58 +00:00
drh
efb02281a4 Change sqlite3SelectDup() to always return NULL if an OOM has occurred.
FossilOrigin-Name: 01ba4641ab436c6065c8725908fc0913f2abded4ea62e004b7534e0116b9451a
2019-10-09 15:00:37 +00:00
drh
f3ce2483f5 Save CPU cycles in sqlite3Prepare() by, among other things, shifting the
EXPLAIN column label logic over to sqlite3VdbeMakeReady().

FossilOrigin-Name: 1ca5ef84506aac3e2f08baa36095b3befdeedf2a3443fcd9154a277b55cbf64b
2019-10-09 01:19:07 +00:00
drh
38587159dd Omit a pointless memory allocation in vdbeSorterSort().
FossilOrigin-Name: 5d76dbc5b0584c15d7d59e5c079868f2077f32b865f406b40ec837b8ab6ef2e1
2019-10-07 20:33:26 +00:00
dan
03e025e217 Fix a problem with running ALTER TABLE ADD COLUMN statements within a transaction that writes to one or more virtual tables.
FossilOrigin-Name: 31e85fbbc4cfd09a98b4a6dc6624f863816f376c6a4eef1fafc657c8e1abbc36
2019-10-07 18:43:21 +00:00
drh
093589de5e Fix a faulty assert() statement in the sqlite3VdbeMemExpandBlob() routine.
FossilOrigin-Name: 69a26eade2f92029e722a5a654214b1e2a3fc7ed497ce9aa5a7dce944f90e502
2019-10-07 13:26:58 +00:00
drh
b29ef5ef03 Fix the OP_SeekRowid opcode so that it works correctly with a Real argument
without damaging the value in the register that is the argument.
Ticket [b2d4edaffdc156cc].  Test cases in TH3.

FossilOrigin-Name: 3cde82c86b963fa75192907d548febd3882c7d8fc7daf1903fadd5ca46623be1
2019-10-07 01:05:57 +00:00
drh
705e73344e Omit the check for conflicting shared-cache locks in sqlite3Prepare() if the
database connection uses no shared cache.  We might be able to go back and
remove this code completely, due to the newer Schema.iGeneration logic, but
that will take more analysis.  This check-in gives the speed benefit but not
the reduction in code size.

FossilOrigin-Name: 0b73a09270dfafb27f8d1762b547ef8178c9da66f45e7153ff0b76272dfa92f5
2019-10-05 19:53:21 +00:00
drh
1de92a64cd Optimization to sqlite3VtabUnlockList() for the common case when there
is no work to do.

FossilOrigin-Name: fc8d45086dc2bcb9bce756088e99e63cbeedf9129139fb0e6a48b43c4f502180
2019-10-05 19:24:52 +00:00
drh
a22d2fca33 Call sqlite3Prepare() directly, rather than going through sqlite3_prepare(),
when processing the sqlite_master.sql column for a schema.

FossilOrigin-Name: cc49380ea76a4a05843d3a0bdfb925464dc9d72c33cf5ab5243dd07d161ad038
2019-10-05 18:33:25 +00:00
drh
4d29448114 Reorder two comparisons for a small performance gain in OP_Transaction.
FossilOrigin-Name: d7667f6560318272c8b35b478e29b0ed134105dfd119a2fd53ef0490442c60cc
2019-10-05 15:28:24 +00:00
drh
31f69626df Performance optimization to the lookaside-memory disabling mechanism.
FossilOrigin-Name: 17ce1c49cb0ed6fdd8c7c33431bc2afa217f1092c99b8dd608890a8e7aec7fb1
2019-10-05 14:39:36 +00:00
drh
d1c472dab6 Increase the precision of floating point value display in VDBE debugging
output.  No changes to normally deployed code.

FossilOrigin-Name: a561a656ff50efc0103da3988626cea3ef05757403b83960f2aa6c0a48c2765e
2019-10-03 14:51:59 +00:00
dan
b008e4d744 Fix some test script issues that come up with SQLITE_OMIT_VIRTUALTABLE builds.
FossilOrigin-Name: 3934d2d08ee14d644dc01f967c10f219b76b172c963c90a7a8141f2b08a7d5bf
2019-10-03 14:36:36 +00:00
drh
e2b7a7693e Disable sqlite3_drop_module() tests when virtual tables are omitted from
the build.

FossilOrigin-Name: 9f4035f91a9f914797c67afbf19139b2cd25aea48595f7254fe5d18cd693d972
2019-10-02 00:25:08 +00:00
drh
905d4729d3 Add missing comment to constant definitions.
FossilOrigin-Name: 661a3789eb329a2487855e49c31067a9dde4c91c1a3a65b65375d079f906b1da
2019-09-28 18:28:19 +00:00
drh
018dbb17a8 Improvements to a comment. No code changes.
FossilOrigin-Name: 1a3671c7003bfff817a8239424c2f945d9dfced97daadb5a5acab203b9bda69b
2019-09-28 16:14:55 +00:00
drh
e4079e1fc5 Allow compile-time options -DHAVE_GETHOSTUUID=0 and -DHAVE_GETHOSTUUID=1.
FossilOrigin-Name: 3bcb9cc104e0265a600b03415ad955187fc6445ea8e46dc656412cba5bc1d621
2019-09-27 16:33:27 +00:00
drh
ebc6408484 Alternative implementation of the previous check-in which is testable.
FossilOrigin-Name: 102ef64462cf0d78395ccc7ebb8e3bf6b7647c06b7657a037e051697bc08d6b7
2019-09-27 15:15:38 +00:00
drh
818a3b5486 Fix sqlite3ExprCompare() so that it ignores differences in the Expr.iTable
field for IN operators, as otherwise it can lead to false negatives, which
is usually harmless, but can cause problems for an assert() in the window
function logic.

FossilOrigin-Name: 6a204b192a6c6f21988cab217366f21b14c672b81ceadc43675761a6d8c4484f
2019-09-27 15:01:02 +00:00
drh
91f34eab2d Allow DROP TABLE to work on tables name "sqlite_parameters" just as it
does with tables named "sqlite_stat%".  Fix for the ".parameter clear"
command in the shell.

FossilOrigin-Name: e768179baacb2423205a774cc8149fe58ed86a9320102aff4844b1d8933aa1db
2019-09-26 20:05:16 +00:00
drh
d79cd92b23 Test for an OOM condition in resolveAlias().
FossilOrigin-Name: 322eca7f6ad2234059669015aabb773a790e8bc3da95431c9c851ff5342c969b
2019-09-26 16:08:35 +00:00
dan
a51ddb1ed7 Fix a window-functions problem that could occur if an ORDER BY clause contains an alias for a window-function that is not a top-level expression.
FossilOrigin-Name: 1cc6cf6407c6e25aeafeca379a93d0ad2614839c07fb3644e46926fce5f1cfab
2019-09-26 15:53:37 +00:00
drh
b19131a8c6 Add a missing VdbeCoverage() macro.
FossilOrigin-Name: 36d35dbd5a80dc4a149ed7409cc4b43712622fc4c6a8915b4fbb62fd1d6b7763
2019-09-25 18:44:49 +00:00
drh
2829df082c Remove an unused variable.
FossilOrigin-Name: a19884455b9bafcdc769362d61cfd02df1b5643263e004cb533698bbcfca752b
2019-09-25 17:47:41 +00:00