]> git.ipfire.org Git - thirdparty/sqlite.git/log
thirdparty/sqlite.git
6 years agoFix excess memory usage in the JSON parser of GEOPOLY.
drh [Thu, 6 Sep 2018 11:14:17 +0000 (11:14 +0000)] 
Fix excess memory usage in the JSON parser of GEOPOLY.

FossilOrigin-Name: 9057e27e12ded07a9ea0b2868036d3019f7bc5be3a67e3d341f56b762d3de9d9

6 years agoFix a problem with geopoly trying to update both the _shape and an auxiliary
drh [Thu, 6 Sep 2018 02:40:15 +0000 (02:40 +0000)] 
Fix a problem with geopoly trying to update both the _shape and an auxiliary
column in the same UPDATE statement.

FossilOrigin-Name: 14c955152d0580abc3df1b363789f2925e013b9c957e550b1e6ebe83a82bae6c

6 years agoRemove an old testcase() macro that is no longer valid.
drh [Wed, 5 Sep 2018 16:16:56 +0000 (16:16 +0000)] 
Remove an old testcase() macro that is no longer valid.

FossilOrigin-Name: e628713338f6e584a32d5fc3436ddbd9ee8cf88401c321c1ebe7daa1e695c623

6 years agoEnsure that FTS5 queries of the form "WHERE rowid BETWEEN ? AND ? AND tbl
dan [Mon, 3 Sep 2018 17:11:11 +0000 (17:11 +0000)] 
Ensure that FTS5 queries of the form "WHERE rowid BETWEEN ? AND ? AND tbl
MATCH ? ORDER BY rank" do rowid filtering before sorting.

FossilOrigin-Name: f1138a38bd23f201a35621a71e82c5718abddb42ab82938e9516ab9d43e4df16

6 years agoUpdate test script snapshot_fault.test to account for the new
dan [Sat, 1 Sep 2018 06:13:07 +0000 (06:13 +0000)] 
Update test script snapshot_fault.test to account for the new
sqlite3_snapshot_open() error code.

FossilOrigin-Name: c1aca7673ab04740bc8ad76af0a72a229c79a0cd51cf84d1c689a77424ff17c6

6 years agoNew hyperlink on the README.md file.
drh [Fri, 31 Aug 2018 23:22:40 +0000 (23:22 +0000)] 
New hyperlink on the README.md file.

FossilOrigin-Name: c663961e34ec03ef76aabc9741f37d19544826e3e0b5931711313fc088e9e62c

6 years agoIf a call to sqlite3_snapshot_open() fails because the requested snapshot no
dan [Fri, 31 Aug 2018 19:00:16 +0000 (19:00 +0000)] 
If a call to sqlite3_snapshot_open() fails because the requested snapshot no
longer exists, return SQLITE_ERROR_SNAPSHOT instead of SQLITE_BUSY_SNAPSHOT.

FossilOrigin-Name: e07923128bb164efbafde29d49175b61f2ef44b2dfac5ae4ed61937945dfcf4c

6 years agoTry to identify the places in WAL code where thread-safety depends on the
drh [Thu, 30 Aug 2018 20:28:18 +0000 (20:28 +0000)] 
Try to identify the places in WAL code where thread-safety depends on the
underlying architecture supporting atomic load and store of aligned 32-bit
values.

FossilOrigin-Name: 47d44be4a68d377d0049a12b2587dbbcc0870b469473e1098f7c0358fe8c7532

6 years agoGive the debugging routine print_pager_stats() external linkage in order to
drh [Thu, 30 Aug 2018 18:53:09 +0000 (18:53 +0000)] 
Give the debugging routine print_pager_stats() external linkage in order to
suppress harmless compiler and TSAN warnings.

FossilOrigin-Name: ff4dc08298ab3988e69fe60802657791f65d2af15f4b1cbd1d02649bc597d0d6

6 years agoImproved JSON parser caching.
drh [Thu, 30 Aug 2018 01:52:10 +0000 (01:52 +0000)] 
Improved JSON parser caching.

FossilOrigin-Name: 58078c0d2647a194279fa80e032670441b296ffc3acee692901faa5beca460b7

6 years agoAdditional test cases for geopoly.
drh [Wed, 29 Aug 2018 21:01:22 +0000 (21:01 +0000)] 
Additional test cases for geopoly.

FossilOrigin-Name: 19b5eb45e090c4b7169a52d881495ee2eafc59f80e3db2288fc1814ba76134ac

6 years agoFixes to the UPDATE logic in Geopoly.
drh [Wed, 29 Aug 2018 20:52:40 +0000 (20:52 +0000)] 
Fixes to the UPDATE logic in Geopoly.

FossilOrigin-Name: 7c3cee0a2a5ccacff27400c38bd708f7b9b968eb013a8fa685d876dfe85e12a6

6 years agoAlso free up the MEM_RowSet bit in the Mem.flags field and have RowSet objects
drh [Wed, 29 Aug 2018 20:24:03 +0000 (20:24 +0000)] 
Also free up the MEM_RowSet bit in the Mem.flags field and have RowSet objects
be destroyed using Mem.xDel.  This change results in faster code.

FossilOrigin-Name: f48e9feb3fca514e4e586932e6d19a5e34a384204effeba553006dcddf5f13d2

