Commit Graph

20118 Commits

Author SHA1 Message Date
dan
1ab76166e3 Change another fts5 assert() that may fail with a corrupt database to an
assert_nc().

FossilOrigin-Name: d9653380c455b4bf6c371540d677cbde6d17664c58662b5cc9a12929f46192dd
2018-12-24 19:59:37 +00:00
dan
76e4990b25 Add test cases to test file walvfs.test.
FossilOrigin-Name: d697f6f3ca47350dad30feb529914fc5254fa662ece783408eea963d912918c1
2018-12-24 18:51:13 +00:00
drh
c310c53e01 Always include OP_Explain opcodes in the bytecode when SQLITE_DEBUG is enabled.
FossilOrigin-Name: d8c1235c02b745138ac2b12e8bbb00dda4cac321176be92a2fa9547be029b3d0
2018-12-24 18:10:39 +00:00
dan
94e95ea46e Copy some extra test infrastructure from the mutexfree-shmlock branch to trunk.
FossilOrigin-Name: 883337ffdb434b6856ceaada121c0be67e2fdec7b447675f45e85568ef28d7d9
2018-12-24 15:22:47 +00:00
drh
a599e150ca Restore a line of code that was previously commented out for debugging.
FossilOrigin-Name: e53781f5bdf5c7b7d91ffe76565ea2fe5d1b3a9b162b3a88a7017bbe785d4c72
2018-12-24 14:30:11 +00:00
dan
29e9af8848 Change the way a comparison used to detect corrupt databases in fts3 is done
to avoid potential pointer overflow in 32-bit builds.

FossilOrigin-Name: 95a9a39ff784b960b62dd6298e722a620ba3f9c8b76839a49bbef35d7bc84a8e
2018-12-24 13:34:36 +00:00
drh
5198ff5767 Do not generate subroutines for non-static SELECT and EXISTS expressions.
Fix up some test cases to account for the minor changes in EXPLAIN QUERY PLAN
output.

FossilOrigin-Name: 06de44ec9e173992ca9afb89dd2b4e40d2a7e35512c7959603cdceb606f5dfbd
2018-12-24 12:09:47 +00:00
drh
efb699fc7c Prevent the use of subroutines to implement the RHS of IN operators within
CHECK constraints.

FossilOrigin-Name: 6b24d3fb94e787d25e49501714780dfb0c0c99077102056aa68445f4808cdd57
2018-12-24 11:55:44 +00:00
drh
2c04131ca7 Experimental code that tries to put the computation of subqueries inside a
subroutine, and reuse that subroutine if the same subquery is evaluated more
than once.  Current code does not work for CHECK constraints.

FossilOrigin-Name: 6c44838adbe5dc482bc010e91a6dd7a0f777c989f443dd600740d2c783208e0d
2018-12-24 02:34:49 +00:00
drh
85bcdce270 Split the code generation for the RHS of IN operators and for SELECT and
EXISTS expressions into two separate subroutines, because there is now little
commonality between those to functions. This is intended to help make the
code easier to read and maintain.

FossilOrigin-Name: 2b6494b1509f0d0189f98aa34c990eee99c775ff57826e79b2c5b0a12b4c97ad
2018-12-23 21:27:29 +00:00
dan
8d69a58119 Improve the coverage of wal.c provided by the "coverage-wal" test permutation.
FossilOrigin-Name: 6231485114eb07b258cd0e6e163ca05f7e9cf5664e071808fcb1329b33e4c4f5
2018-12-22 20:32:28 +00:00
dan
6a509d56bc Catch another case of a corrupted structure record in fts5.
FossilOrigin-Name: fb17fea4b9779fbd3adb6ff9500da83a6ca4fa7cba379aa70074e4328814a7f2
2018-12-22 19:54:17 +00:00
dan
862faf28bb Change a faulty assert() in fts5 that could fail on a corrupt db to an if() statement.
FossilOrigin-Name: 1daaba9fb46706af8ed0669a661c304df999a69cf639d29d93208f422c515d8c
2018-12-22 19:09:46 +00:00
drh
11d07ed643 Fix one more instance of excess whitespace in test result strings.
FossilOrigin-Name: c064964deb0b7220ba784f07ca9c603680f3c8bb936d56ab4eca1962beac1359
2018-12-22 16:14:45 +00:00
drh
3a07548b0d Remove unnecessary whitespace from testcase result strings.
FossilOrigin-Name: ad70f03ceda74163903d247a975666b35fae722a27c48dd3efd31c1164b5627e
2018-12-22 15:46:23 +00:00
dan
b63d6070ee Fix an assert() in fts5 that could fail with a corrupt database.
FossilOrigin-Name: 83935b950619855fb3bf05486091804ac2a61fb993c6ec826c89f943264fabc3
2018-12-22 15:21:31 +00:00
dan
634ac14488 Fix a "jump or move depends on uninitialized value" valgrind error that could
occur in fts5 when dealing with a corrupt database.

FossilOrigin-Name: 3518c09b944c92974939b1de244401afd34de5d9aa75050e5ad55581a94e1e71
2018-12-22 13:34:52 +00:00
dan
fb11bf8c91 Avoid a left-shift of a negative value (undefined behaviour) when dealing with a corrupt database in
fts3.

FossilOrigin-Name: b851d12474035328df8354c7da8d81bc78833c8c704153f9f573c19b47a8487e
2018-12-22 09:39:06 +00:00
dan
583521fbb0 Fix cut-and-paste error in test file fts4umlaut.test.
FossilOrigin-Name: cad5da1bf5f65ad87d97b72e9a84081fde455ba4085e79943fdf6c0144b1ef83
2018-12-22 07:16:42 +00:00
drh
9bfb079409 Do not all REPLACE to sneak a NULL value into a NOT NULL column. Detect that
situation and ABORT instead.  Fix for ticket [e6f1f2e34dceeb1ed61531c7e98].

FossilOrigin-Name: db8d1d12f5c1673404b2afb5426d5ea3afe3b69d01f8f2bc47ffdf70684fdf24
2018-12-22 01:13:25 +00:00
drh
a42325e731 The OP_Eq and OP_Ne operators have a special P5 value SQLITE_NOTNULL that
asserts that the values are not null.  Except that is not always true for
a corrupt database.  Adjust the assert() and add a testcase() to make this
point clear.

FossilOrigin-Name: a3fdb2c78d23b94d68dc08126b22d03152ac6068496a42402cdfb336cd4a7e33
2018-12-22 00:34:30 +00:00
drh
a86c8ce940 Update the dbtotxt utility program so that it does not output characters that
are special to TCL, thus making the output of dbtotxt easier to insert into
test scripts.

FossilOrigin-Name: 48438bb35b48955a1df83ef90f0ef6c9cfed0b16d2e938f36d74ad9d53b4b5b4
2018-12-21 22:11:37 +00:00
drh
cde4bf8ba7 Improved detection of shadow table corruption in RTREE.
FossilOrigin-Name: b39bf4356e6bcf1d8442721d6cbbfe06caba01325104fb469da8fe69e1f623a2
2018-12-21 22:08:59 +00:00
dan
6ba81ef1bf Add new sqlite3_prepare_v3() flag SQLITE_PREPARE_NO_VTAB, for
preparing statements that are not allowed to use any virtual tables.
Use this to prevent circular references in triggers on virtual table
shadow tables from causing resource leaks.

