]> git.ipfire.org Git - thirdparty/sqlite.git/log
thirdparty/sqlite.git
6 years agoRemove a NEVER() that is reachable after all. Reverts checkin [9292d3351c40339]. read-only-shadow
drh [Sat, 10 Nov 2018 04:14:51 +0000 (04:14 +0000)] 
Remove a NEVER() that is reachable after all. Reverts checkin [9292d3351c40339].

FossilOrigin-Name: c5dc7fb873b15bd4e4f31b944c9feee78ab7ec2cb74f5fc55b615fd0e2784a88

6 years agoMerge fixes from trunk.
drh [Sat, 10 Nov 2018 03:47:40 +0000 (03:47 +0000)] 
Merge fixes from trunk.

FossilOrigin-Name: bf88efcec40036e0805940ff6371643dbc518442457d2bc18c711753607ae36c

6 years agoFix invalid use of unprotected sqlite3_value objects in the sqldiff utility,
drh [Fri, 9 Nov 2018 23:41:57 +0000 (23:41 +0000)] 
Fix invalid use of unprotected sqlite3_value objects in the sqldiff utility,
when using the --changeset option.

FossilOrigin-Name: a8d65214a567eb1afd703ee4d09d398247e060a610b46097a726364db2861001

6 years agoWhen a table is renamed using "ALTER TABLE RENAME TO", update any REFERENCES
dan [Fri, 9 Nov 2018 20:04:05 +0000 (20:04 +0000)] 
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

6 years agoFix for ticket [787fa716be3a7f650cac]
drh [Fri, 9 Nov 2018 14:17:51 +0000 (14:17 +0000)] 
Fix for ticket [787fa716be3a7f650cac]

FossilOrigin-Name: 531eca6104e41e4301fa2cf58bb8fec811da31e151a0f766c93aece5521d235b

6 years agoIn the treeview.c module, break out the display of SrcList into a separate
drh [Thu, 8 Nov 2018 22:53:06 +0000 (22:53 +0000)] 
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

6 years agoImproved documentation for SQLITE_DBCONFIG_DEFENSIVE. Add a NEVER() macro
drh [Thu, 8 Nov 2018 17:32:50 +0000 (17:32 +0000)] 
Improved documentation for SQLITE_DBCONFIG_DEFENSIVE.  Add a NEVER() macro
on an unreachable branch.

FossilOrigin-Name: 9292d3351c40339de7ad6bc26c02e7592e6cdee2592e0c790fae63ccf21ea88c

6 years agoPerformance improvement in subroutine that decides whether or not a table
drh [Wed, 7 Nov 2018 16:46:43 +0000 (16:46 +0000)] 
Performance improvement in subroutine that decides whether or not a table
is read-only.

FossilOrigin-Name: 6e4968b00507c4fdbe7e3c91f3f9cd61c6f1848092ddcf306f9fcb101a47fce7

6 years agoMerge the onefile permutation fix from trunk.
drh [Wed, 7 Nov 2018 16:12:34 +0000 (16:12 +0000)] 
Merge the onefile permutation fix from trunk.

FossilOrigin-Name: e543bff87d1efc31a5b863085c056ce06c365cc7d9d3fef0ced7521bde536783

6 years agoMore test-case adjustments for defensive mode.
drh [Wed, 7 Nov 2018 14:41:08 +0000 (14:41 +0000)] 
More test-case adjustments for defensive mode.

FossilOrigin-Name: 911e8a17a3810cd7042e91a32aba80dc3d6be88320c208e48f7bcee8b22a0ff2

6 years agoFix a problem with the handling of SQLITE_FCNTL_PRAGMA in the test_onefile.c
dan [Wed, 7 Nov 2018 14:39:22 +0000 (14:39 +0000)] 
Fix a problem with the handling of SQLITE_FCNTL_PRAGMA in the test_onefile.c
demo.

FossilOrigin-Name: 13e21b7da8fe754e230b09ca0b9f1f69cd9aa20d4407ddd8b95ca3fb18c9abeb

6 years agoMerge the permutations fix from trunk.
drh [Wed, 7 Nov 2018 13:41:27 +0000 (13:41 +0000)] 
Merge the permutations fix from trunk.

FossilOrigin-Name: b753d849fe0524e14ae9367a47e29be76332fafb77bfe13e266aeef1ef6742ce

6 years agoPartially revert [3e1a2f661], as some test scripts require separate $presql
dan [Wed, 7 Nov 2018 11:56:23 +0000 (11:56 +0000)] 
Partially revert [3e1a2f661], as some test scripts require separate $presql
and $dbconfig variables.

FossilOrigin-Name: cbf85284beb60d068b446c52f000d694a810d4de9096ad2951523a4c88e7334c

6 years agoAdd the SQLITE_DEFAULT_DEFENSIVE compile-time option. Fix up test cases
drh [Wed, 7 Nov 2018 02:17:01 +0000 (02:17 +0000)] 
Add the SQLITE_DEFAULT_DEFENSIVE compile-time option.  Fix up test cases
so that they work with DEFENSIVE enabled.