6 years agoFree up the MEM_Frame bit in Mem.flags object. Store VdbeFrame objects
drh [Wed, 29 Aug 2018 18:47:22 +0000 (18:47 +0000)] 
Free up the MEM_Frame bit in Mem.flags object.  Store VdbeFrame objects
as MEM_Blob with a special Mem.xDel pointer instead.

FossilOrigin-Name: 62db5fd47660bbc4fcf2c6d4a6c5a3077f12c6442a128d22b66b789a0409ef32

6 years agoAdd the geopoly_group_bbox() aggregate function to the Geopoly module.
drh [Wed, 29 Aug 2018 15:50:47 +0000 (15:50 +0000)] 
Add the geopoly_group_bbox() aggregate function to the Geopoly module.

FossilOrigin-Name: 2d4debccbc027405a33aeb10f9d65f6fe4bfb5eb1be5a4d8b82158caba04643f

6 years agoDisable the server1.test script on old PPC Macs due to problems in the
drh [Tue, 28 Aug 2018 21:12:02 +0000 (21:12 +0000)] 
Disable the server1.test script on old PPC Macs due to problems in the
pthreads implementation on those archaic machines.

FossilOrigin-Name: 43efdd8c7e468405c9d4956a8caa66548059499289cbcc091628de7b055268cd

6 years agoStricter enforcement of the JSON and GeoJSON standards in the Geopoly extension.
drh [Tue, 28 Aug 2018 19:23:41 +0000 (19:23 +0000)] 
Stricter enforcement of the JSON and GeoJSON standards in the Geopoly extension.

FossilOrigin-Name: c0bf3ff3af4d34ef7801c16e39128e894b00699313f4915f57aa73b57642f7fd

6 years agoFix new issues in the geopoly module discovered by TH3.
drh [Tue, 28 Aug 2018 15:51:10 +0000 (15:51 +0000)] 
Fix new issues in the geopoly module discovered by TH3.

FossilOrigin-Name: 22fff9afc2fb20906173f258aa8feae9b52acc69a0ca7baf4e914d29c4279a23

6 years agoFix a problem causing spurious SQLITE_CORRUPT errors when using the snapshot
dan [Tue, 28 Aug 2018 11:23:52 +0000 (11:23 +0000)] 
Fix a problem causing spurious SQLITE_CORRUPT errors when using the snapshot
API to read from old database snapshots.

FossilOrigin-Name: 535155be584ad8c1836e6b1c62de836d9872056d39608c995221c928cb5b365d

6 years agoAdd support for the Geopoly extension to the R-Tree extension. This also
drh [Mon, 27 Aug 2018 17:13:12 +0000 (17:13 +0000)] 
Add support for the Geopoly extension to the R-Tree extension.  This also
involves adding the SQLITE_INDEX_CONSTRAINT_FUNCTION capability to the
xFindFunction method of the sqlite3_module object, and to the
sqlite3_index_info.aConstraint.op field in the xBestIndex implementation of
virtual tables.

FossilOrigin-Name: 666133e32ca8e95807f8437dc8401bc93e2e6508ab8e6ae1e6031b7cee1584ae

6 years agoMinor changes to the visual01.txt test script. rtree-geopoly
drh [Mon, 27 Aug 2018 17:05:59 +0000 (17:05 +0000)] 
Minor changes to the visual01.txt test script.

FossilOrigin-Name: 4bc28eed32154be0e62fe69acd30f828c2e6f59c6579618ecad8ecf632a90517

6 years agoSplit the three-argument version of geopoly_within() off into a separate
drh [Mon, 27 Aug 2018 15:55:37 +0000 (15:55 +0000)] 
Split the three-argument version of geopoly_within() off into a separate
function named geopoly_contains_point().

FossilOrigin-Name: 5a0e1541037b5bbc1b4bf26a7da304c9b32ea72960aca8b9309cf2180757c8a4

6 years agoEnhance the geopoly virtual table so that it does a better job of optimizing
drh [Sat, 25 Aug 2018 23:03:27 +0000 (23:03 +0000)] 
Enhance the geopoly virtual table so that it does a better job of optimizing
geopoly_within() queries.

FossilOrigin-Name: 1f717385340f295064a7649cfc36ad048573cbacb6faa20f5c6067328c40c745

6 years agoProvide the two-argument geopoly_within(P1,P2) routine that determines if
drh [Sat, 25 Aug 2018 19:51:49 +0000 (19:51 +0000)] 
Provide the two-argument geopoly_within(P1,P2) routine that determines if
polygon P2 is contained within polygon P1.  Make this function available to
the query planner for optimized rtree lookups.  Update the visual01.txt
script to verify that the new functionality actually works.

FossilOrigin-Name: 6eb5d09b7f9d9bf8edbf993dccc2e2f702b95ba96cf68445609feb0ccc3ac0f7

6 years agoFix a harmless compiler warning.
drh [Sat, 25 Aug 2018 18:57:12 +0000 (18:57 +0000)] 
Fix a harmless compiler warning.

FossilOrigin-Name: d49be9838d237b57ba1f12ed00e2d3411314ee1b9c30ef7bbaf65aca20d0870e