FossilOrigin-Name: da587d18575ac06a6b65fec1d106f0cc65bc10f493ca6c6b99117a2162d15a52
2018-12-21 20:18:06 +00:00
dan
deb201b866 Use SQLITE_PREPARE_NO_VTAB in rtree as well.
FossilOrigin-Name: 82a2ae7132964eab0dfad9a8314a399ffd3b72366b35e1767df6452125dd1d80
2018-12-21 19:55:20 +00:00
dan
38e3853240 Add tests for the use of SQLITE_PREPARE_NO_VTAB in fts5.
FossilOrigin-Name: 1999612010e310fc2430d1f00076f69fade0c66d202771dbb0f3d5597ac0a03c
2018-12-21 19:30:18 +00:00
dan
1ea0443c2d Add new sqlite3_prepare_v3() flag SQLITE_PREPARE_NO_VTAB, for preparing
statements that are not allowed to use any virtual tables. Use this to prevent
circular references in triggers on virtual table shadow tables from causing
resource leaks.

FossilOrigin-Name: 25666e3d03950caf753295cdb55df162e07dbcf6840b05875c6e0b127c469ecb
2018-12-21 19:29:11 +00:00
drh
afdc9e23fc In FTS3, avoid calling memcpy() with a NULL source pointer, even if the
transfer amount is zero bytes.

FossilOrigin-Name: 1abb83d29a06308c96bea379311b390240347c5f81824749348d18ad75840c96
2018-12-21 18:51:27 +00:00
drh
8bcc686614 The fts4umlaut.test module requires FTS5, so do not try to run it without that
module.

FossilOrigin-Name: dee3ae900129d39d69aff3ec6187376be100803ee6170bbf39529f37b4253260
2018-12-21 18:50:43 +00:00
drh
687e20079c Fix the node hash function in RTREE to ensure that it always returns a
non-negative value.

FossilOrigin-Name: 0bf4c70a6849da74797e8616a4f3730492ad02882ae67a0fe0f3b3cc3f1043b4
2018-12-21 18:17:35 +00:00
drh
273e01b4c6 Fix a potential NULL-pointer deference in RTREE due to corrupt shadow tables.
FossilOrigin-Name: 1fdd3604eef880414682e9e6f74d714520fe1c63f267ec4da752d2dc1da6bf72
2018-12-21 17:51:30 +00:00
drh
fb077f3c50 Prevent an infinite loop in rtree that can result from a corrupt shadow table.
FossilOrigin-Name: 085667180b230587abb82abfdd14da8859e23620994d5cf152236b64c756dd04
2018-12-21 16:53:58 +00:00
drh
1429eca9d4 Fix the RTree extension so that it correctly ignores constraints that it
does not understand, even if they are against a dimension column.

FossilOrigin-Name: ed8531e57596f0d5911a05a26d5ae61e1eccfaadee49219d7f6e212cac288238
2018-12-21 15:13:49 +00:00
drh
558ef11ad9 In RTREE, turn an assert() into an if() because the condition can
sometimes be false when dealing with a corrupt database.

FossilOrigin-Name: 99bce4358beb5dbaba47048ee2eec5c376dcd86e5b1462238a37ea4c5f3d77db
2018-12-21 13:30:34 +00:00
dan
e1e28ec35c Remove an assert() that could fail on a corrupt db from fts3_write.c.
FossilOrigin-Name: 4cdcda408a4edcd2845584ddef64f0efdd2b4cc030afbc05fc2b8b555c69d3f6
2018-12-21 11:53:43 +00:00
drh
94f4f873b2 Do not set the Cursor.seekOp test variable in the OP_NotExists opcode.
This is a change to test logic only and does not affect deliverable builds.

FossilOrigin-Name: 98f343077887c4d3fc2ca3bbc7f20c80ec37b0e521d70af9c986ab80bb2c7903
2018-12-20 22:08:32 +00:00
dan
e46201e264 Fix a bug in the code that detects self-referencing rows as part of foreign
key processing. Fix for [50d2a6c2].

FossilOrigin-Name: 16fff05347f42fe9fa0f3150290b98b59a9bb921e49dc07ca397aa1de7a7e17d
2018-12-20 17:32:33 +00:00
dan
16dd3985f0 Fix a segfault caused by using the RAISE function incorrectly (library now
returns an error instead of crashing).

FossilOrigin-Name: ddf06db702761d663119d508afe21d7dfebe963d576bb42fc2f2024205ab86f8
2018-12-20 15:04:38 +00:00
dan
397a78d4a1 In defensive mode, do not allow shadow tables to be renamed using ALTER TABLE.
FossilOrigin-Name: 23e200da5cfbde0798e67cd9e016e4a1cd73b67981e1af841493fcd123d8f547
2018-12-18 20:31:14 +00:00
mistachkin
99490934ae Move variable declaration to address compilation issue (C89).
FossilOrigin-Name: d64f248da3ce7762fe2c17fbc83f7bea9ffca73723bb3ad0982a85320839da90
2018-12-17 22:19:57 +00:00
dan
bef06d2637 Fix errors in comments in fts5.h.
FossilOrigin-Name: 4002790d9418289f3e090c694f651a89d8f523119c8ce2f396999b0387148241
2018-12-15 07:12:34 +00:00
drh
3c2db5def6 Fix harmless compiler warnings.
FossilOrigin-Name: 27221c69901d2b4546167639c4a3c8f54b2e18820f1346870fa26b7c919027db
2018-12-14 18:11:02 +00:00
drh
ae10474125 Fix possible integer overflow while running PRAGMA integrity_check on a
database file with a badly corrupted freelist.

FossilOrigin-Name: 395599116d801324f0763e59bc5e2fc8622aa5b7572e0c1c9a982efbb3cc8280
2018-12-14 17:57:01 +00:00
drh
d7a5e49840 Back out the expansion of the temporary buffer size from
[32754ca6f86da816] and replace it with an explicit test for buffer
overreads.

FossilOrigin-Name: 8ba3d9f38090c4bbbcffba1930e5c26f69ff61f49b72a4a5a59253d37341380f
2018-12-14 16:20:54 +00:00
drh
e7acce66b2 Avoid a buffer overread in ptrmapPutOvflPtr() that can occurs in a
corrupt database file that has large entries and uses autovacuum.

FossilOrigin-Name: f8b781cf41800e9f61a1c5376404a97e76a2bbbcaa17396d42be62f731363947
2018-12-14 16:00:38 +00:00
drh
fa94d492c8 Fix a harmless compiler warning in Sessions.
FossilOrigin-Name: fc9791ea987352e3e1322fbb7f833c23b402432af8249f9d397c6f7456788637
2018-12-14 13:47:17 +00:00
drh
d6401e869b Expand the size of the temporary page used during btree rebalancing by a
few bytes, to avoid problems with small buffer overreads that can occur
on corrupted database files.

FossilOrigin-Name: 32754ca6f86da8165e274f98f35fc3df3aebd273e9da08387e2d0c3c89abda0f
2018-12-14 13:35:48 +00:00
dan
fffaf23013 When saving the position of a cursor at the b-tree layer, allocate a few extra
bytes at the end of the buffer used to save the key. Otherwise, if the key is
corrupt, the code that restores the cursor position may overread the buffer by a
little.

FossilOrigin-Name: 160b1e31c0f27257c06c2987af9ec3a64abfacb2150325b72e8ccd3d217b5baa
2018-12-14 13:18:35 +00:00
drh
5a1ce4369f Fix a problem with bytecode generation when a query involves two or more
indexes on expressions connected by OR.
Ticket [d96eba87698a428c1ddd0790ea04]

FossilOrigin-Name: 7e4ed8b5c2047b69bbb037497111e56e465a4d9f8afca3b337f9ac744471dc4a
2018-12-14 11:16:52 +00:00
dan
7525b87b6c Posible fix for [d96eba87].
FossilOrigin-Name: 89a25abfcd069aebdf817890e5c27f46de3000fb858ae01029e4528f9d677567
2018-12-14 08:40:11 +00:00
drh
d8cc8b30b4 Fix a bug in fuzzcheck that cause it to overlook a pointer-map bug that was
trigger by the fuzzcheck test data, and also fix the pointer-map bug.