FossilOrigin-Name: 3212733cb6d1a59516d67a86df7c7b1d2456a1b2e5d7080c26b0e87b2609c65d

6 years agoEnable DEFENSIVE mode by default for tests. This requires lots of case of
drh [Tue, 6 Nov 2018 19:26:04 +0000 (19:26 +0000)] 
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

6 years agoTurn on defensive mode for running test scripts. Does not yet work.
drh [Tue, 6 Nov 2018 15:57:59 +0000 (15:57 +0000)] 
Turn on defensive mode for running test scripts.  Does not yet work.

FossilOrigin-Name: 1c1d24edbb732f2a2002a741c7a7afdd010b67e1b5e6d90ff36c6428897e7612

6 years agoOnly allow shadow table to be written from within a recursive SQL call.
drh [Tue, 6 Nov 2018 14:03:07 +0000 (14:03 +0000)] 
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

6 years agoAdd enforcement of read-only on shadow tables. This does not currently work
drh [Tue, 6 Nov 2018 13:37:20 +0000 (13:37 +0000)] 
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

6 years agoInitial code to make shadow tables read-only to ordinary SQL. The now
drh [Mon, 5 Nov 2018 23:01:45 +0000 (23:01 +0000)] 
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

6 years agoAdd the SQLITE_DBCONFIG_DEFENSIVE flag.
drh [Mon, 5 Nov 2018 19:37:30 +0000 (19:37 +0000)] 
Add the SQLITE_DBCONFIG_DEFENSIVE flag.

FossilOrigin-Name: 11d98414eac467affb0b3cf0c7e5cc3d43184fc2b6e7e898bb5277b51ea9e1fa

6 years agoEponymous virtual tables appear to exist in all schemas. This is an alternative
drh [Mon, 5 Nov 2018 16:38:10 +0000 (16:38 +0000)] 
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

6 years agoDisable the IS NOT NULL optimization when the IS NOT NULL operator is part
drh [Mon, 5 Nov 2018 07:53:17 +0000 (07:53 +0000)] 
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

6 years agoCorrect the internal logic for SQLITE_DBCONFIG_DEFENSIVE. dbconfig-defensive
drh [Sat, 3 Nov 2018 17:31:48 +0000 (17:31 +0000)] 
Correct the internal logic for SQLITE_DBCONFIG_DEFENSIVE.

FossilOrigin-Name: 76094345821246c887a31a234b339d03a78eddbb9fab33b06c3c20797c038349

6 years agoAdd extra defenses against strategically corrupt databases to fts3/4.
dan [Sat, 3 Nov 2018 16:51:30 +0000 (16:51 +0000)] 
Add extra defenses against strategically corrupt databases to fts3/4.

FossilOrigin-Name: d44318f59044162e229a444582692e9788f17b5c404b4eb702f4c2114b22fefe

6 years agoAdd the SQLITE_DBCONFIG_DEFENSIVE flag.
drh [Sat, 3 Nov 2018 16:09:59 +0000 (16:09 +0000)] 
Add the SQLITE_DBCONFIG_DEFENSIVE flag.

FossilOrigin-Name: af3f29d49359af2291b1d9e06e0db76fd000fbd24b4ac84d2668a0d1322efd83

6 years agoFix a assert() in the query planner that can arise when doing row-value
drh [Sat, 3 Nov 2018 13:11:24 +0000 (13:11 +0000)] 
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

6 years agoEnhance triggers so that they can use table-valued-functions that exist in
drh [Fri, 2 Nov 2018 17:38:39 +0000 (17:38 +0000)] 
Enhance triggers so that they can use table-valued-functions that exist in
schemas outside of the schema in which the trigger is defined.

FossilOrigin-Name: 1fa74930ab56171e2e840d4a5b259abafb0ad1e0320fc3030066570a6dd10002

6 years agoDeploy the sqlite3Strlen30NN() function (argument guaranteed to be non-NULL) for
drh [Wed, 31 Oct 2018 20:52:00 +0000 (20:52 +0000)] 
Deploy the sqlite3Strlen30NN() function (argument guaranteed to be non-NULL) for
a small performance improvement.

FossilOrigin-Name: 4a6ad5190b62020d97a7de02c801544f20b7b98145ceff14af1f2834d3057f9c

6 years agoAdd support for the SQLITE_PREPARE_NORMALIZED flag and the
drh [Wed, 31 Oct 2018 19:01:13 +0000 (19:01 +0000)] 
Add support for the SQLITE_PREPARE_NORMALIZED flag and the
sqlite3_normalized_sql() when compiling with SQLITE_ENABLE_NORMALIZE.
Also remove unnecessary whitespace from Makefiles.

FossilOrigin-Name: 790ea39a6585ea9f4dad9e132e1fb0447ac1558f728196580d2c3edee84823f7