6 years agoSet SQLITE_PTRSIZE to 4 when compiling with xlc on 32-bit AIX.
mistachkin [Fri, 24 Aug 2018 19:04:08 +0000 (19:04 +0000)] 
Set SQLITE_PTRSIZE to 4 when compiling with xlc on 32-bit AIX.

FossilOrigin-Name: d158e5b12eec5b81d54c8f5902a972795423947a21d0212b6cceb2810aa6cc5c

6 years agoAutomatically detect when compiling for AArch64 on windows and set
drh [Thu, 23 Aug 2018 18:56:33 +0000 (18:56 +0000)] 
Automatically detect when compiling for AArch64 on windows and set
SQLITE_BYTEORDER to little-endian to avoid compile-time testing.

FossilOrigin-Name: ef6729be85ed106212ed23a024d83b85b709207cf287436c0603a21c659f36ad

6 years agoMerge enhancements from trunk.
drh [Thu, 23 Aug 2018 14:54:45 +0000 (14:54 +0000)] 
Merge enhancements from trunk.

FossilOrigin-Name: c446c8841192054c97ba5003fb6185b135a687b36c10fe0986e627282955520a

6 years agoFix a test case that was failing for SQLITE_ENABLE_STAT4 builds.
dan [Tue, 21 Aug 2018 17:03:25 +0000 (17:03 +0000)] 
Fix a test case that was failing for SQLITE_ENABLE_STAT4 builds.

FossilOrigin-Name: 1e29fd430dead641c5d92943ce81cf51b3df2f45c5a011bb2eed592efd62e056

6 years agoFurther attempts to reduce the number of false-positives genenerated by
drh [Tue, 21 Aug 2018 12:46:34 +0000 (12:46 +0000)] 
Further attempts to reduce the number of false-positives genenerated by
static analysis tools.

FossilOrigin-Name: 38f9ce6503c4dd05ccdd73463b1784a6df7ed6e5018c29c5874a3681ca34ba54

6 years agoFix various harmless warnings generated by static analysis tools.
drh [Tue, 21 Aug 2018 12:16:33 +0000 (12:16 +0000)] 
Fix various harmless warnings generated by static analysis tools.

FossilOrigin-Name: a04a0ea9e30e0ef12bafa0b90b7d1b7764865768bb4a738b0c73a7a3ef9416db

6 years agoFix harmless compiler warnings only seen with STAT4 enabled.
mistachkin [Fri, 17 Aug 2018 21:14:28 +0000 (21:14 +0000)] 
Fix harmless compiler warnings only seen with STAT4 enabled.

FossilOrigin-Name: 6f5e84bafcaf425cb664c7db8179c9c09a13c96aaf057551c04a919ca554d057

6 years agoFix a harmless unused-variable compiler warning that only came up in certain
drh [Thu, 16 Aug 2018 16:24:24 +0000 (16:24 +0000)] 
Fix a harmless unused-variable compiler warning that only came up in certain
compile-time configurations.

FossilOrigin-Name: 456842924bb33c0af8af29402f06e5f25b6791f698a0d12a080258b20b0cfb61

6 years agoFix EXPLAIN QUERY PLAN so that it describes IN operators implemented using
drh [Thu, 16 Aug 2018 15:29:40 +0000 (15:29 +0000)] 
Fix EXPLAIN QUERY PLAN so that it describes IN operators implemented using
a ROWID lookup.

FossilOrigin-Name: 60045fbf52162f15f2e18a4e392e80fab19bdbce242728b5e62b0894eac49dfd

6 years agoAllow sqlite3_snapshot_open() to be called to change the snapshot after a read
dan [Wed, 15 Aug 2018 14:03:26 +0000 (14:03 +0000)] 
Allow sqlite3_snapshot_open() to be called to change the snapshot after a read
transaction is already open on database.

FossilOrigin-Name: 41399169954f9bef53c3fa89879f39823b80bd127f76cf60abbe24217878a571

6 years agoFix UPSERT so that it checks the target-constraint first and fires the
drh [Tue, 14 Aug 2018 15:12:52 +0000 (15:12 +0000)] 
Fix UPSERT so that it checks the target-constraint first and fires the
DO UPDATE if that constraint is violated regardless of whether or not
other constraints are in violation.  This aligns SQLite behavior with
what PostgreSQL does. Fix for ticket [908f001483982c43cdb476dfb590a1a].

FossilOrigin-Name: 529fb55e3d00472f13446117527b0896827b11e870b581af7fe7cbb7392ef3cd

6 years agoStop requiring the global VFS mutex to access the unixInodeInfo.pUnused field.
drh [Mon, 13 Aug 2018 22:50:34 +0000 (22:50 +0000)] 
Stop requiring the global VFS mutex to access the unixInodeInfo.pUnused field.
The unixInodeInfo mutex is sufficient.

FossilOrigin-Name: e3ea43dabf099dc2954c23d348638e7b2a8b9122d2994154bc649a2c09260c46

6 years agoTake extra precautions to ensure access to unixInodeInfo.pUnused is protected
drh [Mon, 13 Aug 2018 20:46:18 +0000 (20:46 +0000)] 
Take extra precautions to ensure access to unixInodeInfo.pUnused is protected
by all necessary mutexes.

FossilOrigin-Name: 8b1e0010b9e0b548a90087f4d25843d2b40f7e9551722ac587fa925d37b510c2