FossilOrigin-Name: cc42dd15100db28a9796254f69a4e367ea5eae29f546be055017cf3e12aa66ba
2018-12-14 03:16:17 +00:00
drh
203b1ea0f5 Detect when an attempt is made to write to a pointer map page that is also
being used as a btree page and report corruption.

FossilOrigin-Name: 3036fd71ac7063359b04a0ed54a6c63a380eb7ff75cd29ed27486d4259066aee
2018-12-14 03:14:18 +00:00
drh
e45985b595 Fix a bug in the custom in-memory VFS used by fuzzcheck. This bug masks
other bugs that should have caused some existing fuzzdata7.db entries to
fail, and so this fix is initially on a branch until those other bugs can
be repaired.

FossilOrigin-Name: e0994e99955cf11f23dba029b5ed7f150f467887558848d5f03510e2fb5855f9
2018-12-14 02:29:56 +00:00
drh
f354e77f3d Fix the dbtotxt decoder in the CLI so that it ignores excess bytes.
FossilOrigin-Name: 18740bd448887d618fafee0b5a7c004aa2f2632244f7d29e2428772baa36b828
2018-12-13 22:58:52 +00:00
drh
6301c43f23 dbfuzz2 found a NEVER() that is sometimes true.
FossilOrigin-Name: 1201615cbbd3070158ea5fab3d2c8c95f41b25d6da096a44cb9257a7b7405efc
2018-12-13 21:52:18 +00:00
drh
8061ad8abd Add extra tests for database corruption inside the defragmentPage() routine,
as dbfuzz2 has found ways for corruption to leak into that point.  Add test
cases in fuzzdata7.db.

FossilOrigin-Name: 997b65117f8c12dba5fb85434fde9765cdb0d2a49cc3e31979abba3e21350086
2018-12-13 21:11:22 +00:00
drh
1641f11f4c Fix a problem in sqlite3BtreeDelete() in which deleting an entry from a
corrupt database can leave a btree page with zero cells.

FossilOrigin-Name: 682053d1e603c21b8085c39db618a39b23ec8d2c4d822fd19634db0e03038ea2
2018-12-13 21:05:45 +00:00
drh
f7e74904cc Add the "decode_hexdb" TCL command to testfixture. Add the dbfuzz001.test
module to demonstration how to use decode_hexdb to deserialize a dbtotxt
database description for use in a corruption test.

FossilOrigin-Name: 1f583c53f3b7318c69f6e235934d97ef9493278feeab0837217076d7d071c35b
2018-12-13 20:49:43 +00:00
drh
2c8ee026ba Fix the CLI to keep proper track of input line numbers for use in error
messages, even after processing in-line hex database inputs using
".open --hexdb".

FossilOrigin-Name: 7ffa9858162774cba03a565a7b65135d9e8bfea726af1a29de6898f66c4b1261
2018-12-13 18:59:30 +00:00
drh
60379d4243 Fix the CLI so that the ".open --hexdb" command works even if it is contained
in a subscript that is read using ".read".

FossilOrigin-Name: 67a87399b8ad8f1ce3052ee3159906f5c6df3d7b5691b3acac856bd2f1c82088
2018-12-13 18:30:01 +00:00
drh
51caa04836 Merge the dbtotxt enhancement from trunk.
FossilOrigin-Name: b386fce9a23e628dce7362dcca2904b8d0af6da58a6fe6eb7f12f058a8363e49
2018-12-13 15:52:31 +00:00
drh
3374648545 Add the "dbtotxt" utility program and the ability to read "dbtotxt" output
as a deserialized input database in the CLI, using the --hexdb option to
the ".open" command.

FossilOrigin-Name: e3bf1d3ea5f748c5142c2403813fdace5aedc1fc68f0dcd5eae40a2fe763fedb
2018-12-13 15:06:26 +00:00
drh
69a66a7be1 Include OPTS in the build of dbfuzz2.
FossilOrigin-Name: eac9c0c49650b008951318a2225b932709a0a8dffbb01ed57684c40357b2e25c
2018-12-13 12:37:13 +00:00
drh
bc1be957c1 Fix the Makefile so that it honors CFLAGS when building sessionfuzz.
FossilOrigin-Name: 54231ac4ca506e6c34c31bc02bb8d3db22f14e1b01679bc70529b165d7dabb83
2018-12-13 12:28:01 +00:00
drh
5881dfea2c New database corruption test cases discovered by dbfuzz2. The new cases
have been added to test/fuzzdata7.db, but have not yet all been fixed,
so tests will not currently pass.

FossilOrigin-Name: b4210d320c6426d2838d4cc08709fdfd015c1c95fcad9a5f9e8fd390c23b9fad
2018-12-13 03:36:13 +00:00
drh
cb0e04f929 Fix another problem found by Matthew Denton's new fuzzer.
FossilOrigin-Name: 2b690dbdffe144bd69ca0aa291c230faf3d9d73f7a2985d50f016fe54003f9a9
2018-12-12 21:34:17 +00:00
drh
89b6de0357 Remove an ALWAYS() from a branch that is not always taken. The test case
found by OSSFuzz has been added to TH3.

FossilOrigin-Name: 5c7dab85535ac42c021977dbd4a39cef5a72e3d9dccff1c5ca5570a1780516cd
2018-12-12 20:11:23 +00:00
drh
03c5c21328 OSSFuzz found a case where an assert() inside sqlite3ExprCompare() can be
true.  Test case added to TH3.

FossilOrigin-Name: 23b62fb160d86dc9d9073bcc714601f5b7695f96abd893eafecf4b2e565b87f2
2018-12-12 11:23:40 +00:00
drh
cfc078318c Small performance improvement in sqlite3_step().
FossilOrigin-Name: d1db8d5894450b24bb0335983503d9bbf6cc48a0ae4b83291283fb2d32b6b25b
2018-12-11 12:51:46 +00:00
drh
368bfe8b00 Small performance improvement in the sqlite3_bind() family of interfaces.
FossilOrigin-Name: 1dc0c3df32572f09265fc73eeaa0748159e0e9523b9b2d6768b834a29c909968
2018-12-11 12:20:41 +00:00
drh
1a6c2b1d38 Further refinements to the sqlite3_normalized_sql() interface. TH3 now
gives 100% MC/DC on that interface.

FossilOrigin-Name: c96bf6cca220e363b099455ce35195ce7e89d374a52dc787f56e7b11e587bced
2018-12-10 20:01:40 +00:00
drh
21b9225ff5 Refactor the sqlite3_normalized_sql() implementation.
FossilOrigin-Name: 06e955e5d2b857b9ce94a73fb174b620c101bdb160842f9a0e958bdb48e8c987
2018-12-10 18:15:44 +00:00
drh
9042ff214b Fix issues with the new normalizer.
FossilOrigin-Name: 057d7d40c56b7416a59a79cb627b2b3e5837eca2d6dbcb50127baaadf1941f51
2018-12-10 16:49:33 +00:00
drh
643d855da9 Refactor the sqlite3_normalized_sql() implementation. This is a
work-in-progress. There are still issues.

FossilOrigin-Name: a4c890b0af9786295e6df05022009d8946550adb873535c610be805c2b7a4083
2018-12-10 16:00:57 +00:00
dan
dc6214ee39 Fix a problem with using "<db>-vacuum" (the default) as the state database
when resuming an RBU vacuum.