6 years agoTweaks to the test_intarray documentation and tests.
drh [Wed, 31 Oct 2018 18:24:29 +0000 (18:24 +0000)] 
Tweaks to the test_intarray documentation and tests.

FossilOrigin-Name: 7107f0dacf4467430d1ca157cb848dde984e48e529e7d67a88b7594b0f8159c9

6 years agoMerge fuzz test cases computed by dbfuzz2.
drh [Wed, 31 Oct 2018 01:12:06 +0000 (01:12 +0000)] 
Merge fuzz test cases computed by dbfuzz2.

FossilOrigin-Name: e0d30c1862884049098e1fa9b7c228ff8318a40c09e2516ef2dc8db22e2048e2

6 years agoImproved corrupt database detection in the relocatePage() routine of
drh [Wed, 31 Oct 2018 01:04:18 +0000 (01:04 +0000)] 
Improved corrupt database detection in the relocatePage() routine of
the b-tree module.

FossilOrigin-Name: d57873337a2a7a0d717dc7726cd2682b5bea594d2d1ff8f16c2485161fcd6b16

6 years agoAdd new fuzzer cases generated by dbfuzz2.
drh [Tue, 30 Oct 2018 23:45:18 +0000 (23:45 +0000)] 
Add new fuzzer cases generated by dbfuzz2.

FossilOrigin-Name: 79fdad8b42869100845eed36224602452486d0166c18cec7d343040fdac7379e

6 years agoUpdate comments in sqlite3session.c to describe the format of "rebase blobs",
dan [Tue, 30 Oct 2018 19:14:16 +0000 (19:14 +0000)] 
Update comments in sqlite3session.c to describe the format of "rebase blobs",
as well as changesets and patchsets.

FossilOrigin-Name: bf93f7b56b1d15682988daf3f1c293caf755433defdecd52ba8782fc40e92bd7

6 years agoSplit the SQLITE_WriteSchema flag in two flags, WriteSchema and
drh [Tue, 30 Oct 2018 16:25:35 +0000 (16:25 +0000)] 
Split the SQLITE_WriteSchema flag in two flags, WriteSchema and
SQLITE_NoSchemaError.  Set only WriteSchema on a VACUUM to avoid problems
when trying to vacuum a corrupt database.  With this change, the size
of the flags field on sqlite3 must grow from 32 to 64 bytes.

FossilOrigin-Name: 4f9878107a54356b7105fa1db7655ee239685d570436f6ad4d4221c9bd829b3d

6 years agoModify the CLI so that the --deserialize option is only available if it is
drh [Tue, 30 Oct 2018 15:31:22 +0000 (15:31 +0000)] 
Modify the CLI so that the --deserialize option is only available if it is
compiled with SQLITE_ENABLE_DESERIALIZE.  DESERIALIZE is now off by default
for the main.mk makefile, but on for Makefile.in and Makefile.msc.

FossilOrigin-Name: 90b2a684f775e1468d63bf950119cf0aaa62b5a449f518e7cc513c314191dd14

6 years agoImprovements to the -fsanitize=fuzzer based database file fuzzer.
drh [Tue, 30 Oct 2018 15:20:35 +0000 (15:20 +0000)] 
Improvements to the -fsanitize=fuzzer based database file fuzzer.
(Cherrypick from the rubust-against-damaged-db branch.)

FossilOrigin-Name: 3cc01a0eaf54e3d5adf206825cfcab15edf73bd5aea10dfc497efd78071a17d0

6 years agoIn the CLI, when opening a file that begins with the normal SQLite prefix,
drh [Tue, 30 Oct 2018 14:36:21 +0000 (14:36 +0000)] 
In the CLI, when opening a file that begins with the normal SQLite prefix,
open the file as a normal database even if it has a ZIP for AppendVFS record
at the end.

FossilOrigin-Name: 7989bbda70a24611c3b8af96a53114bb53d87a2e1145ec7ad4f1b4cbf8d6040c

6 years agoEnable sqlite3_deserialize() in the CLI. The --deserialize option associated
drh [Tue, 30 Oct 2018 13:19:49 +0000 (13:19 +0000)] 
Enable sqlite3_deserialize() in the CLI.  The --deserialize option associated
with opening a new database cause the database file to be read into memory
and accessed using the sqlite3_deserialize() API.  This simplifies running
tests on a database without risk of modifying the file on disk.

FossilOrigin-Name: 5e0129ee9afa7c2d707f8ac9e29ef3583c49bb1d0965085c067d58f828ac8cdf

6 years agoFix a potential assertion fault that can occur while trying to DROP a table
drh [Mon, 29 Oct 2018 21:01:28 +0000 (21:01 +0000)] 
Fix a potential assertion fault that can occur while trying to DROP a table
from a corrupted database file.

FossilOrigin-Name: 147a9429a558cf34c316ab8f87832e97caff55d92df696ab6fd045466c8c663d

6 years agoFix minor memory leak in the dbstat extension that can occur following an
drh [Mon, 29 Oct 2018 18:33:42 +0000 (18:33 +0000)] 
Fix minor memory leak in the dbstat extension that can occur following an
attempt to analyze a corrupt database file.