6 years agoFix an incorrect comment on the unix-nolock VFS object. No functional
drh [Mon, 13 Aug 2018 11:32:07 +0000 (11:32 +0000)] 
Fix an incorrect comment on the unix-nolock VFS object.  No functional
code changes.

FossilOrigin-Name: 90f7c193b42f0d8120a8e429bdea5e1cec5d3f45b901db8fc5a5c2ca3e69cba8

6 years agoFix the isLikeOrGlob() routine in the WHERE clause processing logic so that
drh [Thu, 9 Aug 2018 21:45:45 +0000 (21:45 +0000)] 
Fix the isLikeOrGlob() routine in the WHERE clause processing logic so that
it avoids signed/unsigned character comparisons, as that can lead to an
incorrect answer if the ESCAPE clause is an invalid UTF8 string.  Problem
found by OSSFuzz.

FossilOrigin-Name: 4195a3f8b5d2c2ec63771890c5aa7b5e2de60b9fa2273652730239b8577ae418

6 years agoWhen a column must be a constant due to WHERE clause and the value of that
drh [Thu, 9 Aug 2018 18:36:54 +0000 (18:36 +0000)] 
When a column must be a constant due to WHERE clause and the value of that
column is being coded as a constant, make sure the affinity is correct.

FossilOrigin-Name: 7404ea83168e6c739ebe8fc5d65bbf0265432ccb35b3418bb0381d74362f7527

6 years agoMinor style improvements.
mistachkin [Wed, 8 Aug 2018 20:46:35 +0000 (20:46 +0000)] 
Minor style improvements.

FossilOrigin-Name: 60bbca2b9a591800cd8e7b374e62d75b1df0e8fd2d2f71f9b4d5fd044da78be0

6 years agoAllow sqlite3_snapshot_open() to be called to change the snapshot after a exp-snapshot-open
dan [Mon, 6 Aug 2018 17:12:36 +0000 (17:12 +0000)] 
Allow sqlite3_snapshot_open() to be called to change the snapshot after a
read transaction is already open on database.

FossilOrigin-Name: 051ac0152048ef52723196c26ca5f2629dafb782aec1c66fc30531bf54335043

6 years agoEnhance the edit() function so that it converts text from \r\n back into \n
drh [Mon, 6 Aug 2018 02:08:53 +0000 (02:08 +0000)] 
Enhance the edit() function so that it converts text from \r\n back into \n
only if the original unedited copy contained no \r\n values.

FossilOrigin-Name: 20c995d3f0f4de5410962172cb59da0f25edf0c62e199420186cc59ea874e981

6 years agoAdd the --info option to the fuzzcheck test utility.
drh [Mon, 6 Aug 2018 01:39:31 +0000 (01:39 +0000)] 
Add the --info option to the fuzzcheck test utility.

FossilOrigin-Name: 1caaaaa70f21fe71fbe0af227eea8d1367870e2575eedf248cc2a0b515783390

6 years agoFix an overzealous assert() statement discovered by OSSFuzz.
drh [Mon, 6 Aug 2018 01:21:53 +0000 (01:21 +0000)] 
Fix an overzealous assert() statement discovered by OSSFuzz.

FossilOrigin-Name: d9c9fe9f5ad3fc9123ad29ebafcb7f40dcecd448fb7a928bb31bea8181d81ec1

6 years agoRemove the column-cache from the code generator. The column-cache has been
drh [Sat, 4 Aug 2018 20:30:55 +0000 (20:30 +0000)] 
Remove the column-cache from the code generator.  The column-cache has been
a persistent source of bugs for years and with recent improvements
in the performance of OP_Column, it no longer provides a benefit.  After
the column cache is removed, the binary is almost 2KB smaller and the
speed-check.sh performance test is over 3 million cycles faster.

FossilOrigin-Name: cdff3af7bedc5ebea04bd9b5e2112d3db451a475c18c9a9ebd45f6f3a89a43cb

6 years agoRemove a testcase() that is no longer reachable without the column cache. omit-column-cache
drh [Sat, 4 Aug 2018 20:12:10 +0000 (20:12 +0000)] 
Remove a testcase() that is no longer reachable without the column cache.
Provide an assert() to help prove that the testcase is no longer reachable.

FossilOrigin-Name: a500893b6f64aced197cd32b79d51a481629a39d45dbcf0f02d65e5451ac4706

6 years agoFix comments that were made obsolete by the removal of the column cache.
drh [Sat, 4 Aug 2018 17:15:56 +0000 (17:15 +0000)] 
Fix comments that were made obsolete by the removal of the column cache.

FossilOrigin-Name: 2041231d56c7b02b785015ef4d1af260d61326eab1b2a304c17faa3e33f76441

6 years agoRemove more column-cache residue: The OP_SetColTab and OP_VerifyColTab
drh [Sat, 4 Aug 2018 16:54:53 +0000 (16:54 +0000)] 
Remove more column-cache residue:  The OP_SetColTab and OP_VerifyColTab
opcodes and the associated SQLITE_DEBUG_COLUMNCACHE logic.

FossilOrigin-Name: 80236e81cefdf3d3cda3dbdb6de1575c38e4e248cc4b72ca9ee96d3aa0464bfd

6 years agoFurther logic simplifications that flow out of the omission of the column cache.
drh [Sat, 4 Aug 2018 15:53:55 +0000 (15:53 +0000)] 
Further logic simplifications that flow out of the omission of the column cache.