FossilOrigin-Name: c878d741733a897d47a1a0b57b454bc9095ce302b48cc01089336d5d20e2a24c
2018-12-10 08:41:32 +00:00
drh
fb34559eb1 Add support for the VACUUM INTO command.
FossilOrigin-Name: 77f150b8b46761f4f62f9d8926c10a95a70589a4525393fc16b321bd98c083a7
2018-12-10 01:48:29 +00:00
drh
4d342827d6 Fix the shell1.test test for the new format of the .backup command.
FossilOrigin-Name: 9748d7995bc1dd632d66d2d326048d50e29c6f5e6993d5a6294d14421d2cb72f
2018-12-10 00:41:28 +00:00
drh
2134eb5721 Merge fixes from trunk.
FossilOrigin-Name: ab1e58fac9e3f9d7d90cefb39f8f145d211d38ec0cb393208c4531cc646056c1
2018-12-10 00:40:43 +00:00
drh
ce706c2cf3 New test case for ticket [1d958d90596593a77420e59].
FossilOrigin-Name: b7bf3c9832bde26b359f4d58ebcf7788c500586d311387d022192ed65a126252
2018-12-09 18:55:05 +00:00
drh
d4a4a36171 Do not use a partial index as a table scan in an IN operator.
Fix for ticket [1d958d90596593a77420e59].

FossilOrigin-Name: 15bc915dd7ae25bfdfbe357c3792db3639799e4d121c6b5b24297af2d6d7129e
2018-12-08 20:30:31 +00:00
drh
a50bffb85e Add the --async option to the ".backup" command in the CLI.
FossilOrigin-Name: 7b6a605b1883dfcbe237b0a58f6f0c233a109e88b521c3b3d97198526c8a0317
2018-12-08 01:09:14 +00:00
drh
2f6239ed4e Allow the INTO clause of VACUUM to be a text-valued expression.
FossilOrigin-Name: af172b53b46759f491f522356e14c5e2374d3f25ec70fbc1e100cadded8f9b22
2018-12-08 00:43:08 +00:00
drh
7464f578ed Do not allow VACUUM INTO into a file that already exists.
FossilOrigin-Name: 92f70e0fa3c9de7fde046f11cc0a7c2800511bb5ace8e68c845133931607616e
2018-12-07 23:48:41 +00:00
drh
52993b31e1 Merge the VACUUM simplification from trunk.
FossilOrigin-Name: 93d92a0a5d21a1856316c0205ecaa253691b6e5349b552d43027005676d14820
2018-12-07 20:40:12 +00:00
drh
83da91b7bd Remove a line of code from VACUUM that is no longer needed, due to the
change that allows ATTACH to run within a transaction.

FossilOrigin-Name: a92c398fc5df142ff1459c1be4a6832f2219bc7fabe5789535be3bbd41a4269b
2018-12-07 20:26:29 +00:00
drh
b0b7db91b8 Prototype implementation for the VACUUM INTO command.
FossilOrigin-Name: 036e3320a4af36c1311b25b2e504b0079c8b33df8ad7b7e5fddad07150e6f87d
2018-12-07 17:28:28 +00:00
drh
893bd3751b Fix the sqlite3_normalized_sql() interface so that it renders
double-quoted string literals as "?".

FossilOrigin-Name: 0d8e150434bbd179696f1ffe71d1e06cb3d43e6468496c7e481fca8486387bad
2018-12-07 16:32:11 +00:00
drh
62a88294e8 Fix dbfuzz2.c so that it works with -DSQLITE_OMIT_INIT
FossilOrigin-Name: 9ad796a8822f1b7e1e99b73c2cc5be59dbfd85e9c27f3e795c29a2c002c611d1
2018-12-07 03:01:07 +00:00
drh
b9a0e668f3 Fix the sqlite3ExprDup() function so that it correctly duplicates the
Window object list on a Select that contains window functions.  Fix
for ticket [f09fcd17810f65f717].

FossilOrigin-Name: db5ed2268eda2e6c1df15cd8df4176463d89103b8fda33ba9a0604f0d92bd4da
2018-12-07 01:56:26 +00:00
drh
a37b6a5e31 Performance improvement: Avoid using sqlite3WalkerSelectExpr()
and sqlite3WalkerSelectFrom() twice, so that the compiler will in-line their
implementation.

FossilOrigin-Name: 2b9258b8b0342330ebe8c22b59ec276fd042a05547d15b24fdf29e16280868de
2018-12-06 22:12:18 +00:00
drh
a838997544 Fix the sqlite3ExprDup() routine so that it makes complete duplications of
subqueries containing window functions.

FossilOrigin-Name: 940174543e87184a0278fcd02e8a096a11510174d9c1d65d21878819790ddaff
2018-12-06 22:04:19 +00:00
drh
bb383df7c6 New test case that still hits an assertion fault, just to prove that the
previous checkin merely made the problem more obscure and did not completely
fix it.

FossilOrigin-Name: a9a3b532643b5f106509bb29c3e6bc9d41ec5b2da5a0cd4067898f376eb626a2
2018-12-06 19:56:20 +00:00
drh
11df7d2839 Simplify the query flattener so that it does not duplicate the WHERE clause
of subquery that is being incorporated into the outer query - copies it
directly.  This is more efficient.  And it also fixes the specific test case
show for ticket [f09fcd17810f65f71789525] but it does not resolve the more
general problem that sqlite3ExprDup() does not correctly duplicate expressions
that contain subqueries with window functions.

FossilOrigin-Name: f1b18d44ff855573542c1947a42d4025dff54cacc13dac14d044521762ea9736
2018-12-06 19:15:36 +00:00
drh
d5b44d60c7 When masking bits off of sqlite3.flags, make sure the mask is 64 bits
in size so as not to accidentally mask of high-order bits.

FossilOrigin-Name: 53d3b169d8e1892163526caff2c843302c92e280fdeff6831e23a9bb15b82be3
2018-12-06 17:06:02 +00:00
drh
70d5dfba68 When saving off the value of sqlite3.flags, take care to preserve all 64
bits.

FossilOrigin-Name: 9c6dbcfab5952cf4e54de30cf9cee48f988b91a35dc3f04d64d6d994dd84a076
2018-12-06 16:50:55 +00:00
drh
ec8fc62c42 Issue a warning whenever a double-quoted string literal is used.
FossilOrigin-Name: ac9ad5043026b30394812457e1535df2759aea0d4510029561e92e386672796f
2018-12-06 16:11:14 +00:00
drh
3e2d47d49f Invoking the sqlite3_trace() or sqlite3_trace_v2() interfaces cancels
any sqlite3_profile() that is running.

FossilOrigin-Name: ec63d3506bd429560077f82a4c5ed9d189780789fe1c134fff4f3b8733be1a3f
2018-12-06 03:59:25 +00:00
drh
fc08a1aef8 Remove the unused pColHash field from the Table object.
FossilOrigin-Name: 3a2c047989facc3461c63a2f9eed412014c951035a80da47c52a70139fb552de
2018-12-06 02:01:17 +00:00
drh
974b24896a Fix a potential NULL pointer dereference that can occur in ALTER TABLE
following an OOM.  Test case in TH3.

FossilOrigin-Name: ea50815bf80ab0d36891518f209acbcd3d6d8d84529741bffd4e841874c78aff
2018-12-06 01:53:12 +00:00
drh
1f169fefca Fix a missing mutex in the sqlite3_normalized_sql() interface when it is
called on a prepared statement that did not previously have a computed
normalization of the input SQL.

FossilOrigin-Name: 1a1a59c6c570879c8f318bbc132103c0285088ba233dd8c32e049b86419347b0
2018-12-06 01:08:58 +00:00
drh
7b278f0c3d Get rid of the hash table used to track IN operators in the
sqlite3_normalized_sql() implementation.  Use simple integer variables
instead.