FossilOrigin-Name: cb874fd87384be397008e953242d5773ef5d64e07c3e1ae352a42a25d70597b4

6 years agoAdd the sqlite3_normalized_sql() API. normalized_sql
mistachkin [Mon, 29 Oct 2018 17:53:23 +0000 (17:53 +0000)] 
Add the sqlite3_normalized_sql() API.

FossilOrigin-Name: 592b66e8058dd03a056a036e2606247c9efdb06d15eebe9bcc455f7f55e30ae6

6 years agoIn the sessions module, avoid collecting rebase data if the user has not
dan [Mon, 29 Oct 2018 17:08:27 +0000 (17:08 +0000)] 
In the sessions module, avoid collecting rebase data if the user has not
requested it.

FossilOrigin-Name: de72a773dd3ad58a7f2233e1fc06bf60deb8892a2719ea8e9b42e7d592c1279f

6 years agoHarden the dbstat extension against corrupt database files.
drh [Mon, 29 Oct 2018 16:07:10 +0000 (16:07 +0000)] 
Harden the dbstat extension against corrupt database files.

FossilOrigin-Name: a0d47f25ae7bdf98f5b853f23776b3bf86bea7c0dda386664c1e3b1c363c518f

6 years agoImprovements to the dbfuzz2.c test module.
drh [Sat, 27 Oct 2018 21:06:44 +0000 (21:06 +0000)] 
Improvements to the dbfuzz2.c test module.

FossilOrigin-Name: d60eff493b875366981c5a25000bb65cde9f6e628192914910790acc562c17b9

6 years agoAdd an entry in Makefile.in to build dbfuzz2 using clang-6.0 with
drh [Sat, 27 Oct 2018 16:02:16 +0000 (16:02 +0000)] 
Add an entry in Makefile.in to build dbfuzz2 using clang-6.0 with
-fsanitize=fuzzer,undefined.

FossilOrigin-Name: a4a083ed8cdb106af661d2ee0203e21c576f5c2304419ce603826e4f2851c2e0

6 years agoInitial code for a fuzzing tool on database file that works with the
drh [Sat, 27 Oct 2018 00:47:33 +0000 (00:47 +0000)] 
Initial code for a fuzzing tool on database file that works with the
-fsanitize=fuzzer option of clang.

FossilOrigin-Name: 90d12094d36957fbded71545add8a5dc206798fdacc17d4d161d715569a7f991

6 years agoAdd the sqlite3session_config() interface. For configuring global parameters
dan [Fri, 26 Oct 2018 17:05:00 +0000 (17:05 +0000)] 
Add the sqlite3session_config() interface. For configuring global parameters
belonging to the sessions module.

FossilOrigin-Name: 1e69f3ff057b0be27a9e79842de2485f8299799f309e89bfa7597dd688e0975b

6 years agoPrevent an == constraint specified using the table-valued-function argument
dan [Fri, 26 Oct 2018 15:36:53 +0000 (15:36 +0000)] 
Prevent an == constraint specified using the table-valued-function argument
syntax from being used to optimize any scan not related to the virtual table
for which it was specified as an argument.

FossilOrigin-Name: 4d46685f282409f7154be288719cbea4b743d7ea5315a55a91462003497469f7

6 years agoIn the WHERE-constraint propagation optimization, if there are duplicate
drh [Thu, 25 Oct 2018 14:15:37 +0000 (14:15 +0000)] 
In the WHERE-constraint propagation optimization, if there are duplicate
constraint, make sure only one of them propagates.  Proposed fix for
ticket [cf5ed20fc8621b165].

FossilOrigin-Name: 5d5b596f152bb2781011a05f75f9e200774d4f69d648ef68de577b4ace973e07

6 years agoAdd the ENABLE_GEOPOLY case to the compile_options pragma.
drh [Wed, 24 Oct 2018 23:55:41 +0000 (23:55 +0000)] 
Add the ENABLE_GEOPOLY case to the compile_options pragma.

FossilOrigin-Name: de940296d227c96db4d0cf913fc5c0e5138729eda7cda0a0ac6b704cce1e1e1e

6 years agoFix a problem with using window functions in compound (UNION, INTERSECT etc.)
dan [Tue, 23 Oct 2018 13:48:19 +0000 (13:48 +0000)] 
Fix a problem with using window functions in compound (UNION, INTERSECT etc.)
queries.

FossilOrigin-Name: 059ff53a46c7f1e4bf3e7dc558312beef67826c2753e2ab7e4e7df498b37b617

6 years agoAdd the sqlite3changeset_start_v2() - a new version of _start() that accepts a flags...
dan [Sat, 20 Oct 2018 13:48:09 +0000 (13:48 +0000)] 
Add the sqlite3changeset_start_v2() - a new version of _start() that accepts a flags parameter - and a streaming equivalent to the sessions module. Also add the SQLITE_CHANGESETSTART_INVERT flag, used with start_v2() to invert a changeset while iterating through it.

