Commit Graph

19035 Commits

Author SHA1 Message Date
drh
54514c9813 Remove unreachable branches. 100% MC/DC in TH3 now.
FossilOrigin-Name: 558865d5c3c297155e1be5ea73effb46a995ea146bd745b23330c94782c6c45b
2018-04-17 21:59:34 +00:00
drh
7ef8a3e666 Added a comment on the assert() added to the previous check-in.
FossilOrigin-Name: 542547c1ce770a1427d3023d8c8fdcb2db7b1e017bc111e3484641f97e42381a
2018-04-17 20:09:27 +00:00
drh
7f5f306b84 Fixes to the logic for constraint check reordering during upsert.
Improved comments on constraint check bytecode.  Add an assert that
prevents the same label from being resolved more than once.

FossilOrigin-Name: 1ddbb0ff5586ef5ca987e4309979f24f95eea883ed68937094a2db2d61e75657
2018-04-17 20:06:24 +00:00
drh
2928546d04 During PRAGMA vdbe_addoptrace=ON, show calls to sqlite3VdbeResolveLabel()
in the debugging output.

FossilOrigin-Name: 9ff07a06cef6e04777d2d5b81f96e8626e835382e62320ecf17b3ff73573e23e
2018-04-17 19:29:58 +00:00
drh
6e341b9347 TK_REGISTER expressions nodes are probably not constant. Make sure
sqlite3ExprIsConstant() knows this.

FossilOrigin-Name: f3d91cad929cfbee8f621425f55b5f12e79567362cf8769a786adb3e1bbef214
2018-04-17 18:50:40 +00:00
drh
dedbc50811 Simplification to the upsert logic.
FossilOrigin-Name: f36d07a5b24cc48e3daa8b18dd34c50d9025c6c0ba019926610538b54f7b66ec
2018-04-17 18:18:05 +00:00
dan
2cc00423a0 Add some more simple test cases for UPSERT. And a minor fix.
FossilOrigin-Name: 27cd3b2fb2ad0cf2b36741bd1057cb7973954d40456e9db158261a38b049d2b5
2018-04-17 18:16:10 +00:00
drh
5015c9b50e New test cases for upsert.
FossilOrigin-Name: 907b5a37c539ea67c285c87399b494c7fe15014389a2ea3d49e90640b58946ae
2018-04-17 16:16:40 +00:00
drh
f1a0223077 Merge the Lemon enhancement from trunk, resulting in smaller parser tables.
FossilOrigin-Name: 641f41722c68f1d51251b10d4d3d7c473d08ee999f6db20023ef6dcd4dc5f6e8
2018-04-16 14:36:34 +00:00
drh
ed0c15b52e Lemon enhancements: (1) Do not allocate space for the 'error' non-terminal
if it is not used. (2) Fix an off-by-one problem so that 'unsigned char' can
be used for symbol numbers if the number of symbols is 256.

FossilOrigin-Name: 3b7801acff91905d0e78e06121ebcf2664f6de5f605699dc8726ec9bcb558eb8
2018-04-16 14:31:34 +00:00
drh
0a6259f539 Remove the MySQL upsert syntax. As an optional alias to the insert table
name in order to finish out PostgreSQL upsert syntax emulation.

FossilOrigin-Name: 810d9f63be46c1452718b05e51c519fb64e9fabf2f1813b5e07b1041dbb71880
2018-04-16 13:26:53 +00:00
drh
eac9fabbc9 Add support for the "excluded.*" names in the UPDATE clause of an upsert.
FossilOrigin-Name: 0203f34faae07fbea0bff2d23b81fb37df8854cded4cdadac5a034132a096b6d
2018-04-16 13:00:50 +00:00
drh
1d621f7f0d Merge changes from trunk.
FossilOrigin-Name: 54d96772e78b7f57d5b590aebe34a139ade73629aebe16677372650b33513b1d
2018-04-16 10:47:38 +00:00
drh
f5ced1f3b1 Increase the version number to 3.24.0
FossilOrigin-Name: f94528e1c70765c8649750b2d9c17f23e81f191554ff56d905a9abe3fb6037b7
2018-04-16 10:41:15 +00:00
drh
25c3b8caf4 Reduce the size of the NameContext object by grouping seldom-used fields
into a union.

FossilOrigin-Name: dba3095feeeb55b5c0ebe33bdd4be8ba1f24478406685d3a042a69d9c380e742
2018-04-16 10:34:13 +00:00
drh
e966a36cf4 Get upsert working on WITHOUT ROWID tables.
FossilOrigin-Name: d3c53fd3177946f50137d48da871de43d78d10ef9990cc4ea6750f7020f89b6a
2018-04-14 22:35:34 +00:00
drh
096fd476c1 Make sure constraint checks occur in the correct order, even in the
presence of upserts.