FossilOrigin-Name: 7d9072b027cc28dd8ecf5e2686d821017997445c15124eebe2839984622af4db

6 years agoAdd test cases for the constant expression fix of the previous check-in.
drh [Sat, 4 Aug 2018 15:28:12 +0000 (15:28 +0000)] 
Add test cases for the constant expression fix of the previous check-in.

FossilOrigin-Name: 95db5bd9fea86a10c9528dd24841e1370dfdc0bbb5c98b7cbd808a8bc59dd48f

6 years agoEnsure that all expressions that are to be evaluated once at the start of
drh [Sat, 4 Aug 2018 15:16:20 +0000 (15:16 +0000)] 
Ensure that all expressions that are to be evaluated once at the start of
a prepared statement (the Parse.pConstExpr expressions) pass the
sqlite3ExprIsConstantNotJoin() test. It is not sufficient to pass just the
sqlite3ExprIsConstant() test as that would allow through column references
that are bound to constants by the WHERE clause in the constant propagation
optimization.  This fixes a problem discovered by OSSFuzz.

FossilOrigin-Name: 8bc7f84c39f913b0b0f5e9f5fd9d7dd8bda8422248c069712b6992c32c759a83

6 years agoRemove additional traces of the column cache.
drh [Sat, 4 Aug 2018 14:30:21 +0000 (14:30 +0000)] 
Remove additional traces of the column cache.

FossilOrigin-Name: db6052e9725368736abd19f14f97376582d35d07f543046d39991d767ed29851

6 years agoCompletely remove the column cache logic, which has been a persistent source
drh [Fri, 3 Aug 2018 23:04:16 +0000 (23:04 +0000)] 
Completely remove the column cache logic, which has been a persistent source
of bugs for many years.  We recent enhancements to the performance of the
OP_Column opcode, the removing the column cache actually makes speed-check.sh
run faster.  It also saves about 1,800 bytes of code space.

FossilOrigin-Name: 3f5f60cd7529330209027fdae8129cca420cec1050eae50a7750d0b715b56972

6 years agoFix the handling of sub-queries with LIMIT clauses by the optimization
dan [Fri, 3 Aug 2018 20:19:52 +0000 (20:19 +0000)] 
Fix the handling of sub-queries with LIMIT clauses by the optimization
activated by compile-time symbol SQLITE_COUNTOFVIEW_OPTIMIZATION.

FossilOrigin-Name: 21235d9a41567897418aa12f7bd6dd8d6ee363147527e1d8fbca14fc83e0f2c9

6 years agoFix the OP_SeekRowid opcode so that it has no type-change side-effects on the
drh [Fri, 3 Aug 2018 15:58:07 +0000 (15:58 +0000)] 
Fix the OP_SeekRowid opcode so that it has no type-change side-effects on the
key register in P3.  This fixes an obcure problem that arises when doing
equi-joins between a table with a TEXT column against another table with
an INTEGER PRIMARY KEY.  The original problem was discovered when OSSFuzz
created such a query and hit an assert() in OP_VerifyTabCol that was
specifically designed to catch these kinds of errors at run-time.

FossilOrigin-Name: fa94b49e02eb6b8fc4acc220ecc2fabef546c65845696758b25965c26b251ea9

6 years agoImprove "PRAGMA vdbe_trace=ON" to always show the key values for the
drh [Fri, 3 Aug 2018 13:56:26 +0000 (13:56 +0000)] 
Improve "PRAGMA vdbe_trace=ON" to always show the key values for the
OP_IdxGT and related opcodes.

FossilOrigin-Name: 0f881955ed173c7c35dfca2d4aeca855858e40bb951e6fb6fedd9a2fff6a5a86

7 years agoIn the command-line shell, always exit if realloc() fails.
drh [Sun, 29 Jul 2018 18:56:35 +0000 (18:56 +0000)] 
In the command-line shell, always exit if realloc() fails.

FossilOrigin-Name: e390023c8e70961661fd9e29674dedacd1b941b6b8d9cd88f8cfa8f787f030f9

7 years agoAdd a small cost penalty to sorting to bias the query planner in favor of
drh [Sat, 28 Jul 2018 21:01:55 +0000 (21:01 +0000)] 
Add a small cost penalty to sorting to bias the query planner in favor of
plans that do not require a final sorting pass.

FossilOrigin-Name: 85b9beb4605eb0cfe2ed063c2a1925186c9e37031f78c875e60a347cce891638

7 years agoDo not allow a column reference that is converted into a constant by the
drh [Sat, 28 Jul 2018 16:24:08 +0000 (16:24 +0000)] 
Do not allow a column reference that is converted into a constant by the
WHERE-clause constant propagation optimization to be moved to the init-time
constant expression list, as the table reference will not work there.
This fixes a problem found by OSSFuzz.

FossilOrigin-Name: d30b2a947313b146f29e2b53f0fd471409fda7938151241d3fb5863614f88999

7 years agoFix an assert() statement that was made obsolete by the constant
drh [Sat, 28 Jul 2018 14:56:56 +0000 (14:56 +0000)] 
Fix an assert() statement that was made obsolete by the constant
propagation enhancement.  Problem discovered by OSSFuzz.