FossilOrigin-Name: cbedcb9aaefdfe00453efbdf0eac6c15e1f53bbe8fff2e7d534a5adf23be04f5

6 years agoTake steps to avoid a potential integer overflow in sessionBufferGrow().
dan [Thu, 18 Oct 2018 15:17:18 +0000 (15:17 +0000)] 
Take steps to avoid a potential integer overflow in sessionBufferGrow().

FossilOrigin-Name: f7affa2e708d1b4c7c47157bcb18e9f79611ca45a93ebc88de6dc96f84a677e7

6 years agoAdd the SQLITE_CHANGESETAPPLY_INVERT flag to sessions. For inverting and applying...
dan [Thu, 18 Oct 2018 14:59:21 +0000 (14:59 +0000)] 
Add the SQLITE_CHANGESETAPPLY_INVERT flag to sessions. For inverting and applying a changeset in a single step.

FossilOrigin-Name: d4b6406e7f5ba06ac73ab9fdef57232b2459e0af12420ed946ebed6aef46f0b1

6 years agoTest case modifications to support SEE.
drh [Fri, 12 Oct 2018 15:01:56 +0000 (15:01 +0000)] 
Test case modifications to support SEE.

FossilOrigin-Name: 02b6f8f2778c371130c512e980c3db07c7e76dcf7dd92a878b86e4b6a47ca307

6 years agoAdd the textkey and textrekey pragmas.
drh [Thu, 11 Oct 2018 18:41:50 +0000 (18:41 +0000)] 
Add the textkey and textrekey pragmas.

FossilOrigin-Name: f03164d45450cd7ff2162999aa9e51eec7fb5e7cab1fa83d876b544f8f841097

6 years agoFix harmless compiler warnings in the CLI.
drh [Thu, 11 Oct 2018 16:53:37 +0000 (16:53 +0000)] 
Fix harmless compiler warnings in the CLI.

FossilOrigin-Name: 1916d2912a4ef5c251853de3c9d66417e20f0c0fc8ddfbc84c131dfd798439f6

6 years agoAlways reset the pager before changing the codec.
drh [Thu, 11 Oct 2018 16:38:56 +0000 (16:38 +0000)] 
Always reset the pager before changing the codec.

FossilOrigin-Name: 0bf0fd242b93c3bd308ab46db1be9edef141b89db07a0f5a4ed8b23c963da0d5

6 years agoOn the first connection to a WAL-mode database that was not cleanly shut down
drh [Thu, 11 Oct 2018 13:51:48 +0000 (13:51 +0000)] 
On the first connection to a WAL-mode database that was not cleanly shut down
and contains a left-over -shm file, truncate the -shm file to 3 bytes instead
of to 0 bytes. Avoiding a truncation to 0 means that system monitoring tools
can better detect if a process illegitimately tries to truncate a -shm file.
Such a rogue process might think it is being helpful by cleaning up old files,
but there is a race condition that can cause damage to the database.

FossilOrigin-Name: 90cf32cde072a305f30c75a71665d1f9e23e805c0a49f5306f015c056dd70f0c

6 years agoIn the CLI, fix a file descriptor leak following OOM and a missing va_end()
drh [Thu, 11 Oct 2018 10:37:24 +0000 (10:37 +0000)] 
In the CLI, fix a file descriptor leak following OOM and a missing va_end()
call.

FossilOrigin-Name: ec36d15a9e349f4295a9e2215dea0a18e9276e0e4ce2d05021e6b467ab7763bb

6 years agoIn the unix VFS, fix the heap shm allocator (used for unix-excl)
drh [Thu, 11 Oct 2018 02:39:11 +0000 (02:39 +0000)] 
In the unix VFS, fix the heap shm allocator (used for unix-excl)
so that it works even on systems where the page size is larger than 32KB.

FossilOrigin-Name: 7fbb083c5cf0948af3624b7538ffa086f77de27a3e84a7039ae7d6574f1a3a54

6 years agoIn the CLI, allow the SQLITE_HISTORY environment variable, if it exists,
drh [Wed, 10 Oct 2018 18:56:40 +0000 (18:56 +0000)] 
In the CLI, allow the SQLITE_HISTORY environment variable, if it exists,
to specify an alternative file in which to store the shell edit history.

FossilOrigin-Name: 696e82f7c82d1720756078e73f3b15b4cafc202ec290e66f9095a3246c65a3cb

6 years agoFix an issue with the new memstat.c extension.
drh [Mon, 8 Oct 2018 20:04:16 +0000 (20:04 +0000)] 
Fix an issue with the new memstat.c extension.

FossilOrigin-Name: ce6e80b1303ed161bec2c63735cd2e2bea7b4e9b4ff780d214d408b1a30d50da

