Commit Graph

22203 Commits

Author SHA1 Message Date
drh
369e758fdc Small performance improvement and size reduction in sqlite3DbStrNDup().
FossilOrigin-Name: 35cd87063d1933b87bc2176f957ecd758d7d167e9473fa615e33caec3be14783
2020-07-16 14:19:57 +00:00
dan
01b2344b3c Add OOM test for UPDATE...FROM statements inside triggers.
FossilOrigin-Name: 917a479b0d11fb59abf41d0317ffc541eb4b83928df9382b4782953c0035fa3e
2020-07-16 10:48:37 +00:00
drh
b866a65d4d Fix a double-free of the FROM clause of an UPDATE inside of triggers.
FossilOrigin-Name: 706c8da2f6d9299f0ad3b3c93332b38071e8e88b4d1660c1841309919b64fd18
2020-07-16 02:36:24 +00:00
drh
6265c47a1a Separate VdbeCoverage() macro for different jumps.
FossilOrigin-Name: da593e57df042527decfea68baacc72d463728544cab81c70fbb25839791f706
2020-07-16 00:45:25 +00:00
drh
525326ef72 Fix a problem in UPDATE FROM in which it tries to free using sqlite3_free()
instead of sqlite3DbFree().

FossilOrigin-Name: 8ca87526523a985674fed5a8770726587b3a2e48d65721916902063ab5dba49c
2020-07-15 21:53:53 +00:00
dan
ac45b7402d Support a FROM clause in UPDATE statements, as postgres does.
FossilOrigin-Name: 7d7d5ecbd70cc39ab7a641ae26af0d3b69d5cb02e626b620102a6e19e7d8a577
2020-07-15 20:01:07 +00:00
dan
e7cf8fdd17 Add tests for UPDATE...FROM and foreign keys.
FossilOrigin-Name: 6c3668f9ed898337e664bec95865f15688a6bba43f095358dda5d08abef2bbaa
2020-07-15 19:38:49 +00:00
dan
576d5a8634 Fix problems that could occur if a table with the same name as the table being updated appeared in the FROM clause of an UPDATE statement.
FossilOrigin-Name: 13224cbd75990615088f3e30ccba05d31b3099fae4300c9ab8f7663bc5f0eb6f
2020-07-15 18:30:01 +00:00
dan
243210b79b Fix a problem in SQLITE_ENABLE_HIDDEN_COLUMN builds occuring when an UPDATE...FROM fired an INSTEAD OF trigger.
FossilOrigin-Name: 5176cb7a6a4e8cfa1973aaae46fcd7d39baedb70ae20bfacc82d62ca39fb0aa3
2020-07-15 15:32:59 +00:00
dan
42d7a77b61 Update this branch with changes from trunk.
FossilOrigin-Name: 53b8b507a10364f5d580655d89c950a5f14c2a8114625fd8749d77f289413b22
2020-07-15 11:00:29 +00:00
drh
d8b3c19991 New test cases for decimal and ieee754.
FossilOrigin-Name: 73d62f82f94347c60e026bc9cb859fec2d8b5f0c756df0c4941f11817234bff8
2020-07-15 02:15:03 +00:00
drh
9951522f0b Improvements to the min()/max() optimization so that it is able to use
indexes where terms are constrained by IN operators.

FossilOrigin-Name: b8ba2f17f938c03543a89dd29d6987163f7a4085a51de1aa14ea5504501c4f72
2020-07-14 23:58:04 +00:00
drh
19543b9b7b Now appears to work. All legacy tests pass. Need to add new tests, however.
FossilOrigin-Name: 81e6450980ee745686aee5e2b84672d3c8404a041c82c658aa562013294b8628
2020-07-14 22:20:26 +00:00
dan
e7877b2d6b Support UPDATE...FROM statements in trigger programs.
FossilOrigin-Name: 4f6d8d0ebf40029218a1d3b05ea657c0c5953b01c6f0b6a628465aa44c67e7f3
2020-07-14 19:51:01 +00:00
drh
c37b7680a4 Fix an obsolete header comment on the sqlite3WhereIsOrdered() routine.
FossilOrigin-Name: 5041f6a1c439b43c654e72a391517c115e222ef0e9a565907b03149b535e92c8
2020-07-14 15:30:35 +00:00
drh
fc5bba7dc1 Merge fixes from trunk.
FossilOrigin-Name: 2af372f59ea250ccf9ab7c30fe4bf8376a5da6e35c401edf643b9a193a38d33d
2020-07-14 13:02:30 +00:00
drh
bc2cf3b295 Early detection of freelist size corruption in incremental vacuum.
FossilOrigin-Name: f25a56c26e28abd44373230c6b5763aed35c9a7648abede8a53409dccc0bee1d
2020-07-14 12:40:53 +00:00
drh
751a44ed24 Fix a crash. Not all tests pass, but tests do at least run to completion now.
FossilOrigin-Name: b5d38e28c62dbc4f5f0e1b2590c9d6c2de9a140cc3528cae1968fd741e337fb0
2020-07-14 02:03:35 +00:00
drh
6e4b140e94 Fix an obsolete assert().
FossilOrigin-Name: 221e021077e2bbce693a89a16361418ced20f4e8f5a27e8c461648cff663a2c5
2020-07-14 01:51:53 +00:00
drh
9d575e46f3 Merge latest changes from trunk. This branch still does not work.
FossilOrigin-Name: 6144387238c03b8b33ae98d624f7ffa44a7829d3e0d4a0a01b5528e71ab4f08b
2020-07-14 01:03:05 +00:00
dan
f067ae8eba Add test for LEFT JOIN in UPDATE...FROM statement.
FossilOrigin-Name: 4f3dff045ab90e80479960fed64cf36f23dd0e13144edbde15043913ad3faac5
2020-07-13 20:43:13 +00:00
dan
be952c11dc Add test cases and fixes for UPDATE...FROM statements that modify primary key columns.
FossilOrigin-Name: 47c87af3e52bce10fbcc2cbe832d659b0c204bfb3368d9314fa1b01120129254
2020-07-13 20:10:29 +00:00
dan
a7f82d9f47 Merge latest trunk changes with this branch.
FossilOrigin-Name: 5ee3c27e20d12a126fb773b428bb864102b949a5b26a8d5c523753dcedf4be10
2020-07-13 18:04:27 +00:00
drh
5b107654e9 Readd the ALWAYS() macro that was removed by [f7a74f89dbd58b47] as the
condition is no longer reachable due to the previous check-in.

FossilOrigin-Name: 9cb03beae42d814a1b1b69f72865fde502d3f443313ec29edd010d1de40225eb
2020-07-13 15:35:08 +00:00
dan
27da907f8e Fix a problem causing queries containing window functions to ignore collation sequences under some circumstances.
FossilOrigin-Name: e6c2192ef88e9990c8b91755c8e779f09e23f936a17123d8e42059257b756ed7
2020-07-13 15:20:27 +00:00
dan
bbc9e1908a Fix an integer overflow bug in fts5 triggered by a corrupt record.
FossilOrigin-Name: 49da8bdce17ced910b414d50e8df79800513dcf03a196197dc1ea8e47deeda92
2020-07-13 11:06:30 +00:00
dan
56215eaff4 Add second test case for the improvement in [30735432].
FossilOrigin-Name: 1bd18ca35bdbf3034591bf8981fd3a985f0920379bc4dc81e0e6a819667998e9
2020-07-11 16:45:20 +00:00
drh
a1085f0640 Improved detection of a corrupt database schema. Fix for a problem discovered
by dbsqlfuzz.

FossilOrigin-Name: 30735432bc33cb953b6d7d2a2de9eb378f9740e0e663f50c727c3f138cd43a2b
2020-07-11 16:42:28 +00:00
drh
6af305de1e Remove unnecessary code from the window functions implementation.
FossilOrigin-Name: 1e87da9c93309d1d69b1e0ab65c615b9ff9c1c6813ad0c7b90d2495be4ba0adc
2020-07-10 21:43:53 +00:00
drh
413b94af89 An attempt to get the Min/Max optimization working with IN constraints.
Not currently working.

FossilOrigin-Name: 4a64c16fb7a07431e534fb9bbcf778646be8a1c718d5d10873fbccb0c867aac7
2020-07-10 19:09:40 +00:00
dan
b16425d05a Fix a broken assert() in fts3 that could fail when handling corrupt records.
FossilOrigin-Name: 5124732370fd53c93314c9c79b4251bd46ce81c2e7aa4f59e2c1889cc4263d5a
2020-07-10 11:12:36 +00:00
dan
7db1ed50b8 Fix handling of another corrupt database case in fts3.
FossilOrigin-Name: ccff8cb8267d4c5605484f7a35c1836937f20b3d6879fe84cd84dc24bbbffc77
2020-07-09 21:29:34 +00:00
drh
9c673a29bd Fix a comment typo. No changes to code.
FossilOrigin-Name: 610ee8d5dc855fd163daa3c93b44db7874463d69df5a01ab4113b725a031b9d4
2020-07-09 14:05:47 +00:00
dan
b13d5c25d6 Remove bashism from configure script.
FossilOrigin-Name: 138beebb2aa21ed18525dbe02c80426c6caabf6a5f6532a95b738a39b31ad4d5
2020-07-07 19:24:34 +00:00
drh
d1d89140c0 Increase the resolution of the vdbe opcode counters to 64 bits, as
apparently some users run single prepared statements that go for
longer than 4 billion instructions.  See forum post 
"[https://sqlite.org/forum/forumpost/d07949dc94|Possible freeze in the progress loop]"