FossilOrigin-Name: 272dc74fd0304d6a28aaa8798d13e2f950c1a24d92d17519e3c32aef86714586
2018-12-05 23:56:02 +00:00
drh
253a6af532 The sqlite3_normalized_sql() interface should not be transforming quoted
identifier names into wildcards.  Fix this, and at the same time simplify
the code substantially.

FossilOrigin-Name: e8540377ec66fa5f9ae3c93bedb5c094057698199c37fc211f7ea95429e815e4
2018-12-05 23:45:46 +00:00
drh
d4a4dd6ebc Fix an imbalanced lock problem in sqlite3Normalize() introduced by the
simplification in [94ea6379178e3ff6a].

FossilOrigin-Name: f69624373e33c4d370a9264a317ffdb0adbce967a950f243de2b41161a8c7ded
2018-12-05 21:55:39 +00:00
drh
8a65380de9 Increase the version number to 3.27.0 for the next development cycle.
FossilOrigin-Name: 8f8d682825d065bcaebda4cba63f8b67789b923d8b62eb7c576a5bc01536f577
2018-12-05 19:42:59 +00:00
drh
19efd0db41 Simplifications to the sqlite3_normalized_sql() implementation.
FossilOrigin-Name: 94ea6379178e3ff6a0d1d5819ca4ac558bdadb1ca8a3637c797079db7dc0cd61
2018-12-05 17:48:57 +00:00
dan
ea41251eb0 Ensure that ALTER TABLE modifies table and column names embedded in WITH
clauses that are part of views and triggers.

FossilOrigin-Name: f44bc7a8b3fac82aa5598e9bdaf65ea4dd3c331cf90c1d5ba26ff1698e92c230
2018-12-05 13:49:04 +00:00
drh
707821ff72 Enhance the sqlite3_normalize_sql() interface so that it works even if the
prepared statement was not initially compiled using
SQLITE_PREPARE_NORMALIZED.  Enhance the ".trace" command in the CLI so that
it is able to access the full scope of functionality provided by 
sqlite3_trace_v2() and in particular so that it is able to show normalized
SQL output using the newly enhanced sqlite3_normalize_sql() interface.

FossilOrigin-Name: 7da617e97eb905cb009c47403786682b911e32a630f266e1c53ea72836fc88b5
2018-12-05 13:39:06 +00:00
drh
731dd6ebda Add the "index_usage" utility program.
FossilOrigin-Name: df95455213c9d1db7229e94217e78edc05cbf9e40f39528105494ea6ac52be94
2018-12-04 16:51:42 +00:00
drh
04c6747a80 Performance improvement in sqlite3_step() by creating a new mTrace flag
for the legacy xProfile pointer that is set by sqlite3_profile().

FossilOrigin-Name: e28584e8bc7b7405380064b60523fa6191f827f74075f6d117eb7732d752ba5e
2018-12-04 14:33:02 +00:00
drh
b7de827137 Small performance increase in sqlite3_step() for the common case where
it returns SQLITE_ROW.

FossilOrigin-Name: 893448265299f4c70c32c8e92ea66f8d33c1c213b21701f73fa3815514cd5ef6
2018-12-04 13:51:26 +00:00
drh
cfc45b1021 Reduce the size of the parser tables generated by Lemon by splitting the
yyRuleInfo structure into separate yyRuleInfoLhs and yyRuleInfoNRhs arrays.

FossilOrigin-Name: 70fe8ec2ae3099b8773834c7ac2e56768addbecd57956ac523e71a7dc264049c
2018-12-03 23:57:27 +00:00
drh
f8c2fea195 Remove the unused sqlite3Fts5UnicodeNCat() function.
FossilOrigin-Name: 7149dacf1d440a19f62808b4591c3fa8da202b2ec742d5490a63f2ec005ff9e7
2018-12-03 17:40:46 +00:00
dan
e89feee5c3 Add the "remove_diacritics=2" option to the unicode61 tokenizer in both FTS5
and FTS3/4.

FossilOrigin-Name: 06177f3f114b5d804b84c27ac843740282e2176fdf0f7a999feda0e1b624adec
2018-12-03 16:14:49 +00:00
mistachkin
8c53b4e7f6 Update the autoconf makefile for MSVC.
FossilOrigin-Name: 675aba1f8b989cfd99370704ecb09031026dc3321cccad122ea91d816e02fdba
2018-12-03 14:58:07 +00:00
drh
de72d2a81a Remove two lines of unnecessary code, for a very small performance increase
and size decrease.

FossilOrigin-Name: 15824ccda0f110794a479b58fbf36082d8c383f34bae9dc0921d96547fb37869
2018-12-03 01:58:02 +00:00
drh
4a5cff73a7 Fix a parser bug in the use of parentheses around table-valued functions.
FossilOrigin-Name: 58a51123d1a6381cc67d3c64ba3468ec5a92c299ad6fd86de0b843d0ffafb846
2018-12-03 01:47:41 +00:00
drh
fdc75c9f53 Omit a line of code that has no affect on the outcome.
FossilOrigin-Name: 5d933aa659eb7a13f9ab44fe7762be292a1c3c75b957a3b7e0bc6188257b62f4
2018-12-02 01:15:16 +00:00
drh
04ab586bf3 Very slightly smaller and faster.
FossilOrigin-Name: 27798f17f567ad065f8a99effcb287bc241df7b450330ef890d192c70528e62b
2018-12-01 21:13:41 +00:00
drh
4f939e86df Version 3.26.0
FossilOrigin-Name: bf8c1b2b7a5960c282e543b9c293686dccff272512d08865f4600fb58238b4f9
2018-12-01 12:34:55 +00:00
drh
1ba88c7f1d Fix a typo in a comment. No changes to code.
FossilOrigin-Name: 23684cb841ac2cb0d69e5470253bd96feb733762a7553b952a08470834fe85fa
2018-11-30 20:59:00 +00:00
drh
f7c44f9bd2 Fix the name of the trig function approximation in geopoly. No functional
changes to the code.

FossilOrigin-Name: 33576b12b450a37b467ba012e77b297eb80d7147b12a5b23302009bb32455720
2018-11-29 12:00:02 +00:00
drh
4d2f81eb73 Fix a typo in a comment used to generate documentation. No changes to code.
FossilOrigin-Name: 62360ceae9d2321003c49cfac3e9f915969a0da12d02c3e633cfa898c0a68566
2018-11-28 19:23:28 +00:00
dan
3a85a298c9 Update incrvacuum.test so that it works with builds that do not support mmap().
FossilOrigin-Name: 8eb62fd5fa9adb88de51aa812270dbdb32ee5cacd636d200e658c507a14a035b
2018-11-29 01:20:51 +00:00
dan
909f78cbd8 Update some test cases to account for SQLITE_OMIT_VIRTUAL_TABLE builds.
FossilOrigin-Name: b53a9a3dc6b0422a102b245451769b0cd8c0d67090fefabf7cb3a65137a73771
2018-11-28 11:49:46 +00:00
drh
26505e5f51 Follow-up to [0bf0fd242b93c3bd30]: only reset the pager when adding a
new codec, not when overwriting an existing codec.  Also, improve a
comment in the pcache1 subsystem.

FossilOrigin-Name: 5c040fdb013d178e5dffa300621eab91b92beb085ffb9ef2ba08f6bf1dd4013e
2018-11-28 11:09:09 +00:00
dan
49f6a0d82a Changes to Makefile.in to allow testfixture to be built with
SQLITE_USER_AUTHENTICATION.