FossilOrigin-Name: 07fb30c3de7ff396ae2ce8a0d20352b56f17a5db0af99a921c7bfe9bd4018115
2018-04-14 20:24:36 +00:00
drh
0b30a11645 First cut at logic to perform DO UPDATE for rowid tables.
FossilOrigin-Name: a9080bc8b8c5f3b399eb1819bb5009581f178d85bb2b2cca7bc16a7b81b06863
2018-04-13 21:55:22 +00:00
drh
9eddacade9 Add infrastructure for doing an UPDATE as part of an UPSERT. Still no actual
UPDATE code, however.

FossilOrigin-Name: 6d3017f92bce3e50a91fab2f605e2af8b913b1b374adbfd977299eb042683de8
2018-04-13 18:59:17 +00:00
drh
12e40cebb7 Merge the preupdate hook change from trunk.
FossilOrigin-Name: 7353caabb31803ccff83fe188c4ee65e75c883de2beea79cbe17375a4a98d9ac
2018-04-13 16:29:50 +00:00
drh
54f2cd905b Remove an always-true branch from the preupdate hook logic.
FossilOrigin-Name: 0ab4518811b23bdb57feba55014cef07de66028f8fcbf8cf0831a712b2954b91
2018-04-13 16:23:22 +00:00
drh
c8a0c90b62 Get the ON CONFLICT DO NOTHING form of upsert working by mapping it
into INSERT OR IGNORE.

FossilOrigin-Name: d07f05e98bb9ce0f9b46db159d9df161b7499d6face6a5299ecd2d00a94fb8d0
2018-04-13 15:14:33 +00:00
drh
d5af54207d Get the conflict-target clause parsing working correctly, with test
cases.  This change involves an enhancement to sqlite3ExprCompare() which
needs to be reviewed on trunk prior to merging.

FossilOrigin-Name: 5bf704256206f84b3db7a5d8523215604eeb218ef8db86316d1e43ecd7248d6a
2018-04-13 14:27:01 +00:00
drh
3b45d8bfb7 Improved conflict-target matching logic.
FossilOrigin-Name: 98d32ba661f4ba662b639994b74352b695d53a33bc8a498bd09b9e02f794c81e
2018-04-13 13:44:48 +00:00
drh
e9c2e772f1 Back off of the extended upsert syntax that allows multiple ON CONFLICT
clauses.  The syntax now is exactly as in PostgreSQL and MySQL.  Add support
for WHERE clauses on the conflict-target phrase, for partial indexes.

FossilOrigin-Name: 2c1b1987d8de1efa8ed7e1f199710e32ff20edf8ceec570514fc63bb1ef264e0
2018-04-13 13:06:45 +00:00
drh
788d55aa77 Begin adding upsert logic. This is an incremental check-in.
FossilOrigin-Name: 809696434097e62e8ef486c7478b5eb62c0cf1342522a5584939fade82821410
2018-04-13 01:15:09 +00:00
drh
fcfd756fe3 Break out the upsert code into a separate source file.
FossilOrigin-Name: 389806b05f163687d8eb858b0f87f9a2d02e90af9f2097924a66715f05177613
2018-04-12 21:42:51 +00:00
drh
4357e22637 Fix another typo in a comment.
FossilOrigin-Name: 046bb6d25865041477f046f24c39a4791224f5b622ff70eda909d8ee3c097511
2018-04-12 20:21:42 +00:00
drh
7007640f2e Simple comment clarification. No code or logic changes.
FossilOrigin-Name: a26f9c9f89c24048cb77d5c0c8de37f46de7dce80f8bf49cadcd58b239dbdfa7
2018-04-12 19:51:22 +00:00
drh
dab0eb58d7 Extend the upsert syntax to allow a WHERE clause on the UPDATE.
FossilOrigin-Name: e4396c540a22fbc087a01050a32bfad514259d700c2381d7ac912580d7dca00f
2018-04-12 17:28:06 +00:00
drh
6cd7d489db Update the upsert parsing so that it accepts conflict-target labels using
the PostgreSQL syntax, and also accepts the MySQL "ON DUPLICATE KEY"
syntax.

FossilOrigin-Name: c48f64d8ae2625a19267b02e4a173a07766934235ad3052cd9d38f5ecbcbfbc3
2018-04-12 15:43:05 +00:00
drh
46d2e5c35a Add the Upsert object for holding upsert clause information.
FossilOrigin-Name: d83eaed539b274c2abd650d07522f491865d4917acbb64d05d01b3ba5c3cd446
2018-04-12 13:15:43 +00:00
drh
35e86bf15d Merge changes from trunk.
FossilOrigin-Name: 9f6f11805eb7cc02f7eb3044250f3981d46d2dbf0c421bd73e7f8b437390db25
2018-04-12 12:25:45 +00:00
drh
2424aa723b Help the parser run faster by avoiding the "explain ::= ." production.
FossilOrigin-Name: d7ec7b5970df9e542401f8299e098a5039d1875e2e3383dad06a0ec998589b6e
2018-04-11 17:10:54 +00:00
drh
84fbff18d0 Prohibit bound parameters in the arguments to table-valued functions within
a trigger.  Problem discovered by OSSFuzz.