FossilOrigin-Name: e4b4737e348235e196a45e1b71876b82e0cc836e1c5c16ea5f9333b7509b59b8

7 years agoImproved debugging output when the ".selecttrace" option is used in the shell.
drh [Sat, 28 Jul 2018 14:34:22 +0000 (14:34 +0000)] 
Improved debugging output when the ".selecttrace" option is used in the shell.

FossilOrigin-Name: fcb88dd6b0f248f600c1158907889f6d5fa2c96eb4585221941da4673c6db6eb

7 years agoImprovements to the parser to increase coverage. Fix the parser so that
drh [Fri, 27 Jul 2018 23:33:16 +0000 (23:33 +0000)] 
Improvements to the parser to increase coverage.  Fix the parser so that
at least one expresssion is required after PARTITION BY and within the
list of expressions on VALUES().

FossilOrigin-Name: 02204f8b246c868846f39bd44f2e3bc0fab0275aa09ef3a0e5a8e3d58f484ca8

7 years agoWhen doing a DROP VIEW do not try to delete entries from the sqlite_stat1
drh [Fri, 27 Jul 2018 22:55:58 +0000 (22:55 +0000)] 
When doing a DROP VIEW do not try to delete entries from the sqlite_stat1
table as there are none.

FossilOrigin-Name: 7efdba2bbc8547ee9292a1bbd1e61d38b40d7aabc0860ceba188bdec539f5114

7 years agoMinor grammar changes that help the parser run faster by reducing the
drh [Fri, 27 Jul 2018 22:14:50 +0000 (22:14 +0000)] 
Minor grammar changes that help the parser run faster by reducing the
number of NUL rule reductions.

FossilOrigin-Name: cfd1b00592bd550e444dfc7b6a6a93c77c07b835729c6cc69a4b6361038964ba

7 years agoEnhance Makefile for MSVC to support building the shell tool without using the amalga...
mistachkin [Fri, 27 Jul 2018 20:45:28 +0000 (20:45 +0000)] 
Enhance Makefile for MSVC to support building the shell tool without using the amalgamation.

FossilOrigin-Name: 3d815d83a6805938b87e03ffabe6d71ca2ecfd05052e8e02c6cc5d3c9ea4ddf3

7 years agoThe WHERE-clause constant propagation optimization attempts to use
drh [Fri, 27 Jul 2018 20:37:42 +0000 (20:37 +0000)] 
The WHERE-clause constant propagation optimization attempts to use
transitive laws to replace column values with constants in the WHERE
clause in order to help to query planner make more aggressive optimizations.

FossilOrigin-Name: f4229707ac08d66c5b0f53483ce17a63f5ac40a21922f66c3408e1b6fda3a7c2

7 years agoReduce the performance cost of the constant propagation optimization to propagate-const-opt
drh [Fri, 27 Jul 2018 20:01:00 +0000 (20:01 +0000)] 
Reduce the performance cost of the constant propagation optimization to
less than 200,000 cycles.

FossilOrigin-Name: 865249de683e6971984a645a30d96f9fcc6f6d9d7af7e269ff68cc3e42e5fe71

7 years agoPerformance improvement to sqlite3ExprCollSeq(). With this change, the
drh [Fri, 27 Jul 2018 18:19:12 +0000 (18:19 +0000)] 
Performance improvement to sqlite3ExprCollSeq().  With this change, the
performance of speed-check.sh is within 400,000 cycles of trunk.

FossilOrigin-Name: a5f86f49b7d9e52546f234f7c3bcbac6b0f78aa55a71c44ca69e21bc31139f3e

7 years agoFaster implementation of sqlite3IsBinary().
drh [Fri, 27 Jul 2018 18:12:40 +0000 (18:12 +0000)] 
Faster implementation of sqlite3IsBinary().

FossilOrigin-Name: be05d0db09f43cc3362c28273463d1d236af737a4f8a494cf1050da07ed0df47

7 years agoOnly run the constant propagation optimization on joins since that is the
drh [Fri, 27 Jul 2018 17:51:20 +0000 (17:51 +0000)] 
Only run the constant propagation optimization on joins since that is the
only scenario where it is useful.  This saves prepare time for the common
case of a simple query.

FossilOrigin-Name: 598d608359005b13fa1151c6c69f2fd12ef3ab7f563a035fc4a6f3c569dc6c67

7 years agoConstant propagation is now restricted to just the WHERE clause. The
drh [Fri, 27 Jul 2018 16:57:11 +0000 (16:57 +0000)] 
Constant propagation is now restricted to just the WHERE clause. The
mechanism is changed to take affinity and collation into account.  This
seems to give correct answers.  But the search for constant propagation
costs 4 million cycles in the speed test.

FossilOrigin-Name: 82c67efb723dba387964f690cd459b420e59e3367d9589016597a76531596391

7 years agoAdd a test case demonstrating the collation problem with constant propagation.
drh [Thu, 26 Jul 2018 23:54:19 +0000 (23:54 +0000)] 
Add a test case demonstrating the collation problem with constant propagation.

FossilOrigin-Name: 50add839fd95665bd67a6ae5de8346fd09e83904bbcbad26fad280dff86d9e93