FossilOrigin-Name: 612eb590ea44fd402e630f2d62558beb7ce57d7d0ba113c8b72ea60a895c5a43
2020-07-06 12:13:05 +00:00
drh
a78d2c0528 Fix the table_info pragma so that it always checks the schema version and
reprepares, even if it is a no-op.

FossilOrigin-Name: 6da77973abc325ae8baf64615267a614a0b8bb8dfd0a01a9f7d6c3a8f359564f
2020-07-04 20:29:56 +00:00
drh
a4e42d24df Fix the line-number of error messages coming out of the ".import" command
when the --skip option is used.

FossilOrigin-Name: e0a8b11dfd6b3ab89ae5032d60cf3c1bba7198a1a2debe5c691b5d1f2e1befee
2020-07-03 21:24:42 +00:00
drh
27ee29f68c Fix a compiler warning about an unused procedure in the parser.
FossilOrigin-Name: b27bb4fe389e12472a6144441df2dca6a7393024f2621fd22dd1a2b4033c46ec
2020-07-03 21:18:07 +00:00
drh
5f0d37b57e Update the lemon documentation to match recent enhancements.
FossilOrigin-Name: ca7630a5772ab919482a3629e11627143a1e1ec290a570ce4188189e671f9015
2020-07-03 18:07:22 +00:00
drh
c601f1016c If the amalgamation is built using OPT_FEATURE_FLAGS =
-DSQLITE_UDL_CAPABLE_PARSER then it can be compiled with or without
the -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT option and it works either way.

FossilOrigin-Name: 1f96a29dd8654ee30d36982a8bcd3f17a4b9193d3879fdb38fa3f03eeeff3080
2020-07-03 17:24:35 +00:00
drh
0a34cf551c In lemon, add "%if" and "%else" and allow boolean expressions as the
argument to "%if", "%ifdef", and "%ifndef".

FossilOrigin-Name: 951d22b72f80de9e23df645abcc3d88ca1a275b46ea23b84152ef48716922b37
2020-07-03 15:41:08 +00:00
drh
4b849b0b09 Fix the pragma_foreign_key_check virtual table so that it accepts arguments.
FossilOrigin-Name: 07f849dee3d245ecf80ba3c3ce8dfc630e71ddb1e9c0bcc1f08cee22001fcb07
2020-07-03 12:32:04 +00:00
drh
ec1650a239 Fix a problem with "PRAGMA foreign_key_check" where if a table in one
schema appears to have foreign key constraints against another table in
a different schema, the pragma will try to check the constraints even though
they do not apply because they are in different schemas.

FossilOrigin-Name: 81bc4b65ae2a68128b0be75a7a3d4f47f05cc588ff130ba56366ab9b16289228
2020-07-03 12:15:59 +00:00
drh
15cedda902 Minor simplification to the 32-bit varint decoder.
FossilOrigin-Name: 6ffd17b668a8ad561c37e89063afb6e7f8425e557e93025b7527fe3656585d77
2020-07-02 17:05:11 +00:00
drh
e3863b5176 Ensure that the "PRAGMA schema_version" command causes the schema to be
reparsed and reloaded.