FossilOrigin-Name: b7178209152452e82f5908513385018524472640d67547927d6b4c0aa0c15a46
2018-04-11 16:04:01 +00:00
dan
d6189eafa4 Minor simplification to internal function generateSortTail().
FossilOrigin-Name: f32cdb41ca213cfcfe0bb5bfe56930d43e55525fa5640274b00f1ccce7f69634
2018-04-11 14:11:53 +00:00
mistachkin
8384e43c18 Include the 'sqlite3rebaser_' APIs in the Windows '.def' file.
FossilOrigin-Name: 56e4965f7ac850c59596120878434f5ef023e77919ef9416d20812eac764bac1
2018-04-10 18:56:21 +00:00
drh
80aab206a4 Version 3.23.1
FossilOrigin-Name: 4bb2294022060e61de7da5c227a69ccd846ba330e31626ebcd59a94efd148b3b
2018-04-10 17:39:29 +00:00
dan
0493222ff8 Fix a problem causing the LEFT JOIN strength reduction optimization to be
incorrectly applied in some cases where the WHERE clause of the query contains
a filter expression of the form "lhs.x IS NOT ?".

FossilOrigin-Name: 1fdaf2c34431adcac1c7ff29aae0623c4cbaa6a7f38e843c786bd407d8b3e730
2018-04-10 15:31:56 +00:00
dan
6831dbedeb When testing, avoid injecting an OOM fault into a file-control call made by
SQLite on an unopened file-descriptor.

FossilOrigin-Name: 9c1a5eba3ec37c877af4b83c6f8c05b7140304f3d23e49832ba63e321247fc8d
2018-04-10 14:29:51 +00:00
drh
032495a34e Increase the version number to 3.23.1.
FossilOrigin-Name: 9488c87b54ace8a92a52a368e8cf161dfdd24201bd6b60d50e88c2d92d592f0c
2018-04-10 12:33:42 +00:00
dan
a1054dcc3f Fix a problem causing the LEFT JOIN strength reduction optimization to be
incorrectly applied in some cases where the WHERE clause of the query contains
a filter expression of the form NOT(x AND y). Ticket [1e39b966].

FossilOrigin-Name: 38d319c153641ea4138fab2d5a47c31a86f57a071a1e1c299ca54c980cfb2b60
2018-04-10 12:10:01 +00:00
drh
a2ce1b99a8 Remove an unnecessary SQLITE_UNTESTABLE compile-time conditional from
the command-line shell.

FossilOrigin-Name: 80b75a34a2a4c11bc35b8638f8f05d999db416c81edc1a1c81aa5029f0301da1
2018-04-10 10:37:33 +00:00
drh
eb557618d2 Update the top-level README.md file to point to the whynotget.html document.
Put it on the correct branch, this time.

FossilOrigin-Name: a52e3cddea58b838e94e09a8488220a4406ff37d2cad8da05799d47fcf95ea38
2018-04-10 00:53:36 +00:00
drh
5f17ef037e Update the top-level README.md file to point to the whynotget.html document.
FossilOrigin-Name: 7dfd4543da7ef741852252d3c78ba89a919d737787e9e5118579e35fdfdeb24c
2018-04-10 00:30:47 +00:00
drh
a5746e0317 Minor changes to the input grammar resulting in a faster and slightly smaller
parser.

FossilOrigin-Name: a2c443c0ee9a0e0b2d10298b8a74ff00a1a66e3f96f4093348f0fef977587204
2018-04-09 20:36:09 +00:00
drh
337679be4e Enhance the query planner so that it detects when the xBestIndex method
of a virtual table gives out-of-sequence argvIndex values and reports an
error.  Secondary fix for ticket [2b8aed9f7c9e6].

FossilOrigin-Name: 9506ec14fb9e58986c1b79a3ca78430ad94b10966944c864e0429a7688dd1454
2018-04-09 15:57:54 +00:00
dan
67ecf1f5c2 Fix the fts5 xBestIndex method so that it is not confused by "IS", "!=",
"REGEXP", "GLOB" or "LIKE" operators.

FossilOrigin-Name: a0ca4ddbbf179b8f0a5f30c127f2f8c92b6d45a08be3e1ef2194e44ebcc28120
2018-04-09 14:26:44 +00:00
drh
0f1631db06 Improvements to ".wheretrace" output.
FossilOrigin-Name: ea2e5b34bf35ade602dfcef359b64f810674f304fda14326b7f2dedefcc5f340
2018-04-09 13:58:20 +00:00
dan
fe55da387a Add a "flags" parameter to experimental API sqlite3changeset_apply_v2(). Also
add the SQLITE_CHANGESETAPPLY_NOSAVEPOINT flag.

FossilOrigin-Name: 3d29631fa7270b18f51de8cfe1285959e42ad9a673d5d2d5c016126f5f1b31a8
2018-04-09 11:43:58 +00:00