FossilOrigin-Name: 7b510f59fd2cf68331c35ef6b4c2bcf092adf1120ea22be74d1bab1f42a171f5
2018-11-28 08:24:41 +00:00
dan
1af016b7f4 Remove -DSQLITE_USER_AUTHENTICATION from the "Unlock-Notify" configuration.
Create a dedicated "User-Auth" configuration for testing this feature.

FossilOrigin-Name: 8c41024fbba8c70b671c63a5719c6757f0e6dc731ce52caa755edbb8e21d6944
2018-11-28 08:09:08 +00:00
dan
f6e015fab9 Fixes for SQLITE_OMIT_VIRTUAL_TABLE builds.
FossilOrigin-Name: 9bcdec85e21a5228c700f7373b92ae7ea14b585bcda34235b605be4f7ec15a15
2018-11-28 08:02:28 +00:00
drh
f6fa95b81d Always enable SQLITE_ENABLE_DESERIALIZE for the MSVC makefile as this is necessary
to get releasetest.tcl to work.

FossilOrigin-Name: d362dedba3637013d654f2a890fc7b61476f2adeb6bf3bffb4e715c1d1d0b7c2
2018-11-28 01:45:05 +00:00
dan
63e50b9ed6 Fix a failing assert() in sqlite3ResetAllSchemasOfConnection().
FossilOrigin-Name: 0ea049f342d11c676e148239e45d252164081362e921a4beb735d6899eb77344
2018-11-27 19:47:55 +00:00
drh
fcee090746 Improvements to two cases in pragma4.test.
FossilOrigin-Name: 3c893d9bcc34c391505b08cc35808dd3abddf3c5d952798334c296547bcae6a6
2018-11-27 17:02:38 +00:00
drh
746a1515b2 Remove the sqlite3PagerUseWal() routine which was made obsolete by
the [81629ba91475938b6ad] change.

FossilOrigin-Name: 4331b4990cbc1221d94fadd376dfc6efe83f67836aef00912126da4c924bf659
2018-11-27 14:41:07 +00:00
drh
60ce5d3135 Add a simple test case for Lemon. Always include assert.h in the
Lemon-generated parser.

FossilOrigin-Name: 9c9c46dcbe92aeabe3d5675bb69681b6dfd53798bc67e6a2ceba67ed3c4fb0af
2018-11-27 14:34:33 +00:00
drh
b8a762827c Fix to the error handling logic in the Lemon parser template. This does
not affect SQLite since SQLite does not use that part of the Lemon parser
template.

FossilOrigin-Name: c6dfc59eb12a02d35b708b5d94239377c79f688fa572f72bad51a157b1bf599c
2018-11-27 14:03:11 +00:00
dan
bcdef69482 Add an "#ifndef SQLITE_DISABLE_FTS4_DEFERRED" block around function
fts3EvalDeferredPhrase() in fts3 in order to silence a compiler warning.

FossilOrigin-Name: 6f4b0d0494446d46ac22b17650a25b025995cc545cac8fbc4776cf9dd388bcd8
2018-11-27 09:57:10 +00:00
drh
eea8eb6d04 Do not allow direct access to internal-use SQL functions such as
sqlite_rename_column() and sqlite3_rename_table() except when the
new SQLITE_TESTCTRL_INTERNAL_FUNCTIONS flag is set.

FossilOrigin-Name: 6e1330545e7b74fe5f1f20751a3425e2788441485fc07fcb7626e448c72027ce
2018-11-26 18:09:15 +00:00
drh
49b269e095 Minor comment enhancement in alter.c. No changes to code.
FossilOrigin-Name: 12920bcb99b25e147e1877ee001bc551a743e3530c954fe2b45a18a4eef9eeff
2018-11-26 15:00:25 +00:00
drh
52f0c6205c Fix a bug in the geopoly_ccw() function. Test cases in TH3.
FossilOrigin-Name: 773c5c1d9c0ec40c51949c38c9dc17e778086f3f92791cca9b85288de0076dab
2018-11-24 20:44:46 +00:00
drh
eafb9a0ae5 Make the winTruncate() method of the windows VFS be a no-op if there are
outstanding references to the memory-mapped pages.  Otherwise, memory might
be deleted out from under those references when the file is remapped during
the truncate operation.

FossilOrigin-Name: ffce4aac18dacbf2a3112ae2ab56c7db20cb164f179683d90a66ef38f4a98f2b
2018-11-24 17:46:07 +00:00
drh
48ea97e5dd Remove the unused mmapSizeActual field from the Windows sqlite3_file
implementation.

FossilOrigin-Name: 0e7aa62227d1d9c3540b54d7caf44a1ce7ccfa706672fc41dbb2be477ab3a667
2018-11-24 16:07:21 +00:00
dan
09236755ee Fix a problem reading from temp databases in SQLITE_DIRECT_OVERFLOW_READ
builds.

FossilOrigin-Name: 81629ba91475938b6ad528e7b1dbef4ad22239782bb2e9c1bb59413aba11da87
2018-11-22 19:10:14 +00:00
drh
8055a3ead4 Improvements to the ossfuzz.c fuzz-testing module so that it works with
-DSQLITE_OMIT_PROGRESS_CALLBACK and with -DSQLITE_OMIT_INIT.

FossilOrigin-Name: d343f7d6b05865c282eb73a0e39dc396f2927982af45b3d045de03ef73715693
2018-11-21 14:27:34 +00:00
dan
3c425484a7 Fix problems in pragma.c causing some PRAGMA statements to test the wrong
schema-cookie before proceeding, or to try to open cursors on the wrong
database ("PRAGMA foreign_key_check" only).

FossilOrigin-Name: 6982f52f579d20b8a2965373731d41622bda7f09fbf82cc005bb378321829f4c
2018-11-20 18:09:59 +00:00
drh
2d588b8c08 Fix the regexp used to recognize libdl errors on OS-X.
FossilOrigin-Name: 1740025307531a52e4f0641e2e74dc14715130858f2e9236be13b66924f00220
2018-11-17 14:59:35 +00:00
drh
92cd307c1c Fix harmless compiler warnings that appear with SQLITE_OMIT_EXPLAIN.
FossilOrigin-Name: 5fff00b0d5eb634d40e767671d5a0e8bd263d15d88abe531f6072f01bc789568
2018-11-17 14:26:45 +00:00
drh
0c5a95e43a Remove a C++-style comment.
FossilOrigin-Name: 645232f2b9ce3ee345b1d22c0db1265e39bb674bef9ab6fb10d5bee8ab696787
2018-11-17 14:19:34 +00:00
dan
8e2d4ad30c Fix a problem in test script e_fkey.test.
FossilOrigin-Name: acfd0a05a8957728c1f0eb936f4121ce26f291f20dd583bd57ce2bb271617d3f
2018-11-17 13:08:07 +00:00
drh
d905113e97 Fix a test case so that it works on windows.
FossilOrigin-Name: 2d92d25fae5d9757866a0d0b30427b50d635e9b05e12df9464f095419fd7ef3e
2018-11-16 20:50:53 +00:00
drh
20b3fc4db1 Add SQLITE_CONSTRAINT support to the xBestIndex methods on dbstat,
sqlite_dbpage, and zipfile.

FossilOrigin-Name: 5cd24e552b4fed71cfb2e37929371175682f23f1430df2900a87e6a5823d138e
2018-11-16 20:18:07 +00:00
drh
d16f26a708 Update the explain virtual table to make use of SQLITE_CONSTRAINT.
FossilOrigin-Name: b2d41ff7027b44ccb5dffc303c47d42f1f6fd66ce22e90450d3a666c73fe8b8e
2018-11-16 19:19:58 +00:00
drh
43579191e8 Fix the JSON table-valued functions to make use of SQLITE_CONSTRAINT.
FossilOrigin-Name: 3f34f4f561c77f8ec88906818f2984dcf8f17d1645bac175e9027595517560bc
2018-11-16 16:04:50 +00:00
drh
a69262c0f2 Add an assert() to the generate_series virtual table to verify
assumptions about the design.