6 years agoReplace the new geopoly_reverse() function with geopoly_ccw(). The
drh [Mon, 8 Oct 2018 18:55:56 +0000 (18:55 +0000)] 
Replace the new geopoly_reverse() function with geopoly_ccw().  The
geopoly_ccw() function only reverses the vertex order if doing so is necessary
to get the correct right-hand winding rule on the polygon.

FossilOrigin-Name: 075066944b13b18d339ccf87ae16f0b91bf00f40bd70f71c6beba6aa6c43f0b6

6 years agoAdd the geopoly_reverse() function to the GeoPoly extension.
drh [Mon, 8 Oct 2018 12:58:59 +0000 (12:58 +0000)] 
Add the geopoly_reverse() function to the GeoPoly extension.

FossilOrigin-Name: 690dd18a5768c5a8cdfa92d5b01901c1a7b1fb6ebb90399f56a3112e41609f92

6 years agoFix the ".help -all" option in the command-line shell.
drh [Sat, 6 Oct 2018 14:38:17 +0000 (14:38 +0000)] 
Fix the ".help -all" option in the command-line shell.

FossilOrigin-Name: aac8f1dff0728c629b5cbf30369ee91c5862a707ede694dc2628d1d4f5a6c202

6 years agoAdd test cases and assert() statements to ensure that the authorizer is being
dan [Sat, 6 Oct 2018 13:46:22 +0000 (13:46 +0000)] 
Add test cases and assert() statements to ensure that the authorizer is being
called as expected from within ALTER TABLE.

FossilOrigin-Name: ff10d2c7de430c88167b1e6e4f5307eee5d69e22c8d24b2ef4fcb3aea25a92e1

6 years agoChanges to geopoly to silience false-positive warnings coming out of clang.
drh [Fri, 5 Oct 2018 15:10:00 +0000 (15:10 +0000)] 
Changes to geopoly to silience false-positive warnings coming out of clang.

FossilOrigin-Name: 11d9015f31d1ea2fd27174d4ceea08a145fdbb92a175bec0aae4b90f991694bc

6 years agoAdd an ALWAYS on an unreachable branch in the ALTER TABLE logic.
drh [Wed, 3 Oct 2018 18:05:36 +0000 (18:05 +0000)] 
Add an ALWAYS on an unreachable branch in the ALTER TABLE logic.

FossilOrigin-Name: ebcd4523171f0988ff08e2bf36fb8a0caa40efe7ac7556b4eb206784969b03e4

6 years agoChange a type in shell.c.in from "int" to "sqlite3_int64" in order to
dan [Wed, 3 Oct 2018 11:13:30 +0000 (11:13 +0000)] 
Change a type in shell.c.in from "int" to "sqlite3_int64" in order to
avoid a compiler warning and possible integer overflow.

FossilOrigin-Name: bf0a6634cd8f9457992b8da522a6775a304156815bf6f4f64f96016356baa870

6 years agoAdd an additional assert() verifying mutex invariants on the
drh [Tue, 2 Oct 2018 20:16:41 +0000 (20:16 +0000)] 
Add an additional assert() verifying mutex invariants on the
unixShmSystemLock() routine in the unix VFS.

FossilOrigin-Name: cb1511065d5348c5b3015dc9d690fc5d519a14ffdfa7164bb552a4fa686ad142

6 years agoAdditional field name changes and commit fixes associated with shared-memory
drh [Tue, 2 Oct 2018 19:58:08 +0000 (19:58 +0000)] 
Additional field name changes and commit fixes associated with shared-memory
locking in the unix VFS, to improve maintainability.  No logic changes.

FossilOrigin-Name: 9280774a4bbc665d70f346d258768cbcca3e0e77791473aecfd7d0e87810ab31

6 years agoFix comments and refactor some names associated with shared-memory locking
drh [Tue, 2 Oct 2018 19:36:40 +0000 (19:36 +0000)] 
Fix comments and refactor some names associated with shared-memory locking
in the Unix VFS.  No logical changes.

FossilOrigin-Name: 3e9f1635271c92dce5324728b4ee1cc1a1856ec3c60b1b512a652c21e010e63e

6 years agoAdd the "PRAGMA table_xinfo" command that works like table_info but also
drh [Mon, 1 Oct 2018 21:41:15 +0000 (21:41 +0000)] 
Add the "PRAGMA table_xinfo" command that works like table_info but also
shows hidden columns in virtual tables and adds the "hidden" boolean column.

FossilOrigin-Name: defa0515b8fd50ed9be699542f8c6695dd4a60c02f310665db6657ec5b6b67d0

6 years agoTest case for PRAGMA table_xinfo. pragma-table-vinfo
drh [Mon, 1 Oct 2018 21:36:38 +0000 (21:36 +0000)] 
Test case for PRAGMA table_xinfo.

FossilOrigin-Name: 7694b9bc3003db6ba0b41c5029c8f7b84c07724e7a518e835e98b3c46e4ea227

6 years agoChange the name of the pragma to PRAGMA table_xinfo. Improve the
drh [Mon, 1 Oct 2018 21:26:30 +0000 (21:26 +0000)] 
Change the name of the pragma to PRAGMA table_xinfo.  Improve the
mkpragmatab.tcl script to reuse column names where appropriate.