FossilOrigin-Name: 27d4a9a7b530c77a5b2593d1a5232b10746da9906f8d12890de7a8fbd7270256
2020-07-01 16:19:14 +00:00
dan
fa4b0d4453 Fix a problem with VM code generated for some aggregate SELECT statements that feature min()/max() aggregates both with and without FILTER clauses.
FossilOrigin-Name: 2094da753feb847254473b148d11e535c44dbae9b17454f1a4f8f7e90aefba3f
2020-07-01 14:07:45 +00:00
dan
3f1d0f56e4 Add a test to ensure that "PRAGMA wal_checkpoint = FULL" invokes the busy-handler to wait on read-locks.
FossilOrigin-Name: f068fb116286b1dbdee9c168900348cfcab84e6d8413f3456e4e492f650d11b0
2020-06-30 18:21:45 +00:00
dan
f488bc1147 Avoid a potential buffer overread in fts3 when processing corrupt records.
FossilOrigin-Name: 4d0cfb1236884349168f8e2ec5e18c0232965148af78615e0d5c9b0e13a35422
2020-06-30 15:32:12 +00:00
drh
b8fec21983 Fix generated columns so that they play well with upsert.
See the [https://sqlite.org/forum/forumpost/73b9a8ccfb|forum post]
by "iffycan" for details.

FossilOrigin-Name: fa9d93cf32fac4b86044acf5d1b9ea2f36e964ed7142cf1d270986c9ef3fb766
2020-06-29 20:26:50 +00:00
drh
ec43d8040a Change the magic number used to identify the "excluded" pseudo-table in
an UPSERT statement into a #define constant.

FossilOrigin-Name: e96c2ac9ab1a1c51b1498f4b91fb71d2987c30579d072b2f0297da9eb945cb97
2020-06-29 20:20:40 +00:00
drh
da36933eb4 Document the dual-use of the P5 operand to the OP_MakeRecord opcode.
FossilOrigin-Name: a73f80f22a585d1a2f55650d5cda4ece6c4ef039ef5eae2c02c3e5c269d4c30a
2020-06-29 20:09:04 +00:00
drh
8ddf635811 Change the name of IntegrityCk.mallocFailed to IntegrityCk.bOomFault to
avoid confusion with the sqlite3 object field with the same name.

FossilOrigin-Name: 87c7d962581f4bb1224086701352850ede9847dc76235b33c7c2a35ef594d382
2020-06-29 18:30:49 +00:00
dan
2bfd35b8d2 Add test script to verify busy-timeouts are working for SQLITE_ENABLE_SETLK_TIMEOUT builds.
FossilOrigin-Name: ada43e7c490bf72a50ee84e1db994e149744b2a943260449076b83d1874813b2
2020-06-29 17:52:53 +00:00
drh
64185e31fc Do not run resetAccumulator() after a malloc failure.
FossilOrigin-Name: 1b426603f05033bcee0331c6f664cd5ed2ebf8f5d4cde8c6673c7a699ff53bb1
2020-06-29 16:30:10 +00:00
dan
b695bab055 Fix another fts3 problem with processing corrupt records.
FossilOrigin-Name: 6e0ffa205312416830340ea6e621dfb1a529e5603d569941ed6263930dc28c45
2020-06-29 13:33:56 +00:00
drh
5cbb442ea3 Small performance improvement in the sqlite3_step() interface.
FossilOrigin-Name: 61400ef9f1337c77263b4d3e43a1983b0c4cf7137f066a2691768c98877035ef
2020-06-29 13:12:42 +00:00
dan
30b5db1261 Fix a problem that could cause an infinite loop in the fts3 'merge' command.
FossilOrigin-Name: be545f85a6ef09cc6c762f7d2ab7a0b3adf5590c3fbdc9903e6b5b5cec6e823f
2020-06-26 20:41:18 +00:00
drh
22f874168a When computing the verification hash in speedtest1, do not include the
value of floating point results (which can very in trailing bits depending
on platform) but merely hash the fact that a floating point value was
received.

FossilOrigin-Name: e12225d59c63ba392db4fa8dc26700ac26b20c8b98ea5107eef0e0b5138ace87
2020-06-26 17:56:43 +00:00
drh
0581214577 Improvements to speedtest1.c for more consistent verification hashes.
FossilOrigin-Name: d34b8ff5f8d04a75996f6ca9d3a0563c83e8e833c1eb08ac3861431f36f7bfb1
2020-06-26 16:17:27 +00:00
drh
6df54c30fc Improvements to speedtest1. Added the --memdb and --output options. The
--verify option now outputs a hash of SQL outputs.  The speed-check.sh script
disables the hashing feature with --legacy and adds the --verify option.

FossilOrigin-Name: f3455cecf22ea98f9ad48e92d620c8e2ec94877e4581731afff0f2bd32014a1d
2020-06-26 15:42:55 +00:00
drh
85c4754697 Add the ieee754_to_blob() and ieee754_from_blob() functions. Fix the handling
of subnormal forms in the two-argument version of ieee754().

FossilOrigin-Name: c78cbf2e86850cc6882d3f0bd5415f6e731c3c675ffe77bb343682c619cb8cd9
2020-06-26 15:32:29 +00:00
drh
3c99dbb18b Add --verify to speed-check.sh and add --memdb and --output to speedtest1.c.
Other improvements to speedtest1.c.

FossilOrigin-Name: 89a11120ab2ce13f8a539cb05a9d0628a1f83b4790910b2023c21d60aabc43ee
2020-06-26 14:05:58 +00:00
drh
d8d335d737 Fix a possible null pointer deref following OOM. Discovered by dbsqlfuzz.
FossilOrigin-Name: cc888878ea8d5bc754c69de523819d32d6d9853857e31d7287f9dbfd723428db
2020-06-26 04:34:28 +00:00
drh
0f40e8dd41 Update the showlocks utility program so that it functions on files with
a huge number of locks without overflowing the stack.

FossilOrigin-Name: adb7484f93329c7a94cd84e30bc4a8dbf2d6e901eba17cc3454afb8ba346cbf4
2020-06-25 23:21:09 +00:00
drh
99f363b35e Enhance the --verify option to speedtest1.c so that it computes and displays
a hash of the result from all SQL queries, for verification purposes.

FossilOrigin-Name: 60d1e46c8c8a3c853034fd79f204bcb5d50d1c366eb246849c333a2d0abc2648
2020-06-25 20:28:13 +00:00
drh
8cda77d44a Add the ieee754_mantissa() and ieee754_exponent() functions to the iee754
extension.  Build the ieee754 extension into the CLI.

FossilOrigin-Name: db2f0836b64cd2e119684f1cf75fa3b19a84ca6aca1a239f7e2b9298016e2c95
2020-06-24 15:06:29 +00:00
drh
ec18b6e5b9 Fix the decoding of subnormal values in the ieee754 extension.
FossilOrigin-Name: 838817b680f02b3845d6d56f85d5d36fa5ae7453afef7a1a5a24624255f2dc3e
2020-06-24 13:52:10 +00:00
drh
b5b9bf8540 In the one-argument version of the ieee754() extension function, if the
argument is an 8-byte blob, interpret that blob as a binary64 floating point
and decode it.

FossilOrigin-Name: 4199c1e8aa47d77df3ef598cb6f5418f67970dd00f34823463c85eabfc8d2b77
2020-06-24 13:14:00 +00:00
drh
9f683de872 Add the decimal extension. It is built into the shell, but is an optional
add-on for the library.  It is not included in the amalgamation.

FossilOrigin-Name: 5391687bf8563b3fdd157b436b2cbb6a0ee5f676727d41bbddfaa8eacc39729b
2020-06-24 12:29:19 +00:00
drh
e6b430b178 Fix the ".selecttrace" command in the CLI (only available when compiled
with the non-standard -DSQLITE_ENABLE_SELECTTRACE option) so that it does
not segfault if invoked without any arguments.

FossilOrigin-Name: d45c27a3e5edaa2bd9ff0473e18c6536aa5d15f9a4d22dfee894a5ee4347f8d7
2020-06-24 11:45:35 +00:00
drh
9e44f265a7 Enhance the --testset option on speedtest1 so that it can accept a
comma-separated list of test modules to run in order.

FossilOrigin-Name: 780e8aaa231b2b585505c3886d5a13d39dba546fdd8020331ad4de2ae92922b0
2020-06-23 20:03:57 +00:00
drh
24aee8af6e Try to remove end-of-line whitespace when building the amalgamation.
FossilOrigin-Name: be3e7814e4cdbc09eaa5112d7d4135b3a2cedbfe66217d9973b1b39a44464e93
2020-06-23 17:57:08 +00:00
drh
e78c027b64 Fix a harmless compiler warning.
FossilOrigin-Name: e1416c8b0628afa062d8cff40d0cd3576dc85460e55b21a271f88fcb608b9f59
2020-06-23 15:29:22 +00:00
drh
6b64718618 Avoid unnecessary normalization in decimal_sum(). Trim excess trailing
zeros off the result of decimal_mul().

FossilOrigin-Name: 0294ce071c863eb517e97beff31c3d95a4370e979a969415162302a90d3fda0e
2020-06-23 14:44:57 +00:00
drh
427af8dc3d Add the decimal_mul() function.
FossilOrigin-Name: 72eee04b67268ad38fd51ff32849f08c0a54cf1b481d5ecb11d77cc9c729ee03
2020-06-22 21:25:37 +00:00
drh
beb9def059 An extension for doing decimal arithmetic on strings.
FossilOrigin-Name: 4c3b85607feb53462ccc8b89bea699fdb132c402eae597afa33cc40a85c32329
2020-06-22 19:12:23 +00:00
dan
3259295533 Fix problems with handling return value of mmap() in lsm_unix.c (mmap() returns MAP_FAILED on error, not NULL).
FossilOrigin-Name: da06168c09df5c0e8e10d0f9618e69217d4c0173a8199660bad2805f009d7b08
2020-06-22 16:02:06 +00:00
drh
a764709bf3 Work around a bug (an incorrect warning) in Clang-8.
FossilOrigin-Name: 067291143a63db924ead4810defb4bc6f195557412f5d1c22299f30d2d9f2a79
2020-06-20 03:43:46 +00:00
mistachkin
96e3c39bd5 Reverse unintentional spacing change in the previous check-in.
FossilOrigin-Name: c7b2ee1edb108430454578c1623ba6aee1e2a7bc30cb2f9884ea3e21c3b75635
2020-06-19 15:35:07 +00:00
mistachkin
7cff0e34e0 Include 'sqlite3rc.h' in the amalgamation archive targets.
FossilOrigin-Name: 3df579ca32e8250725957d1982897a43281c73e8373af49abd6e7bd674f30e74
2020-06-19 15:33:23 +00:00
drh
067b92ba00 Extend the refactoring into extensions. Clean up stray newlines.
FossilOrigin-Name: 7a876209a678a34c198b54ceef9e3c041f128a14dc73357f6a57cadadaa6cf7b
2020-06-19 15:24:12 +00:00
drh
1e32bed3c1 Further refactoring of the schema table name.
FossilOrigin-Name: 9536fa0ae0c1ae6e2e98d2fa11e5acda7f3c9b8ca5061b6f7f8cae63a11d936b
2020-06-19 13:33:53 +00:00
drh
ccb2113a62 Refactoring various names. No changes in the resulting machine code.
FossilOrigin-Name: 7bb08b1bfcf184e4b59c8c9028926a0052612ff6a6731914ccdb8dee07ea4a98
2020-06-19 11:34:57 +00:00
dan
877859f2d3 Fix an assert() that could fail when operating on a database with a corrupt schema.
FossilOrigin-Name: 4a340c9bc7d939efc947e3b17ca79314482f74368b15567dd089d40e4270890e
2020-06-17 20:29:56 +00:00
dan
0ad1b3284a Fix an assert() in fts3 that could fail when processing a corrupt record.
FossilOrigin-Name: 4adc0a1b0d84c2df6d6bf0d5d9d3fa9f7d048af8d232c4beb77518727890f212
2020-06-17 14:54:06 +00:00
dan
5d237bfab1 Fix a problem with retrying constraint failures within sqlite3changeset_apply() calls with the SQLITE_CHANGESET_INVERT flag is set.
FossilOrigin-Name: d73e857b833dfc29400049ca7f01ca465f980466e3aa67214c3c5e5573181419
2020-06-17 14:14:11 +00:00
dan
74bbd37dae Add new file doc/wal-lock.md, containing notes on wal-mode blocking locks.
FossilOrigin-Name: c6b1d3a385751633d3ac1853e13d5e847185dd6432fb8b960a4080f61357c08c
2020-06-16 19:51:56 +00:00
drh
dd853c382a In the CLI, only interrupt tabular outputs at the end of a line. And print
"Interrupt" on a line after stopping the output.

FossilOrigin-Name: f3bd689336fecaa1e2928b826c6aedb0178d322f4633ac429dd1ae6fbc08e7f1
2020-06-16 17:34:40 +00:00
drh
dc8339eaac Add a test case covering the previous check-in to the test/fuzzdata8.db file.
FossilOrigin-Name: 95379da0e1ad5110648a5b3af24e7caab66a6f1ad6efdf374c83ae4ef1fed515
2020-06-16 14:12:43 +00:00
dan
b65ce39607 Fix an assert() in fts3 that can fail when processing a corrupt record.
FossilOrigin-Name: a58a6d6fb241a50c4c7c9af8a9c65bc4746e905b2ae12290c7182afa944053a2
2020-06-16 14:06:20 +00:00
drh
346a70ca1e Provide "sqlite_schema" as an alternative name to the table that holds the
database schema.

FossilOrigin-Name: 61782a7ae3c25cf59d7a676cb295eb024d17c46e532ae78c6fe871a91d712fa9
2020-06-15 20:27:35 +00:00
drh
999429882e Fix the CLI so that interrupts work in columnar output mode.
FossilOrigin-Name: 9472f1fe58222b738ad10fc93ceb365dc33b65c2bbca571f52bcd5bdb74b347e
2020-06-15 20:05:37 +00:00
drh
b13c3a33fd Fix the --enable-update-limit option to ./configure.
FossilOrigin-Name: d31fd57ea538668238787fde10a6a57bbd8a428c73f2e54b2e95ee9a645bc75b
2020-06-15 14:38:57 +00:00
drh
b7cbf5c1b2 Fix a defect in the query-flattener optimization identified by
ticket [8f157e8010b22af0].

FossilOrigin-Name: 10fa79d00f8091e5748c245f4cae5b5f499a5f8db20da741c130e05a21ede443
2020-06-15 13:51:34 +00:00
drh
86d2de2571 Check-in [1d4f86201dab9a22] changed a testcase() to an assert() because we
didn't know how to reach that condition any more.  But YongHeng's fuzzer
found a way.  So now we change it back.  Ticket [9fb26d37cefaba40].

FossilOrigin-Name: 90b1169d1b200d35a3f9f0ad2ae35a1b336bdd9b1ad0494ba80a382354c8d8b8
2020-06-14 13:40:13 +00:00
dan
cd653a3266 Avoid deleting expression nodes in the flattener code, as they may be referenced by AggInfo objects further up the stack.
FossilOrigin-Name: cc1fffdeddf422404170fa163ab80372ae58b444d7012b2c164021b221709b3e
2020-06-13 21:24:40 +00:00
drh
74e0d96695 Identifiers "TRUE" and "FALSE" cannot take on their boolean constant values if
they are operands of the "." operator.

FossilOrigin-Name: ad738286e2441b5e84d05366db3fcafabe66be766f21fe6c17f43a8fabab16fb
2020-06-13 03:18:21 +00:00
drh
0dc90d43e5 New test case added to test/fuzzdata8.db.
FossilOrigin-Name: 14a5cbddc887e23a684fabab1a213cce261bd6cffa0663d4f138b92d0b65b9c2
2020-06-12 15:45:02 +00:00
dan
56e38185fe Fix a buffer overread in fts3 that could occur when decoding a corrupted record.
FossilOrigin-Name: 9a4a40c45feb2bb89020dc7711b4753479112ceae7ce2a44521d72afeddfac83
2020-06-12 15:17:27 +00:00
drh
6aa7515c46 Remove a NEVER() that turns out to be reachable.
FossilOrigin-Name: 44e573ecd5c2b60107133d60c51f3a04a3f904e9c1cf926e9b8ea977c7acae8d
2020-06-12 00:31:52 +00:00
drh
b5aaee5e31 Add a new assert() to the SELECT processing.
FossilOrigin-Name: 98cea4a32ba558c137d71a5e373a6803d764d34c5640907371dcf6468ffb2e64
2020-06-11 16:04:10 +00:00
dan
46daa99b8d Avoid rewriting compound SELECT statements that use a different collation sequence for ORDER BY and record processing a second time if they contain window functions. Fix for [b706351c].
FossilOrigin-Name: 32a88bdd4be5acdc1b80856bf6e32724dc3a467d5050bec0fe1a3dfedcc06f34
2020-06-11 15:53:54 +00:00
drh
9216de8a23 Provide the ability to use the SELECTTRACE() debugging macro outside of the
select.c source file.  Use this to add a new SELECTTRACE() entry in
window.c for improved tracing of window-function parse-tree rewriting.

FossilOrigin-Name: 30c6d895b573d5f2a53487b3b7a0d20be7e382c7a0bc87336bd43fbd2fa89bf4
2020-06-11 00:57:09 +00:00
drh
ac4f7cf8d3 Make sure the bbox object is fully initialized in geopoly, even if reading
a corrupted database.

FossilOrigin-Name: fd5abb1a7b5a55127d5c0d5ff448020d8bccab44e4f5afe1eb88fc19578af735
2020-06-10 14:30:15 +00:00
dan
f65e379919 Ensure that the "push-down" optimization does not push constraints down into compound queries if any of the component queries uses window functions.
FossilOrigin-Name: 094dcfe779613301521e8bb990432df187b3686add75a3420b4a193f02f3467f
2020-06-10 10:58:15 +00:00
drh
7b4c4d4a67 Disable AggInfo consistency checks when unwinding after an OOM.
FossilOrigin-Name: 65179814aa0ae5927bae97c10ef20f290535399b889d96d5b88931f62635f212
2020-06-10 03:07:26 +00:00
drh
d124549fce Ensure that aggregate functions that (a) are part of SELECT statements with
no FROM clause and (b) have one or more scalar sub-selects as arguments are
assigned to the correct aggregate context.
Fix for ticket [7c6d876f84e6e7e2]

FossilOrigin-Name: c29a9e484e1dd245962afbbf511b183462af5e86c511261ccf018345e773f940
2020-06-09 23:50:13 +00:00
drh
bc050b8f27 Mark an always-true conditional with ALWAYS().
FossilOrigin-Name: 35a236841764a10cdcda63f34e1a8e7ffa43933bc89cb32f675454327834d7bf
2020-06-09 22:11:06 +00:00
dan
ed41a96bc1 Ensure that aggregate functions that (a) are part of SELECT statements with no FROM clause and (b) have one or more scalar sub-selects as arguments are assigned to the correct aggregate context.
FossilOrigin-Name: 16a41fa8c4c74bba4e908a9c19e6cf5a927cac140e2070c9abf303158be7257b
2020-06-09 17:45:48 +00:00
dan
cfb8bf6a50 Modify a test file to avoid causing Tcl to allocate too much memory.
FossilOrigin-Name: 232431f32ef77a9dfc4eeb7765dca24af72051fd5460f648d0c5ba318c8a01fc
2020-06-09 13:53:56 +00:00
drh
81185a5138 Give the expression pointer fields of AggInfo distinctive names in order to
simplify tracking of all their uses.

FossilOrigin-Name: a53bdd311c4154fd5e1131efbb9665362f79db5a35ce9f7b1547f74b8ee2d8ba
2020-06-09 13:38:12 +00:00
drh
e26d428a59 Improved tree-view debugging output for aggregate functions.
FossilOrigin-Name: b5711b4eead10ef4b0b61f2e2c54768d215a4105f6d47d2ea78991b6e53a6831
2020-06-09 11:59:15 +00:00
dan
5c10930fa9 Fix a case where a corrupted fts3 record could cause an assert() failure, or spurious SQLITE_NOMEM error in builds with assert() disabled.
FossilOrigin-Name: d48af4d2cfff3d5f4ccc3db5d658e8b503255b577e6e62b5c2b4a4437875b895
2020-06-08 14:43:41 +00:00
drh
e6463a717a When an Expr object is changed and that Expr is referenced by an AggInfo, then
also update the AggInfo.  Also, persist all AggInfo objects until the Parse
object is destroyed.  This is a new fix for ticket [c8d3b9f0a750a529] that
avoids the follow-on problems identified by tickets
[0899cf62f597d7e7], [1f6f353b684fc708], [e5504e987e419fb0], and
[f7d890858f361402].

FossilOrigin-Name: 6e6b3729e0549de028f6c5bf494b2d69d621c81b61a1dc0a329d3950039342fb
2020-06-08 11:34:40 +00:00
drh
2f82acc036 Fix minor OOM problems.
FossilOrigin-Name: 8b23d80271aab38abe42ee8b3ca4b746572ecef26c2a37b094b01560e6be9d45
2020-06-07 22:44:23 +00:00
drh
bf7909734a AggInfo objects might be referenced even after the sqlite3Select() function
that created them has exited.  So AggInfo cannot be a stack variable.  And it
must not be freed until the Parse object is destroyed.

FossilOrigin-Name: 3c840b4df306e2db1da08673e9ede973b4cb6d2b3f9eeeab5835e39452ee3056
2020-06-07 20:18:07 +00:00
drh
896366282d Alternative fix to ticket [c8d3b9f0a750a529]: Prior to deleting or modifying
an Expr not that is referenced by an AggInfo, modify the AggInfo to get its
own copy of the original Expr.

FossilOrigin-Name: 7682d8a768fbccfe0cc956e9f6481637146e1ab9763b248ff11052761ce32e32
2020-06-07 17:33:18 +00:00
drh
a0365c487c In the debugging treeview output, change the name of "SELECT-expr" expression
nodes to be "subquery-expr", so as to not confuse them with actual SELECT
nodes.

FossilOrigin-Name: c1c8937a30feff6aa4385b0c264fd8e70d54422a0629c2ce38082d85d3334a57
2020-06-05 04:01:50 +00:00
drh
c060508445 Always use ?...? to indicate optional arguments in the output of ".help"
in the CLI.  Change ".mode column" so that it automatically activates
".headers on" if headers have not been previously turned on or off.

FossilOrigin-Name: 2827c0a186596299e43eb3e7378eea462d2b060b2c3388ce5cb2bc8e0b43999e
2020-06-05 00:54:27 +00:00
drh
0908e38536 Add support for "box" mode in the CLI: Like "table" except that it uses
unicode box-drawing characters instead of ascii-art.

FossilOrigin-Name: 6da784c9e174744d6deeb76c553b515b96c1fcb80c55a281e476959ec680fb72
2020-06-04 18:05:39 +00:00
drh
634af38115 Improved display of ".mode table" output for empty result sets.
FossilOrigin-Name: 7efabd683b79743b407ad71dda56db00fb0d668828bdc342145816b4f1c3bf3a
2020-06-04 16:54:10 +00:00
dan
b55389412f Use __has_extension(c_atomic) instead of __has_feature(c_atomic) to detect support for atomic load and store operations with clang.
FossilOrigin-Name: 362255791f8801e0d9869e36239b8b2cb29c38bf0b86894bd2d159ce46d8447e
2020-06-04 16:34:49 +00:00
dan
ec206a7d34 Use AtomicStore() to set values in the wal-index hash table.
FossilOrigin-Name: 1ab30c75f2fe14d1ee77d0eace4e29ba8f805d63e2da0897b111ea1311f409aa
2020-06-04 16:07:51 +00:00
drh
21b473de78 Work around a bug in clang-11.0.0.
FossilOrigin-Name: 3c2bf8042ec46195c67dfd91df084f5bc19162fd26389920e716b310c80deea6
2020-06-04 02:50:47 +00:00
drh
a5f3fb3015 Fix for ticket [810dc8038872e212]. Thank to user "Maxulite" for tracking
down the problem!

FossilOrigin-Name: 89af93d77fa7959a4ee7364bae6c02c40963a3cdf80b0a4a8af9c9764d5c7bb5
2020-06-03 19:28:10 +00:00
drh
56f1873d10 Simplification to the interrupt handling logic in sqlite3VdbeExec() saves
a few bytes of code space.

FossilOrigin-Name: 43e0e59bd4e34c6e88c004ea951c0d76ff1cf0a034389f490495a5d12e239382
2020-06-03 15:59:22 +00:00
drh
094afffaec Improve the query planner so that it is better able to find full
index scan plan when there is an INDEXED BY clause.

FossilOrigin-Name: d901837fea1ed54de43ad59eb47c02cbfd2eb215fc57317b5ea8c22a7df947c4
2020-06-03 03:00:09 +00:00
drh
e566cebb26 Draw the dashes below the headers in "explain" mode in the CLI.
FossilOrigin-Name: c6b7833ac7d9cc75cb45d5e8041367ebd6f197f776766e6143535c227fc72a20
2020-05-30 15:34:49 +00:00
drh
e557b0155b Improved VDBE comments on the ANALYZE code generator. This change
also fixes a harmless use of an uninitialized integer variable as an input
to the %d format on a VDBE comment.

FossilOrigin-Name: 1cb248a3fc4c35c5bc3993b554edcccaa5c5e91570af67ebb99643a15221ae33
2020-05-30 00:30:08 +00:00
mistachkin
375b0b014b Enhancements to the incremental build support for MSVC.
FossilOrigin-Name: 2e25d915bcb8d6f1747f9befdef64d2e0e495cc6c5948a8eff5d0097b6613d06
2020-05-29 21:06:52 +00:00
drh
42c2a04eb7 Remove a stray "&" character in the CLI, detected by a clang warning.
FossilOrigin-Name: 5865d2f2d0333024366ecf1d919535fd4ec05c637feff16d75028ccdc8db4b50
2020-05-29 20:16:19 +00:00
drh
02c17a4da7 Add the "shelltest" target to the MSVC makefile as well.
FossilOrigin-Name: 9924c0456bfcd2058c9620a93dfbfd4c7d960c68910ce6aed7364dff42baba5c
2020-05-29 19:45:03 +00:00
drh
9776784f94 Fix the ".import" command of the CLI to clean up better after errors.
Add the new "shelltest" makefile target on unix platforms.

FossilOrigin-Name: 50d4ddf1330b88551de51439eb535f385dee6b53013802dd62f832d16b3025b6
2020-05-29 19:39:35 +00:00
drh
7da29a3ad3 Improvements to help text for the CLI.
FossilOrigin-Name: 6a01e4c444b072e31a320121a6810d7c986c2c54ce45f9b11683233b1e7af8da
2020-05-29 19:17:20 +00:00
drh
1d29fd85a3 Fix a memory leak in the CLI when an unknown or unrecognized
argument is given to the ".dump" command.

FossilOrigin-Name: 71bfbbcc1a8d0e02073a381a5b31a5ccd5477011b22904b9989b6129d81f02e7
2020-05-29 19:03:03 +00:00
drh
8c748633a9 Improvements to columnar output in the CLI. Columns automatically expand
to contain the largest row.

FossilOrigin-Name: 4e1db8e9a9ee370a398f13fd8546a520111b8cfb84460389535b5bc5bd9f4f82
2020-05-29 16:15:58 +00:00
drh
0285d98de7 Space to hold the ".width" of columns in the CLI is now obtained from
malloc() and hence is not limited in the number of columns supported.

FossilOrigin-Name: 445ed5dab2c26e9f4a7fb5277abdba3359d23cf5318cfd0d8322162d9616ee7a
2020-05-29 14:38:43 +00:00
drh
d6f252490e Incremental improvements to tabular output modes in the CLI. The
"markdown" and "table" modes no have headers turned on by default.

FossilOrigin-Name: af28bff91ad7e2d69db0052323c9c05c75a41d4134974bd1305f1c4f579d3558
2020-05-29 12:31:53 +00:00
dan
d31fcd4751 Expand upon a comment in os_unix.c. No changes to code.
FossilOrigin-Name: 77933dc4dbe0e0af3b13a14293a8bd684edc5056f4ae9291c6f95d4433bf90ce
2020-05-29 11:07:20 +00:00
drh
69c093da98 In the json output mode of the CLI, do correct quoting of escape characters.
Also, show BLOBs as JSON strings, possibly with embedded \u0000 bytes.

FossilOrigin-Name: 0278147a7d2b50bed9f59ed3d3a04ecc6d46f072eb510e463f6707df1d829020
2020-05-29 00:21:43 +00:00
drh
30c54a01db Progress toward adding new output modes to the CLI: json, table, and
markdown.

FossilOrigin-Name: 14f55fafec11491e87e6526c72cf85c689d74ba18418a1ae9646586ec206767a
2020-05-28 23:49:50 +00:00
drh
c683573fd4 Enhance the ".quote" mode in the shell so that it honors .separator.
FossilOrigin-Name: b5e33ed537e7d7dcabc9f6dc91d6838e0d1657f323440e09e2e24ffa2ba6141a
2020-05-28 20:37:17 +00:00
drh
56c65c92cb When the sqlite_stat1 data is missing for some indexes of a table but is
present for the table itself or for other indexes in the same table, then do
not let the estimated number of rows in that table get too small, as
doing so can deceive the query planner into ignoring a perfectly good index.

FossilOrigin-Name: 98d4262018a81a9a36dd8beb4b02ff0e75cdcbb8a121d143157ffb37b228d60d
2020-05-28 00:45:16 +00:00
drh
b639a2094a Small performance improvement and size reduction in the expression
code generator.

FossilOrigin-Name: eeb53e219551d8a05a87f1de9a7cd9af295d08a296f1f435a8509ea1252ccdcc
2020-05-27 12:44:28 +00:00
drh
399062cccb Change a datatype from i16 to int to appease Converity and help eliminate
a false-positive.

FossilOrigin-Name: 5b560ec49041d89c87ea3315d8fc17f7fb0e03a82091934be7373b290183f82e
2020-05-27 00:02:07 +00:00
drh
a3d6b8e5a7 Fix the cksumvfs extension so that it will not register itself more than
once.

FossilOrigin-Name: d5cdd57150db914b61b8b9c61c6caac9690fe7b647ee2c003e75b9b62be62752
2020-05-26 20:33:18 +00:00
drh
ed505ce3e4 Performance optimization in the transfer of error messages from statements
to connections.

FossilOrigin-Name: 0e898f4fed1c851cb90f940175110e632a20668a285d39f5f94f7358c3064882
2020-05-26 20:31:17 +00:00
drh
47937cfd8d Increase the version number to 3.33.0 to begin the next release cycle.
FossilOrigin-Name: 790badb390d59062cd2d8d1dec76cc6104c9425610a67503f6be38076b6a458e
2020-05-26 11:23:48 +00:00
drh
ed1e910448 Changes to sqlite3SelectNew() to work around a false-positive warning
from GCC-10.  The code is very slightly larger and slower as a result.

FossilOrigin-Name: 04e1edd8e5821a377407263829ed0d87968c708c9aeb1282107ea6f39a11c1cc
2020-05-26 11:10:25 +00:00
drh
bdd4f7d91c Innocuous changes to help Coverity avoid false-positives.
FossilOrigin-Name: 4ec8a5a203f10d228d0b3389120638766cc343179dbe38d5dbf69b650765934c
2020-05-26 10:54:46 +00:00
drh
d63c76fb31 Version 3.32.1
FossilOrigin-Name: 0c1fcf4711a2e66c813aed38cf41cd3e2123ee8eb6db98118086764c4ba83350
2020-05-25 16:19:56 +00:00
drh
b6907e2993 Extra assert() statements in the printf() logic.
FossilOrigin-Name: b1b182be2ab34cec1d94c5570bc361331a34f727eb9fa4aadfabb7f1ef79f83e
2020-05-25 15:41:03 +00:00
drh
0934d64045 Defensive code that tries to prevent a recurrence of problems like the
one described in ticket [7a5279a25c57adf1]

FossilOrigin-Name: 572105de1d44bca4f18c99d373458889163611384eebbc9659474874ee1701f4
2020-05-25 15:19:52 +00:00
drh
efc752b131 Fix minor compile issues with optional extensions.
FossilOrigin-Name: 3261ee9ec26bbeaa64190c12556a1d8146270b6660c70004830bd38c1b5b63f4
2020-05-25 12:49:58 +00:00
drh
91960aa53f Make sure variable declarations are at start of scope even when
SQLITE_ENABLE_SNAPSHOT is used.

FossilOrigin-Name: a77ceaf6ba934b1d73c90b8980191a65d02ad6ce1e11e6baf573b3a132685545
2020-05-25 12:02:12 +00:00
drh
d3bf766127 Attempt to work around a false-positive warning in the CGo compiler.
FossilOrigin-Name: d4bf60f464789935dc193ea99bf730c8fade448c7dca13eb3ce297965980f36e
2020-05-25 01:31:09 +00:00
drh
e859e43bb8 Version number to 3.32.1.
FossilOrigin-Name: 56e5063c326ffbfd3e3cb6f2b05718412aca2cb183274bfe11f5666effdd04b9
2020-05-24 12:36:20 +00:00
drh
c37577bb2d When rewriting a query for window functions, if the rewrite changes the
depth of TK_AGG_FUNCTION nodes, be sure to adjust the Expr.op2 field
appropriately.  Fix for ticket [7a5279a25c57adf1]

FossilOrigin-Name: ad7bb70af9bb68d192137188bb2528f1e9e43ad164c925174ca1dafc9e1f5339
2020-05-24 03:38:37 +00:00
drh
e40cc16b47 Move some utility Walker callbacks into the walker.c source file, as they
seem to belong there better.

FossilOrigin-Name: dac438236f7c5419d4e7e094e8b3f19f83cd3b1a18bc8acb14aee90d4514fa3c
2020-05-24 03:01:36 +00:00
drh
ca74fbf6f1 Improvements to parse-tree tracing logic. No changes in deliverable code.
FossilOrigin-Name: f7e5a68a7ebbb97a5beb050a75b3b4cf2fd6adc54653da993a8950fb3a5799f7
2020-05-24 02:05:04 +00:00
drh
16dc07f756 Minor fix to a comment. No code changes.
FossilOrigin-Name: efdbb2b499bda8ffcfe54f5d6ece08a2c58fe7a490d9550785d806bd404abb8c
2020-05-24 00:30:38 +00:00
drh
dd6c33d372 Limit the "precision" of floating-point to text conversions in the printf()
function to 100,000,000.  Fix for ticket [23439ea582241138].

FossilOrigin-Name: d08d3405878d394e08e5d3af281246edfbd81ca74cc8d16458808591512fb93d
2020-05-23 19:58:07 +00:00
drh
8e50d65aaf Improved bytecode comment.
FossilOrigin-Name: 9224f1543b51a674ad6d7db8e90d97e1b0d1abe68bed3417820ebd09d27270f9
2020-05-23 17:56:49 +00:00
drh
0b0274a90c Version 3.32.0
FossilOrigin-Name: 5998789c9c744bce92e4cff7636bba800a75574243d6977e1fc8281e360f8d5a
2020-05-22 17:46:16 +00:00
drh
f25f8d5834 Change a NEVER macro into a NO_TEST comment, as the conditional is reachable,
but only when compiling for Windows 32-bit.

FossilOrigin-Name: ce36b6d1331edba5a921fef32553e2470a79bdb1f62d2cfd81190691c83d5b06
2020-05-21 20:38:39 +00:00
dan
23e3c340b5 Avoid another potential OOB read in sqlite3expert.c.
FossilOrigin-Name: 0ccea80092f16e7f17f4c4de4f8be3fdef217199fcc08ace37e179c1b22c1294
2020-05-21 19:13:46 +00:00
drh
4f1315a432 Back out the change from [7fab1393c2b22b1f] that tries to convert invalid
surrogate characters in UTF16 into the replacement character 0xfffd, as we
find that this breaks some software.

FossilOrigin-Name: 4218c7b71fb6b227dbe4b852718584c150164af2d84e067cb810aa602554a609
2020-05-20 15:02:04 +00:00
drh
5a8cd2e40c Add compiler hints to disable TSAN for the routines that access the -shm
file header in WAL mode using a double-read with memory barrier.

FossilOrigin-Name: 3117c1b5a9e348fd8d16ba9d03fdafaad8514567fb3403f72b86d6162ad40bde
2020-05-19 15:51:10 +00:00
dan
10757ed0ca In os_win.c, avoid calling sqlite3_uri_boolean() on anything other than a main-db filename.
FossilOrigin-Name: cb0a18e64f8d81c2ada9f698faaf5ca68a0666687bf6f3abc860324cb1997463
2020-05-19 15:40:07 +00:00
drh
1a7feefac5 User-suggested improvement to the README.txt for the ICU extension.
FossilOrigin-Name: 1d1293c25abdd4b0fca64e5b1d0a118e2f339635dbc89422c0c2463fbf9ee27f
2020-05-19 12:29:56 +00:00
drh
f16cf653f4 In wal.c, improved comments on concurrency issues. More use of
AtomicLoad() and AtomicStore().

FossilOrigin-Name: 4bf566feca3a8fbe5e386533aac30e0ac25836cfc820a3abd91e156bd6198b4a
2020-05-19 12:27:29 +00:00
dan
a5ee67d5b3 Add vdbevtab.lo to build of libsqlite3.lib in Makefile.msc.
FossilOrigin-Name: f64d054b799c0af8d582fd9aff9bcbfa380ef08026ba5db8c5f89f6f56dfdad9
2020-05-18 18:02:37 +00:00
drh
c795e3df7a Avoid harmless UB in memcpy() in the JSON extension.
FossilOrigin-Name: 69e149f76853d196c8855fedfc98848b60fb116ac36bc08824b1a122469f8ece
2020-05-17 13:47:28 +00:00
drh
d924e7bc78 Use the sqlite3Realloc() interface internally, rather than the public
sqlite3_realloc64() equivalent, to avoid unnecessary calls to
sqlite3_initialize().

FossilOrigin-Name: 1313557b512297e7b75ed748894379b2022aecf696d5a58318e46a668321c1ff
2020-05-17 00:26:44 +00:00
drh
b2eb7e46eb Performance optimization for the sqlite3FindTable() subroutine.
FossilOrigin-Name: 55910b9a7287be92af9f95e0af54af822055d15b7eabbcc81d61410d0bf67726
2020-05-16 21:01:00 +00:00
drh
8c1febb2f9 The OP_RealAffinity opcode is not necessary after reading values from
a virtual table (such as rtree).  It is harmless, but it does use CPU
cycles.  Might as well leave it off.

FossilOrigin-Name: dc18d89354cffcb726722c234a0271ab628a71277b22887eea2bf118028193a6
2020-05-16 18:01:02 +00:00
dan
becd68ba0d Fix a use-after-free bug in the fts3 snippet() function.
FossilOrigin-Name: 0d69f76f0865f9626078bee087a22fb826407279e78cf9d5382e1c985c9f64a9
2020-05-16 17:26:58 +00:00
drh
c48428899d Extra memory barrier during initialization.
FossilOrigin-Name: 043a7e142dfc2b0da5fbc0b025d005ccad4886f0b0ff65426ba9155ca40394ca
2020-05-16 16:23:48 +00:00
dan
62c94d0afe Add sqlite3BeginBenignMalloc() and EndBenignMalloc() calls to debugging function sqlite3VdbePrintOp().
FossilOrigin-Name: 6f857d0e9e0893524c2f828a1a1600fefb6efeff12ecbc9bb1da106a5aff9c1c
2020-05-16 15:18:27 +00:00
dan
b2c6fe225a Update code in sqlite3expert.c to account for the fact that "-- TRIGGER xyz" VM comments are now omitted for some builds.
FossilOrigin-Name: 7cf93dc55c48c68731a1fe3ae3517fcfeb5c252bfa87e715a333c6194bcc0ace
2020-05-15 18:48:31 +00:00
dan
d48eafb984 Fix another build problem for SQLITE_OMIT_VIRTUALTABLE builds.
FossilOrigin-Name: 5e1eb0fa3afd74251bc8f484e3edfa81b15610479431af205bd952c91eecd21f
2020-05-15 16:19:35 +00:00
drh
cc1d9109c4 Fix a documentation typo. No changes to code.
FossilOrigin-Name: 758353c72627a847ba027ca44a750bbf057827dafd05811f56e4765dfc77623b
2020-05-15 16:05:31 +00:00
drh
bbf6d4328e Adjust some requirement marks. No changes to code.
FossilOrigin-Name: 7285ae2ce8fb1439e1acea2ec321abbc76aab0a2e84b58683fddb0a7bf74fb1b
2020-05-15 15:03:51 +00:00
dan
2629adc7b2 Update test file e_fkey.test to account for the fact that new columns with REFERENCE clauses and non-NULL default values may now be added using ALTER TABLE if the table is empty.
FossilOrigin-Name: 4087fce97252beda2456164afe9508f952fc9fe4be68ad0e9b330569a78e42f2
2020-05-15 13:52:33 +00:00
dan
34d1566763 Fix SQLITE_OMIT_VIRTUALTABLE testfixture builds.
FossilOrigin-Name: 3d9780c5f6095ea35bc731a51eb34d7cf8bd5dcece825b686b94fd50131626e2
2020-05-15 11:36:16 +00:00
dan
a796de8300 Test script changes to account for the fact that the "p5" column in the EXPLAIN output is now an integer, not a text values containing a 2-digit hex value.
FossilOrigin-Name: 102126d80872fdb7469233611cab28100c8455aab4ce25702b83398394559185
2020-05-15 11:26:31 +00:00
mistachkin
a8e41ecaca Enhancements to long-path support in the Win32 VFS.
FossilOrigin-Name: 0119d96decd344ae711388ac8475b92464a6d018ecf73862170f137410036dac
2020-05-15 01:18:07 +00:00
drh
043c8f60a8 Move some new test cases from fts3snippet.test into fts3snippet2.test.
FossilOrigin-Name: fa203999944133941a38e5c858f1f66fc1ef4d2f33222ab81cbf4e3fc1539f1c
2020-05-15 01:13:46 +00:00
drh
856408abf4 Add the SQLITE_ENABLE_FTS3_PARENTHESIS option to fuzzcheck. Add a new
test case that uses that option.

FossilOrigin-Name: c49a33db954f1a3fbc1889bbe9f3f3fdb8fb00e31aafb91cd6f5d1602db5c2b9
2020-05-15 01:02:00 +00:00
drh
219b8e7e75 Fix a null pointer deference that can occur on a strange matchinfo()
query.

FossilOrigin-Name: a4dd148928ea65bd4e1654dfacc3d8057d1f85b8c9939416991d50722e5a720e
2020-05-14 23:59:24 +00:00
drh
3d863b5e4e Do not allow a virtual table to be renamed into the name of one of its
shadows.

FossilOrigin-Name: eca0ba2cf4c0fdf757bae19c6397a48245adb99e8017ddc28f01804072a30b2c
2020-05-14 21:16:52 +00:00
drh
3c0e606bba Implement the IIF(x,y,z) SQL function that is short-hand for
"CASE WHEN x THEN y ELSE z END".  For compatibility with SQL Server.

FossilOrigin-Name: fce173cd211b15867369b6a54fad48168352fc83981a722ce98e57299b88608a
2020-05-13 18:03:34 +00:00
drh
ffe421c76a Remove unused constant SQLITE_FUNC_COALESCE.
FossilOrigin-Name: a116b20f863e9732cd08fbfbb1aa48204a17d611c9c1edde85dcf59310bde782
2020-05-13 17:26:38 +00:00
dan
8b4f231c47 Use AtomicStore() and AtomicLoad() in a few more places to avoid a theoretically undefined behaviour. This is not actually problem on any known hardware.
FossilOrigin-Name: fda57d4d2f1499c861d43026aa9362d1a30d67c9c002ebf5b0cdc25251537fbb
2020-05-13 13:33:30 +00:00
drh
2493dcdd07 New test case in test/fuzzdata8.db.
FossilOrigin-Name: fa11230135610f01c56d6f436f30a8b57a50b430fe7397ea3a0b6642986b3a39
2020-05-11 11:11:25 +00:00
dan
efa78884a8 Fix a problem handling constant integer expressions with collation sequences in PARTITION BY clauses.
FossilOrigin-Name: 155e6649efe8614718be7ac6c3cccf5b073ae57496dc220db5e4313621f5188e
2020-05-11 10:55:24 +00:00
drh
9e5fdc41c1 Release some restrictions on columns added by ALTER TABLE so that they
only apply if the table contains one or more rows.

FossilOrigin-Name: 3a16c0ce4d8851f79f670d94786032c8007619154ece44647dc9cc5b1f9654ff
2020-05-08 19:02:21 +00:00
drh
98aa1d735e Fix the count-optimization so that it honors the NOT INDEXED clause.
FossilOrigin-Name: 0d23a0b209900f4d7c6c13f75d4364f19afc23db72f9cfdb11e05b81502e8040
2020-05-08 18:22:00 +00:00
drh
91d4c374e2 New test cases added to test/fuzzdata8.db.
FossilOrigin-Name: 3fce9711a47329811cd333ae2f1d1384a96d73b9a5d6f9d08454a57a3fd24fc8
2020-05-08 15:28:07 +00:00
drh
acc175215a Do not retry on a failed realloc() unless SQLITE_ENABLE_MEMORY_MANAGEMENT
is available, meaning that the retry has some possibility of success.

FossilOrigin-Name: e9a8f910b5e2b84dd77364783f0610bca970cc88aa037c88636c72145b99f411
2020-05-08 10:44:23 +00:00
dan
2d3ed22a3f Fix a failing assert() in fts3 triggered by a corrupt database.
FossilOrigin-Name: cb299a090c81cdc5c116c4e15ab38fce112916f8b0fad0c7f2ab127e79238a94
2020-05-07 19:55:40 +00:00
dan
b28f44eba2 Changes to avoid deadlock in SQLITE_ENABLE_SETLK_TIMEOUT builds.
FossilOrigin-Name: 652e4b23fffbff128b177697d7217b7d5aad8baf2364df1646b268ce6774e0fb
2020-05-07 14:39:56 +00:00
dan
11a8182e5c Fix an error that could occur if the first transaction executed by a connection configured to use blocking locks is a write-transaction for which the WRITER lock cannot be obtained.
FossilOrigin-Name: 49e4dc72f7a4b28e4b49d7b91030bc986aea3ff44dac38cb6e68305800cd1de5
2020-05-07 14:26:40 +00:00
dan
4cbe5d3588 Merge trunk changes into this branch.
FossilOrigin-Name: ac4ee69664278a828e0a64c5be3b96fdb6eb6acc95646a9425c667aea328791c
2020-05-07 14:05:08 +00:00
drh
e937df81f0 Fix the handling of reserve-bytes so that the maximum value of 255 can be used.
FossilOrigin-Name: 99749d4fd4930ccf15227f67c732266af9e09dd3cabdc0834fb450ef98196441
2020-05-07 01:56:57 +00:00
dan
a8aae52391 Avoid leaking a file-handle in test file walsetlk.test.
FossilOrigin-Name: 3cfc675e2e917b69108feb3a75728b573abe8e44f0890a7d20d307b0b6784c0e
2020-05-06 21:25:39 +00:00
dan
bc9fc18e45 Fix an assert() failure that could follow an IO error.
FossilOrigin-Name: e89c864299024cdce395a15c19b000b976142b9eed267901a288adaa695f9e65
2020-05-06 21:24:29 +00:00
drh
783e159e48 Fix harmless compiler warnings.
FossilOrigin-Name: 92dc59132f8547635d73c61c21ea29b380c401ddc84a6d01412808e00386b9e8
2020-05-06 20:55:38 +00:00
dan
7a623e1d25 Fix a problem preventing building without SQLITE_ENABLE_SETLK_TIMEOUT defined.
FossilOrigin-Name: 98eb54c6d83992886f17a00b6fc8998df230e3b5f45bafc6fae0d15a9ee5a4c6
2020-05-06 20:45:11 +00:00
dan
7bb8b8a4f7 Add error code SQLITE_BUSY_TIMEOUT, used internally by the OS layer to indicate that a call to xShmLock() has failed due to timeout of a blocking lock.
FossilOrigin-Name: f3ef9c7c2b4ba3de1057ad569f068b241d5f23e6629d8e0dacf85e57fd13b8aa
2020-05-06 20:27:18 +00:00
dan
fc87ab8c4a Fix compiler warnings in non-SQLITE_ENABLE_SETLK_TIMEOUT builds.
FossilOrigin-Name: 22de99ef410ba2a540871f3e61157d8dc4b969416f14808aeca73971b17fcd51
2020-05-06 19:22:59 +00:00
dan
861fb1e9dc Block on the WRITER lock when attempting to run recovery.
FossilOrigin-Name: 105d6c9bbcadc64faa2b24e315cb13227b17cfc6bf1b3512713f80ce56976a3d
2020-05-06 19:14:41 +00:00
drh
e0a8b712c1 Provide the SQLITE_DEFAULT_LEGACY_ALTER_TABLE compile-time option.
FossilOrigin-Name: 63e659d9a793227604aa95685a8d83cd08305f1d01e135407a3ffc6d54482ab8
2020-05-06 18:43:57 +00:00
dan
d0e6d13301 Add tests for running recovery when opening a write transaction or performing a checkpoint with blocking locks enabled. Fix some failing assert() statements.
FossilOrigin-Name: d096ea3fe20f8af90f9e3f798fd0a69527b32ac8e208ade58b9d0af0e831f41b
2020-05-06 17:18:57 +00:00
dan
293e9f5d6c Merge latest trunk changes into this branch.
FossilOrigin-Name: a3727dba10b476f414f0a049b35f2a5c169a408eccefa6833821560684e07f8b
2020-05-06 15:07:25 +00:00
dan
58021b237a Unless upgrading an existing read transaction, have ENABLE_SETLK_TIMEOUT builds attempt to use a blocking lock when opening a write transaction on a wal mode database.
FossilOrigin-Name: d6f819a9e6b35f3fd558bd93255a6a24ad690a0fa15a82b009ca9c641db983c6
2020-05-05 20:30:07 +00:00
drh
fde2592503 The only known path to a corruption detection branch was cut off by the
previous commit implementing earlier index corruption.  So make the branch
NEVER.  Maybe a fuzzer will find a new path.

FossilOrigin-Name: 9a84d8eb44b12ddea921baa73ac3bffa8c8d23a852605dc1dbde37907360bd79
2020-05-05 19:54:02 +00:00
drh
85bd353ac2 Earlier detection of index corruption caused by missing index entries.
FossilOrigin-Name: f339f31f9e9a856b576f99c5230fdf6d60fdc2873e48cb5aa0a4ab1d04e3c930
2020-05-05 18:42:49 +00:00
drh
eb8305bbc7 Fix a compiler warning in cksumvfs.c.
FossilOrigin-Name: 68033bcade87e6046f4c0a49936d63ce531c680c1def98fae02afa0c79db2c7f
2020-05-05 13:41:40 +00:00
drh
3d42fb788a Fix harmless compiler warnings.
FossilOrigin-Name: 8eee591d3cb9fadfd5cac5543bd66ef9cb371a72d3ad3241fb3bfd67fb216eda
2020-05-04 19:52:00 +00:00
dan
8714de97c0 Changes to avoid deadlock in SQLITE_ENABLE_SETLK_TIMEOUT builds.
FossilOrigin-Name: 553423c23142cf0ec219192315d57ce8a0e10c3d8678d28bc110a1a9a7c17cee
2020-05-04 19:42:35 +00:00
drh
44a5c86c6c Minor change to the sqlite_stmt virtual table, for test coverage.
FossilOrigin-Name: 838987b2097c4b7acaa65aea99cfdaf199f04d76bcf6ef12743c60b338a965f7
2020-05-04 19:04:23 +00:00
drh
20e34f9110 Simplify the initialization of built-in extensions.
FossilOrigin-Name: 729f2397358d0382e255ba0058bf70bc9ed410b7621a67466da13de437d3ba5c
2020-05-04 17:15:21 +00:00
drh
995e1af9fa Ensure that the master-journal name is in a form suitable to be passed
into sqlite3_uri_parameter().

FossilOrigin-Name: d1ba026d882f070b351280028e2fa88a3cca59b46d4683302e24c6677e0951b9
2020-05-04 11:47:38 +00:00
drh
278b0517d8 Add the SQLITE_FCNTL_CKPT_START file-control and use it to optimize
the cksumvfs extension.

FossilOrigin-Name: efdecb13091316aeac2722f58577cb0314e008e857f2816a2a222bac0a83e9e1
2020-05-02 04:08:23 +00:00
drh
477a357278 Add support for PRAGMA analyze_limit and approximate analysis.
FossilOrigin-Name: 812547525d35df975f40cbbeb604cc9cd2dec809c1ca083cbb139fe59ffa1d73
2020-05-02 03:46:32 +00:00
drh
f72981f2d9 Add a missing VdbeCoverage() macro.
FossilOrigin-Name: 77a55c394d2c313a5710229bee9262457dcfc6620e6500f9f526c5f6acf87cef
2020-05-02 03:29:21 +00:00
drh
c75921ac4e Merge the bytecode and tables_used table-valued functions. Requires
-DSQLITE_ENABLE_BYTECODE_VTAB at compile-time.

FossilOrigin-Name: d09bcce37f1eaf084e3b07eb4a23653ea1f370cdd290ce3875408186adf87022
2020-05-02 00:31:00 +00:00
drh
7e088a6c0a Corner-case changes to the bytecode virtual table for testability and
correctness.

FossilOrigin-Name: baa720e4a88f268ed95337daab5f434fd3263b00f09101cddc6424765bf3b722
2020-05-02 00:01:39 +00:00
drh
51f1c6f3ec Merge recent enhancements from trunk.
FossilOrigin-Name: 96dfc71ea599702ef38b60952d03e95dce5a8c534cd943e076e9c76b00e61e65
2020-05-01 18:58:21 +00:00
dan
7465787b97 Fix problems with UPDATE...FROM statements that modify rowid or primary-key values.
FossilOrigin-Name: 623ab585d1aa1bdde2df17f1936aa4eec2d997b274acc5c7b291d9566a9ec2c5
2020-05-01 18:43:49 +00:00
drh
fcf31b28ff Add the SQLITE_FCNTL_CKPT_START file-control. Use it to optimize the
cksumvfs extension.

FossilOrigin-Name: b40f5aa344ae10cf4da83b3aa9e4866d6f6ffb06ba7e34ec1ce80c92468cf3bf
2020-05-01 18:37:34 +00:00
drh
e754830eae Merge recent trunk enhancements.
FossilOrigin-Name: 2100b2c8f339e9778723fa0c91e479bab8675cf6fbea1664b6af49f40db6d27b
2020-05-01 15:04:13 +00:00
drh
5051194270 Clarification to the sqlite3_uri() family of interfaces. Documentation
enhancement only - no changes to code.

FossilOrigin-Name: 853703cd6d44d6dd48ef5eda6523e374b8ebdf7c338ddaad31c15a40a8b3fd9b
2020-05-01 13:45:12 +00:00
drh
8b2d8de3e2 Update documentation for sqlite3_close_v2() for clarity. No functional
changes.

FossilOrigin-Name: 80498b69ea489e8816c80a52c9e55a62699116fcbfdcbfd922ef23c2d9938871
2020-05-01 13:32:19 +00:00
drh
cdb6ce980b Add the new SQLITE_IOERR_DATA result code and use it in cksumvfs.
Also enhance cksumvfs to emit an sqlite3_log() message whenever it finds
an invalid checksum.

FossilOrigin-Name: a094e8bfdef10d9e5d97f5a9f7c15b0fc547358b83367762ba5c2dfd2c9d0117
2020-05-01 11:31:43 +00:00
dan
8b023cf592 Add OOM tests for the new code on this branch.
FossilOrigin-Name: e4a18601e5093896e5b323c21aec986b07259353d2ef9455d0a81c6846f40282
2020-04-30 18:28:40 +00:00
dan
1e113844fc Report an error if an UPDATE...FROM statement has an ORDER BY but no LIMIT clause. Add tests for multi-column primary keys.
FossilOrigin-Name: ffcdb6689123bb871c9bd8f977197f86f37c42e9094e2d4bb187ff479f74cf65
2020-04-30 15:49:56 +00:00
dan
f2972b6083 Fix problems with using LIMIT and FROM clauses as part of single UPDATE statement.
FossilOrigin-Name: b717dc3c5fafb9b86a141e7ecffc030fd9b36aa57a0b3e5200d64ad23a0aa13d
2020-04-29 20:11:01 +00:00
dan
9ed322d6c3 Fix various bugs in new feature on this branch.
FossilOrigin-Name: 823ba94e29dece1687e28711e503a1f56d392c306b0cbc0a20548180834530d1
2020-04-29 17:41:29 +00:00
drh
95063d8c90 Do not allow page_size changes on an active cksumvfs database.
FossilOrigin-Name: 2c17cdce26fd935e6d81ff828f4670291fc014013c93b2a1578506598345ee86
2020-04-29 01:09:46 +00:00
drh
451f89a896 Fix incorrect error message when something goes wrong with the
sqlite3_dbpage() table-valued function in the .dbinfo command of the CLI.

FossilOrigin-Name: 0dcf002463f5931c3875d2038d2b97298f1800b1cdfa70485d6430ab758f3b25
2020-04-28 23:09:56 +00:00
drh
065e4a8d29 Add the cksumvfs extension.
FossilOrigin-Name: 237c10f941cc6cb775693ae87513ff1b816f12b5e9c3d57b057421204d2d02cf
2020-04-28 20:47:40 +00:00
drh
23bef340be Use AtomicStore() when setting the mem0.nearlyFull boolean to avoid
harmless TSAN warnings and to forestall doubts about threadsafety.

FossilOrigin-Name: ce980af65a9b528f112baa22a95020a98ac5340155a0b53b09c46f99aad9b12b
2020-04-28 14:01:31 +00:00
drh
9f603fcefd Use an AtomicLoad() macro in sqlite3HeapNearlyFull().
FossilOrigin-Name: 7556bc632e271d8a1e4fd836ce91e28213768ac09c90857b91171e9cd1009884
2020-04-28 11:45:41 +00:00
dan
69887c99d4 Allow a FROM clause in UPDATE statements.
FossilOrigin-Name: f353a1a613bb7ad8cedcda377a7fe6fd05ee03b1f50665b00b84a868a71c5bec
2020-04-27 20:55:33 +00:00
drh
e238e31413 Yet another attempt to enhance sqlite3_load_extension() so that it works
with Window-style pathnames using a backslash separator character.

FossilOrigin-Name: b73d9a7d6f7fec0ffc9640902a849289c305f8651e891388c01255c4da7a6c4b
2020-04-26 22:04:48 +00:00
drh
ec9a25c7c7 Fix an issue with check-in [bc3bf7c6681a96bc] when compiling on Windows.
FossilOrigin-Name: 57b16d8ca3d1ede3b411389256bec6686433aae716f47bca309ee7c8e5fe3128
2020-04-26 14:33:54 +00:00
drh
7d9ad75a56 Fix the sqlite3_load_extension() interface so that it tolerates backslashes
in place of forward-slashes in pathnames on Windows.

FossilOrigin-Name: bc3bf7c6681a96bc18a1ed02f0ccced4731d5dab45f60c347dd1841706e6b62a
2020-04-25 21:05:51 +00:00
dan
07f9e8f4f3 Ensure affinity is not discarded from a view column if the view appears on the rhs of a LEFT JOIN. Fix for [45f4bf4e].
FossilOrigin-Name: ac31edd3eeafcef46164a4506bbc32c711bb7cd78378aeaa4c9bb12524ac5ea1
2020-04-25 15:01:53 +00:00