FossilOrigin-Name: cd13b499a20a7d476edb8500537edef4c5151410ba0300469ebf0f7ba16964b8
2018-11-16 15:41:27 +00:00
drh
e4f90b7075 Update the generate_series() table-valued function to make use of the new
SQLITE_CONSTRAINT return from xBestIndex.

FossilOrigin-Name: 4372ad644dda5a1fa46b6b6070092320c835439b41f598cbc041e9deef786988
2018-11-16 15:08:31 +00:00
dan
c86b23bfbc In order to avoid exporting a symbol, use a macro instead of a function to
replace sqlite3_complete() in the shell code when SQLITE_OMIT_COMPLETE is
defined.

FossilOrigin-Name: d584a0cb512815945ef06ee3b5ebadbf2a543b008487f6d098e1e8ab79f61d2d
2018-11-16 14:36:42 +00:00
drh
32dcc847b5 Enhance the xBestIndex interface of virtual table so that if the xBestIndex
method returns SQLITE_CONSTRAINT then that particular combination of
constraints is considered unusable and does not participate further in
query planning.

FossilOrigin-Name: 684013cef6bfcfd920a4aec645df9f5d41ace8b34e75fca61759c1b4f82cc89e
2018-11-16 13:56:15 +00:00
drh
eabbf37fae Fix comments and make magic numbers into #defines in the fsdir
implementation.

FossilOrigin-Name: c537c9c3630ca979bdccab977275bfc11cce33ea54adb71a4bd4f46c85f65c6f
2018-11-16 13:06:30 +00:00
dan
cbfaa076d7 Fix a problem with virtual table "fsdir" and some join queries.
FossilOrigin-Name: 7fffcee0fc3fe8d036f0d93ec17673992c3edcf2bb454dc90d80142435b37946
2018-11-16 08:36:15 +00:00
drh
6f147c54ef Improvements to the CSV virtual table.
FossilOrigin-Name: 0406ecbbe75513e342040b71fdd342462222dbb3820486b5f745d7865805c00b
2018-11-16 01:42:26 +00:00
mistachkin
23bfa80c19 Fix typos in the previous check-in.
FossilOrigin-Name: 9b37bbf5f338dea962331e4fd73dfa0baae98ba63344a2fa737b845b90ecb0c5
2018-11-15 19:12:22 +00:00
drh
36d248812b Include geopoly in the compiler-warning script.
FossilOrigin-Name: 3d947e1ec0f0800fcad3a04e4876d5247fd1b23e51ed7f49d428fff6683e8a16
2018-11-15 16:56:33 +00:00
drh
b1b4a3dbca New fuzztest cases.
FossilOrigin-Name: e8316ba47f566c8d2cb48d9d54308e8869743ef39d35b662a8764b0479aed9e0
2018-11-15 13:51:48 +00:00
drh
f9dc5f7726 Fix a potential buffer overread in the dbstat virtual table when processing
a corrupt database file.

FossilOrigin-Name: a62e6b593b59eae44d299842a4d02b9346a0c72a3e1206882f304ab40f2cd5c5
2018-11-13 20:21:52 +00:00
drh
91a21f4d08 Turn on ASAN for the dbfuzz2 utility. Fix a buffer overread associated
with sqlite3_deserialize().

FossilOrigin-Name: 4e38f27b55030e908bd36f32101e26b30f10dbde67e12c8197d0363ee12aa06d
2018-11-13 19:51:41 +00:00
drh
2296b67598 New hyperlinks in comments used to generate documentation. No changes to code.
FossilOrigin-Name: f9755f81b1c0fd29f242dce78a2fba570fa2714d76e93b8563f426a040352513
2018-11-12 15:20:44 +00:00
dan
2639ddc474 Fix a use-after-free problem in the fts5vocab virtual table.
FossilOrigin-Name: ac69d169c61c973448b1d3eef5b8ff0de2d932d7bb74068344cb1b79bd330578
2018-11-12 13:20:00 +00:00
drh
38fa8c9bb0 Add support for read-only shadow tables on virtual tables. Added the
SQLITE_DEFAULT_DEFENSIVE compile-time option that can put SQLite in 
defensive mode by default.

FossilOrigin-Name: 9c685171c4d7ae8615d1489c9621aba79fe4ef1f0e56b75823b88c3e70d127df
2018-11-10 18:23:32 +00:00
dan
d01372f1b8 Add the "changesetfuzz" program. For fuzzing changeset blobs.
FossilOrigin-Name: 2bae0e7c1c1393aeb0bb7234865e410c9ca0e3c31cdc8566e9503f70ca7ac64c
2018-11-10 17:37:39 +00:00
dan
ad5bafa699 Merge latest trunk changes.
FossilOrigin-Name: b6d549c988e765789c4a81d586170451db9f5da1973dde8aa0329445f915fbb2
2018-11-10 17:36:55 +00:00
drh
ab0659fdab Remove a NEVER() that is reachable after all. Reverts checkin [9292d3351c40339].
FossilOrigin-Name: c5dc7fb873b15bd4e4f31b944c9feee78ab7ec2cb74f5fc55b615fd0e2784a88
2018-11-10 04:14:51 +00:00
drh
1ca9a8b9df Merge fixes from trunk.
FossilOrigin-Name: bf88efcec40036e0805940ff6371643dbc518442457d2bc18c711753607ae36c
2018-11-10 03:47:40 +00:00
drh
ac4b8dea9b Fix invalid use of unprotected sqlite3_value objects in the sqldiff utility,
when using the --changeset option.

FossilOrigin-Name: a8d65214a567eb1afd703ee4d09d398247e060a610b46097a726364db2861001
2018-11-09 23:41:57 +00:00
dan
b430701823 When a table is renamed using "ALTER TABLE RENAME TO", update any REFERENCES
clauses that refer to the table, unless "PRAGMA legacy_alter_table" is true
and "PRAGMA foreign_keys" is set to false (i.e. so that when "PRAGMA
legacy_alter_table" is set behaviour is still compatible with versions 3.24
and earlier).

FossilOrigin-Name: ae9638e9c0ad0c366f93c88a850f6b4cc86881e9f3f9f1e39574d9d83ddd8a6a
2018-11-09 20:04:05 +00:00
drh
0b57d312b7 Fix for ticket [787fa716be3a7f650cac]
FossilOrigin-Name: 531eca6104e41e4301fa2cf58bb8fec811da31e151a0f766c93aece5521d235b
2018-11-09 14:17:51 +00:00
drh
145d0a35d9 In the treeview.c module, break out the display of SrcList into a separate
subroutine, so that it can be invoked while debugging.

FossilOrigin-Name: 8c74065f0031274d9bc711d5d53c39aefcfb2b2679811105974a2c7c7a9e1dcb
2018-11-08 22:53:06 +00:00
drh
635b4ce5f7 Improved documentation for SQLITE_DBCONFIG_DEFENSIVE. Add a NEVER() macro
on an unreachable branch.