FossilOrigin-Name: 2fdd068987e59b979045d71ae64e700600ef07e54ae340f30c2064e5dcccb8ea

6 years agoAdd the extra "hidden" column to the end of the PRAGMA table_vinfo output.
drh [Mon, 1 Oct 2018 18:28:42 +0000 (18:28 +0000)] 
Add the extra "hidden" column to the end of the PRAGMA table_vinfo output.

FossilOrigin-Name: cf1b76135f511530dcc7b82f78c952bf97ebcddb40be06f713f9f2326915fabe

6 years agoSpeed up xAccess() calls made on an RBU VFS when there are lots of open
dan [Mon, 1 Oct 2018 17:33:35 +0000 (17:33 +0000)] 
Speed up xAccess() calls made on an RBU VFS when there are lots of open
connections.

FossilOrigin-Name: 310b4b65b8c8ee080760c7efb4c7e20244c6063a5dba37a4f40490105aafd29f

6 years agoBring the PRAGMA table_vinfo statement up to date with trunk.
drh [Mon, 1 Oct 2018 17:15:17 +0000 (17:15 +0000)] 
Bring the PRAGMA table_vinfo statement up to date with trunk.

FossilOrigin-Name: 6f606f99231f88ae5ff719d0ce21afc4b844490102c27ac20aa606baaf78d8d6

6 years agoFix a potential crash that can occur while reading an index from a corrupt
drh [Mon, 1 Oct 2018 13:54:30 +0000 (13:54 +0000)] 
Fix a potential crash that can occur while reading an index from a corrupt
database file.  The corruption is a record-header-size that is larger than
0x7fffffff.  Problem detected by OSSFuzz against GDAL and reported to us
(with a suggested fix) by Even Rouault.  The test case is in TH3.

FossilOrigin-Name: 8ac2cdda68f92b0352bc7f0b4be5fca4bb58565ca65055fb34153cc284ed6922

6 years agoFix a problem with ALTER TABLE commands when the schema features an INSTEAD of
dan [Mon, 1 Oct 2018 07:04:12 +0000 (07:04 +0000)] 
Fix a problem with ALTER TABLE commands when the schema features an INSTEAD of
trigger that uses NEW.* or OLD.*.

FossilOrigin-Name: c52f457e56eb9d573eb67093731eb231aaf6fd6dbdc397e6f948b82736fbe3ab

6 years agoAdd the PRAGMA table_vinfo command (with an extra "v" before "info") that
drh [Sat, 29 Sep 2018 19:38:42 +0000 (19:38 +0000)] 
Add the PRAGMA table_vinfo command (with an extra "v" before "info") that
works like PRAGMA table_info (without the "v") except that it also shows
hidden columns on virtual tables.

FossilOrigin-Name: 8bcd1a59560aa7ea73e6529e5c14ece8ac09bf7e99efdcfd388fead39846b6bf

6 years agoFix test cases so that they work with ICU.
drh [Fri, 28 Sep 2018 23:53:24 +0000 (23:53 +0000)] 
Fix test cases so that they work with ICU.

FossilOrigin-Name: d04b2013b5436430ebbf7053d637fd89c1b15affcb42787dcf1cf5ffc3ae54e2

6 years agoHave sqlite3changegroup_output_strm() call its output function more regularly.
dan [Fri, 28 Sep 2018 20:46:41 +0000 (20:46 +0000)] 
Have sqlite3changegroup_output_strm() call its output function more regularly.

FossilOrigin-Name: 8467c31aa0bf24e597f680748460a99f425c49f5ab741c3574c339aa56857146

6 years agoFix a bug in the sqlite_memstat virtual table that was causing it to report
drh [Fri, 28 Sep 2018 18:51:18 +0000 (18:51 +0000)] 
Fix a bug in the sqlite_memstat virtual table that was causing it to report
the amount of memory used as zero bytes.

FossilOrigin-Name: 8a758a872175b0c74e631c231240c5c733fbec708d0cff23eb9c4025e4a800ec

6 years agoAdd the geopoly_regular(X,Y,R,N) function to the geopoly extension.
drh [Fri, 28 Sep 2018 14:01:17 +0000 (14:01 +0000)] 
Add the geopoly_regular(X,Y,R,N) function to the geopoly extension.

FossilOrigin-Name: 4505bbae58357eacab262b642b2a56d6dd380de72faceb5bbfd042eb94a12c06

6 years agoMake most geopoly functions pure.
drh [Fri, 28 Sep 2018 13:18:24 +0000 (13:18 +0000)] 
Make most geopoly functions pure.

FossilOrigin-Name: 944e167a98e995c5750c1fcd44df857d6b10c1cbb91731fad2849415c42b2cfc