7 years agoGeneralize the constant propagation optimization so that it applies on every
drh [Thu, 26 Jul 2018 23:47:11 +0000 (23:47 +0000)] 
Generalize the constant propagation optimization so that it applies on every
WHERE close, not just those that contain a subquery.  This then demonstrates
that the current implementation is inadequate since it does not take into
account collating sequences.

FossilOrigin-Name: 57eb2abd5b270d65be5e0f138f0d46899fa6091df3ba20b0ea7ef04244a15d48

7 years agoIn the unix VFS, give every unixInodeInfo object its own mutex, rather
drh [Thu, 26 Jul 2018 21:48:05 +0000 (21:48 +0000)] 
In the unix VFS, give every unixInodeInfo object its own mutex, rather
than using the global VFS mutex, to improve concurrency in cases where there
are many threads operating on separate database files.

FossilOrigin-Name: 22f47cf430827c50634794a5a33987511bb71492c0dd1f6466a0c5b779d0521b

7 years agoInitial implementation of the WHERE-clause constant propagation optimization.
drh [Thu, 26 Jul 2018 21:16:53 +0000 (21:16 +0000)] 
Initial implementation of the WHERE-clause constant propagation optimization.

FossilOrigin-Name: 2fb82ad8ebb6434438c0d235b1239444fb08c8711cea2c5a9ed955fedd0acdec

7 years agoFix a buffer overread in fts5.
dan [Wed, 25 Jul 2018 15:25:55 +0000 (15:25 +0000)] 
Fix a buffer overread in fts5.

FossilOrigin-Name: 0e3de8abbb0c7ae64e637776cb055ce79736f99a103e00e44d17a6b091b98c81

7 years agoKeep generated opcode values grouped together when required, even when they do not...
mistachkin [Wed, 25 Jul 2018 15:12:29 +0000 (15:12 +0000)] 
Keep generated opcode values grouped together when required, even when they do not correspond to a token.

FossilOrigin-Name: 6ee2950b272ede475e485bfaa7d413eaa81482fe9dd6452aeeaf95ff7938f7da

7 years agoFix a typo in the documentation for sqlite3_snapshot_get().
dan [Wed, 25 Jul 2018 07:29:20 +0000 (07:29 +0000)] 
Fix a typo in the documentation for sqlite3_snapshot_get().

FossilOrigin-Name: cd9713c9a88cd30887c67f477abbbf8ef90299051a0b9bb52a04cf4132987c9c

7 years agoDo not abort running queries due to a CREATE INDEX statement. Allow them
drh [Tue, 24 Jul 2018 22:02:12 +0000 (22:02 +0000)] 
Do not abort running queries due to a CREATE INDEX statement.  Allow them
to run to completion before being reprepared.  Fix for ticket
[c694113e50321afdf9].

FossilOrigin-Name: 2bd593332da0aade467e7a4ee89e966aa6302f37540a2c5e23671f98a6cb599c

7 years agoAdd missing SQLITE_OMIT_WINDOWFUNC check to the json1 extension.
mistachkin [Tue, 24 Jul 2018 13:57:44 +0000 (13:57 +0000)] 
Add missing SQLITE_OMIT_WINDOWFUNC check to the json1 extension.

FossilOrigin-Name: fe19f8239dc474db0854a0a8ce5189ac4195c736b496f475a59a185e0879b40c

7 years agoReturn an SQLITE_NOMEM error if the locking mutex fails to allocate. separate-lock-mutex
drh [Mon, 23 Jul 2018 22:55:10 +0000 (22:55 +0000)] 
Return an SQLITE_NOMEM error if the locking mutex fails to allocate.

FossilOrigin-Name: 1c94834879be0601ac40ef3c4fb1b140f7737e89af7808f2f1db4ceb3daae19f

7 years agoFirst attempt at reducing mutex contention in the unix VFS by providing
drh [Mon, 23 Jul 2018 21:10:37 +0000 (21:10 +0000)] 
First attempt at reducing mutex contention in the unix VFS by providing
a separate mutex for each unixInodeInfo object.

FossilOrigin-Name: f69afaf00a659cd768a863c5f4a1d527f01187e037240da0ada527cb52c5afe8

7 years agoFix typo of 'SQLITE_OMIT_WINDOWFUNC'.
mistachkin [Mon, 23 Jul 2018 18:53:49 +0000 (18:53 +0000)] 
Fix typo of 'SQLITE_OMIT_WINDOWFUNC'.

FossilOrigin-Name: 8607b84a5c53d8c9218c90802160a3000f1138b1f188e411a3af46253e0a69cc

7 years agoAttempt to improve the documentation for snapshots. No changes to code.
drh [Mon, 23 Jul 2018 18:32:42 +0000 (18:32 +0000)] 
Attempt to improve the documentation for snapshots.  No changes to code.

FossilOrigin-Name: 46dd076af5880e6e9a7de974758b26bc43d0dc074f8143234038fa9cdcc726ee

7 years agoFix the macros used to generate the output of "PRAGMA compile_options" so that
dan [Mon, 23 Jul 2018 10:57:53 +0000 (10:57 +0000)] 
Fix the macros used to generate the output of "PRAGMA compile_options" so that
they handle valid values for the SQLITE_DEFAULT_LOOKASIDE macro (which
contain a "," character).

FossilOrigin-Name: 1cc72845f92198f2f6c1d34957921cd8f5bc82eaccab9f844006993f0b8d7a96