FossilOrigin-Name: 9292d3351c40339de7ad6bc26c02e7592e6cdee2592e0c790fae63ccf21ea88c
2018-11-08 17:32:50 +00:00
dan
dbc1e9e6a8 Add tests and a fix for program "changesetfuzz".
FossilOrigin-Name: 09b90db56c2d5e3aceae59c6bf1eb07f9db9ef38da29d2162046b88d39e47b86
2018-11-08 14:59:51 +00:00
dan
be075d1188 Merge latest trunk changes into this branch.
FossilOrigin-Name: 53cd91d00594f1bd7c0a565a35ec9cac3095a583022d6211158a369e942257b0
2018-11-07 20:13:45 +00:00
dan
5704f455b9 Fix minor issues in the changesetfuzz program.
FossilOrigin-Name: 5c7f024073bc93089f038b5cf122a7a9d5b933f7c1b357f6d20ae925739ffc38
2018-11-07 20:07:28 +00:00
dan
7844d21536 Update the "changesetfuzz" program to work with patchsets as well as
changesets.

FossilOrigin-Name: 75b00fbe884d4bd8ba099d7c0a2e8af2f40fedfdef2d9b624dd51cb66952611c
2018-11-07 17:52:29 +00:00
drh
e1857cc015 Performance improvement in subroutine that decides whether or not a table
is read-only.

FossilOrigin-Name: 6e4968b00507c4fdbe7e3c91f3f9cd61c6f1848092ddcf306f9fcb101a47fce7
2018-11-07 16:46:43 +00:00
drh
b39dd52adb Merge the onefile permutation fix from trunk.
FossilOrigin-Name: e543bff87d1efc31a5b863085c056ce06c365cc7d9d3fef0ced7521bde536783
2018-11-07 16:12:34 +00:00
drh
b7c2cf0aaf More test-case adjustments for defensive mode.
FossilOrigin-Name: 911e8a17a3810cd7042e91a32aba80dc3d6be88320c208e48f7bcee8b22a0ff2
2018-11-07 14:41:08 +00:00
dan
9db4828662 Fix a problem with the handling of SQLITE_FCNTL_PRAGMA in the test_onefile.c
demo.

FossilOrigin-Name: 13e21b7da8fe754e230b09ca0b9f1f69cd9aa20d4407ddd8b95ca3fb18c9abeb
2018-11-07 14:39:22 +00:00
drh
6b758e1d96 Merge the permutations fix from trunk.
FossilOrigin-Name: b753d849fe0524e14ae9367a47e29be76332fafb77bfe13e266aeef1ef6742ce
2018-11-07 13:41:27 +00:00
dan
7d0fa14c03 Partially revert [3e1a2f661], as some test scripts require separate $presql
and $dbconfig variables.

FossilOrigin-Name: cbf85284beb60d068b446c52f000d694a810d4de9096ad2951523a4c88e7334c
2018-11-07 11:56:23 +00:00
drh
6ab91a7a7a Add the SQLITE_DEFAULT_DEFENSIVE compile-time option. Fix up test cases
so that they work with DEFENSIVE enabled.

FossilOrigin-Name: 3212733cb6d1a59516d67a86df7c7b1d2456a1b2e5d7080c26b0e87b2609c65d
2018-11-07 02:17:01 +00:00
dan
005d4c61c1 Update the changesetfuzz program to fuzz changeset schemas as well as data.
FossilOrigin-Name: 141a93c843d501d8bb640228645ead0a83870c1c11e9d4b07ed24b296c69a0b8
2018-11-06 20:08:03 +00:00
drh
0f0d3ddf71 Enable DEFENSIVE mode by default for tests. This requires lots of case of
turning DEFENSIVE off in order to dodgy things to the database for testing
purposes.  No all of those cases are yet handled, so "make test" does not run
to completion.

FossilOrigin-Name: a1d6c6712c3304fd736077432c8c180692cf7d79be7f3a073510b6dab0eb951f
2018-11-06 19:26:04 +00:00
drh
aef15e74c8 Turn on defensive mode for running test scripts. Does not yet work.
FossilOrigin-Name: 1c1d24edbb732f2a2002a741c7a7afdd010b67e1b5e6d90ff36c6428897e7612
2018-11-06 15:57:59 +00:00
drh
fc25721c9e Only allow shadow table to be written from within a recursive SQL call.
Omit the SQLITE_PREPARE_SHADOW flag.  Some tests are failing because the
tests depend on being able to write to shadow tables.

FossilOrigin-Name: d890c6582524677666e6f5b5817331dec332ade16b2f744cbb8a3c7dd9b63e21
2018-11-06 14:03:07 +00:00
drh
5a65470300 Add enforcement of read-only on shadow tables. This does not currently work
since some virtual tables are attempting to update shadow tables using
sqlite3_exec().

FossilOrigin-Name: f79b47c9859de597d5924870752dd7cab89c8f0608e5cceb2281f6ffb2e91930
2018-11-06 13:37:20 +00:00
drh
84c501bac1 Initial code to make shadow tables read-only to ordinary SQL. The now
xShadowName method is added to the sqlite3_module object and is used
to identify potential shadow tables.  The SQLITE_PREPARE_SHADOW argument
to sqlite3_prepare_v3() is defined.  It is designed to permit writing to
shadow tables, but is currently an unused placeholder.

FossilOrigin-Name: 31942b3dd3f66eb0d9977bf1cadc2f2d7be7967cce2b55784be0b939dfef1985
2018-11-05 23:01:45 +00:00
dan
f095a1affb Add preliminary version of "changesetfuzz" program. For fuzzing changeset data
without creating corrupt changesets.

FossilOrigin-Name: 81ac8745faac0bda8d68ac113f1938f0e25208642e8ceb2af452680086454cb5
2018-11-05 20:37:33 +00:00
drh
2d13f6016b Add the SQLITE_DBCONFIG_DEFENSIVE flag.
FossilOrigin-Name: 11d98414eac467affb0b3cf0c7e5cc3d43184fc2b6e7e898bb5277b51ea9e1fa
2018-11-05 19:37:30 +00:00
drh
9196c81406 Eponymous virtual tables appear to exist in all schemas. This is an alternative
and improved fix to the eponymous virtual table in trigger problem that
was previously addressed by checkin [1fa74930ab56171e].

FossilOrigin-Name: b8d35c4a7c99ce3753761e5b81269d52c3c910c603fa70b72549883ba68bc485
2018-11-05 16:38:10 +00:00
drh
383bb4fa62 Disable the IS NOT NULL optimization when the IS NOT NULL operator is part
of the ON clause of a LEFT JOIN. Fix for ticket [65eb38f6e46de8c75e188a17ec].

FossilOrigin-Name: af39661e60f562b9eb10343fd83e8fe21be4d7276111e7853c1179a24cab09ce
2018-11-05 07:53:17 +00:00
drh
0f1c2eb5f2 Correct the internal logic for SQLITE_DBCONFIG_DEFENSIVE.
FossilOrigin-Name: 76094345821246c887a31a234b339d03a78eddbb9fab33b06c3c20797c038349
2018-11-03 17:31:48 +00:00
dan
29d77dc450 Add extra defenses against strategically corrupt databases to fts3/4.
FossilOrigin-Name: d44318f59044162e229a444582692e9788f17b5c404b4eb702f4c2114b22fefe
2018-11-03 16:51:30 +00:00
drh
a296cda016 Add the SQLITE_DBCONFIG_DEFENSIVE flag.
FossilOrigin-Name: af3f29d49359af2291b1d9e06e0db76fd000fbd24b4ac84d2668a0d1322efd83
2018-11-03 16:09:59 +00:00
drh
c6e519f335 Fix a assert() in the query planner that can arise when doing row-value
operations on a PRIMARY KEY that contains duplicate columns.
Ticket [1a84668dcfdebaf12415d].

FossilOrigin-Name: dcb8c73594ea6b12bad98dc883a585d3e6b925c2ead267dc40332b3d266db5e8
2018-11-03 13:11:24 +00:00