6 years agoRig geopoly to use sqlite3AtoF() if it is available, as that routine is much
drh [Fri, 28 Sep 2018 00:16:57 +0000 (00:16 +0000)] 
Rig geopoly to use sqlite3AtoF() if it is available, as that routine is much
faster than atof().

FossilOrigin-Name: 470c6c07d0eb70806ac257c1c8ad877e041bbc14ff9a5c490edb51b2956ae726

6 years agoSmall performance optimization in the JSON parser of Geopoly.
drh [Thu, 27 Sep 2018 23:57:45 +0000 (23:57 +0000)] 
Small performance optimization in the JSON parser of Geopoly.

FossilOrigin-Name: fb520e71035258d5490be33ee28575df2caefa5d5a301c8bbdf1471551c96282

6 years agoEnhance the GeoPOLY extension so that it always stores its polygons in the
drh [Thu, 27 Sep 2018 20:37:52 +0000 (20:37 +0000)] 
Enhance the GeoPOLY extension so that it always stores its polygons in the
binary format, which is faster and more compact.

FossilOrigin-Name: dc35f7b1754a78fa0d70c92754de07bb3c28d0d31cb929ee8a3a47ac4f3d446e

6 years agoEnsure that the OP_VColumn opcode does set sqlite3_vtab_nochange() unless
drh [Thu, 27 Sep 2018 20:20:01 +0000 (20:20 +0000)] 
Ensure that the OP_VColumn opcode does set sqlite3_vtab_nochange() unless
the OPFLAG_NOCHNG bit is set in P5.  Fix for ticket
[69d642332d25aa3b7315a6d385]

FossilOrigin-Name: 322ab1fc613f616e9f07dc94ef74a29572a21cc476d88e97b4ce865500a47b62

6 years agoAnother minor tweak to memstat.c so that it may be built against older versions
dan [Thu, 27 Sep 2018 17:33:06 +0000 (17:33 +0000)] 
Another minor tweak to memstat.c so that it may be built against older versions
of SQLite.

FossilOrigin-Name: 4c1fed60b9b35ac2f5d2f2533b54db429d72bdbc0aad0dd5af52ff851789d4ae

6 years agoModify the memstat virtual table so that it works with SQLite version 3.9.2.
drh [Thu, 27 Sep 2018 17:15:21 +0000 (17:15 +0000)] 
Modify the memstat virtual table so that it works with SQLite version 3.9.2.

FossilOrigin-Name: 7171d8ae6b1e7c97b0cf06bcca2262674c9ce557c85666b4b77c16cbac508502

6 years agoAdd the sqlite_memstat extension - an eponymous virtual table that shows
drh [Thu, 27 Sep 2018 17:03:03 +0000 (17:03 +0000)] 
Add the sqlite_memstat extension - an eponymous virtual table that shows
memory usages statistics for SQLite.

FossilOrigin-Name: 954ef61f6a02532e72c815208ec839310f1e00d69e0003cc6f5426f0559229d1

6 years agoEnhancements to sqlite_memstat: memstat-vtab
drh [Thu, 27 Sep 2018 16:57:42 +0000 (16:57 +0000)] 
Enhancements to sqlite_memstat:
(1) Add an extra "schema" column to show the schema name for ZIPVFS stats.
(2) Only show ZIPVFS stats to schema that use ZIPVFS
(3) Put a NULL in unused columns of the output.

FossilOrigin-Name: 9351135b4331107be2f2bda7b6adbd5436381f4f9a68340e8a172b6517ec3f12

6 years agoAdd initial ZIPVFS support for the "main" database to the sqlite_memstat
drh [Thu, 27 Sep 2018 15:45:03 +0000 (15:45 +0000)] 
Add initial ZIPVFS support for the "main" database to the sqlite_memstat
virtual table.

FossilOrigin-Name: 9cd27350b0f62debfe3238c57c3ab51079699142e82c05a7ec8460a8429f55f2

6 years agoInitial prototype of a eponymous virtual table that accesses sqlite3_status64()
drh [Thu, 27 Sep 2018 15:21:13 +0000 (15:21 +0000)] 
Initial prototype of a eponymous virtual table that accesses sqlite3_status64()
and sqlite3_db_status().

FossilOrigin-Name: 0b44e1f68e0c8349367e3f929d4734c3df96338ec8d6fb652565bf894e8b8343

6 years agoDisallow the use of window functions in the recursive part of a recursive CTE.
dan [Thu, 27 Sep 2018 12:14:15 +0000 (12:14 +0000)] 
Disallow the use of window functions in the recursive part of a recursive CTE.

FossilOrigin-Name: 7fc2994434c7d9ed29c96a69c07e8eb4e97be776473c170c63f9a1bbaa09fa68

6 years agoMinor simplification: In OP_ParseSchema, read the p1 register once.
mistachkin [Thu, 27 Sep 2018 00:04:31 +0000 (00:04 +0000)] 
Minor simplification: In OP_ParseSchema, read the p1 register once.

FossilOrigin-Name: bd250533a06e4a11c1f548c3de66b8562fc627383848570d7d030cf132fd336f