7 years agoFix more harmless compiler warnings seen with MSVC.
mistachkin [Sun, 22 Jul 2018 21:23:19 +0000 (21:23 +0000)] 
Fix more harmless compiler warnings seen with MSVC.

FossilOrigin-Name: edab5666f8470b37e6031dfd80e615b1aab95d1d85ccbe4ece1a813f8b3d4d95

7 years agoAnother minor revision to the 'fulltestonly' set of tests.
mistachkin [Sun, 22 Jul 2018 21:08:35 +0000 (21:08 +0000)] 
Another minor revision to the 'fulltestonly' set of tests.

FossilOrigin-Name: 61f8e2a4c6c146ffba498c8bb40f2b5627fdc14020057eab63b7e900bf88a9ed

7 years agoFix harmless compiler warning.
mistachkin [Sun, 22 Jul 2018 20:24:38 +0000 (20:24 +0000)] 
Fix harmless compiler warning.

FossilOrigin-Name: ead4762dfcd284127e60483e14f88aa4f4f034c2e1efb68a150359ba8f307776

7 years agoIn the Win32 VFS, when truncating a file, unmap it first.
mistachkin [Sun, 22 Jul 2018 06:25:35 +0000 (06:25 +0000)] 
In the Win32 VFS, when truncating a file, unmap it first.

FossilOrigin-Name: 21510a66dce4d0843ccfe20f092a01f5a52563ef244a94f1d5d2563305cab925

7 years agoRemove an unused branch in the FK logic. dropViewNoStat
drh [Sun, 22 Jul 2018 00:45:11 +0000 (00:45 +0000)] 
Remove an unused branch in the FK logic.

FossilOrigin-Name: 523ff77925f1da361cf31e3fc82bcb1708ed356a2391430ab14ef620c9bf2327

7 years agoIn 'resetdb.test', close a database prior to trying to delete it.
mistachkin [Sat, 21 Jul 2018 23:15:55 +0000 (23:15 +0000)] 
In 'resetdb.test', close a database prior to trying to delete it.

FossilOrigin-Name: 45137053a511b976f5447b0668e3f3a636785d242f44b110a1107898e847e95e

7 years agoWhen dropping a view, skip trying to delete from 'sqlite_stat*'.
mistachkin [Fri, 20 Jul 2018 20:56:22 +0000 (20:56 +0000)] 
When dropping a view, skip trying to delete from 'sqlite_stat*'.

FossilOrigin-Name: 2f5be3a2ddf469bd1b37b9e357545ce872b90c479a07094de2101d0a43ad70a4

7 years agoChange the SQLITE_Stat34 bit of the optimization test-control so that it
drh [Fri, 20 Jul 2018 19:24:02 +0000 (19:24 +0000)] 
Change the SQLITE_Stat34 bit of the optimization test-control so that it
prevents STAT4 data from being used but allows it to be loaded into the
Index objects.  This permits STAT4 to be turned on and off on a per-statement
basis.

FossilOrigin-Name: 489f3caf5dcc8cace20a0da58ceb32fdea5770ba570fa3c9f712cd35e726846a

7 years agoNew checked in PRAGMA integrity_check to validate the autovacuum settings
drh [Fri, 20 Jul 2018 15:44:09 +0000 (15:44 +0000)] 
New checked in PRAGMA integrity_check to validate the autovacuum settings
in the header.

FossilOrigin-Name: a4663f09c91d1381a831f61a2b8e8a113eb6083932c4aea2ad0c011ece1418c5

7 years agoEnhanced detection of problems on the freelist and on overflow list in
drh [Fri, 20 Jul 2018 13:39:28 +0000 (13:39 +0000)] 
Enhanced detection of problems on the freelist and on overflow list in
PRAGMA integrity_check.

FossilOrigin-Name: 11e58f5b37d99848978007d834d187c262d904eb9d58924742e028d7cb324e64

7 years agoAvoid a branch in the commit logic that is unreachable when compiled
drh [Thu, 19 Jul 2018 15:27:35 +0000 (15:27 +0000)] 
Avoid a branch in the commit logic that is unreachable when compiled
without SQLITE_ENABLE_BATCH_ATOMIC_WRITE.

FossilOrigin-Name: 271b8980c3bcd0403a40aec26681ec111be1d88d2d5d35199a85a10f09ad6920

7 years agoAllow the VACUUM following SQLITE_DBCONFIG_RESET_DATABASE to proceed even
drh [Thu, 19 Jul 2018 14:40:41 +0000 (14:40 +0000)] 
Allow the VACUUM following SQLITE_DBCONFIG_RESET_DATABASE to proceed even
if the write-version in the header indicates that the database file is not
writable.

FossilOrigin-Name: 3dca8b9d5ab1f35f17fc527d8f2a20b6bac989d1406c883d5b4d6719953ef6b4

7 years agoExperimental fix for resetting databases that have been deemed read-only due exp-dbreset-fix
dan [Thu, 19 Jul 2018 11:44:02 +0000 (11:44 +0000)] 
Experimental fix for resetting databases that have been deemed read-only due
to a corrupt "read-version" header field.

FossilOrigin-Name: e2394002d02754bb45d56e805df9bc5a2ef0d14e5d94262c1f8ab7643bc27c8f