Commit Graph

19777 Commits

Author SHA1 Message Date
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
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
drh
147ad061f6 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
2018-11-02 17:38:39 +00:00
drh
7301e77402 Deploy the sqlite3Strlen30NN() function (argument guaranteed to be non-NULL) for
a small performance improvement.

FossilOrigin-Name: 4a6ad5190b62020d97a7de02c801544f20b7b98145ceff14af1f2834d3057f9c
2018-10-31 20:52:00 +00:00
drh
a60c63013e 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
2018-10-31 19:01:13 +00:00
drh
f8181eaa20 Tweaks to the test_intarray documentation and tests.
FossilOrigin-Name: 7107f0dacf4467430d1ca157cb848dde984e48e529e7d67a88b7594b0f8159c9
2018-10-31 18:24:29 +00:00
drh
05209e9021 Merge fuzz test cases computed by dbfuzz2.
FossilOrigin-Name: e0d30c1862884049098e1fa9b7c228ff8318a40c09e2516ef2dc8db22e2048e2
2018-10-31 01:12:06 +00:00
drh
49272bc728 Improved corrupt database detection in the relocatePage() routine of
the b-tree module.

FossilOrigin-Name: d57873337a2a7a0d717dc7726cd2682b5bea594d2d1ff8f16c2485161fcd6b16
2018-10-31 01:04:18 +00:00
drh
c985c2822c Add new fuzzer cases generated by dbfuzz2.
FossilOrigin-Name: 79fdad8b42869100845eed36224602452486d0166c18cec7d343040fdac7379e
2018-10-30 23:45:18 +00:00
dan
b74cf4b6ea Update comments in sqlite3session.c to describe the format of "rebase blobs",
as well as changesets and patchsets.

FossilOrigin-Name: bf93f7b56b1d15682988daf3f1c293caf755433defdecd52ba8782fc40e92bd7
2018-10-30 19:14:16 +00:00
drh
fd748c6460 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
2018-10-30 16:25:35 +00:00
drh
a751f39c3f 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
2018-10-30 15:31:22 +00:00
drh
ad9bfa5e07 Improvements to the -fsanitize=fuzzer based database file fuzzer.
(Cherrypick from the rubust-against-damaged-db branch.)

FossilOrigin-Name: 3cc01a0eaf54e3d5adf206825cfcab15edf73bd5aea10dfc497efd78071a17d0
2018-10-30 15:20:35 +00:00
drh
2b3c4af553 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
2018-10-30 14:36:21 +00:00
drh
60f34ae091 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
2018-10-30 13:19:49 +00:00
drh
f4452cfbed Fix a potential assertion fault that can occur while trying to DROP a table
from a corrupted database file.

FossilOrigin-Name: 147a9429a558cf34c316ab8f87832e97caff55d92df696ab6fd045466c8c663d
2018-10-29 21:01:28 +00:00
drh
5aa20378f7 Fix minor memory leak in the dbstat extension that can occur following an
attempt to analyze a corrupt database file.

FossilOrigin-Name: cb874fd87384be397008e953242d5773ef5d64e07c3e1ae352a42a25d70597b4
2018-10-29 18:33:42 +00:00
mistachkin
8bee11a41e Add the sqlite3_normalized_sql() API.
FossilOrigin-Name: 592b66e8058dd03a056a036e2606247c9efdb06d15eebe9bcc455f7f55e30ae6
2018-10-29 17:53:23 +00:00
dan
dbe7d37ae8 In the sessions module, avoid collecting rebase data if the user has not
requested it.

FossilOrigin-Name: de72a773dd3ad58a7f2233e1fc06bf60deb8892a2719ea8e9b42e7d592c1279f
2018-10-29 17:08:27 +00:00
drh
f888158c7f Harden the dbstat extension against corrupt database files.
FossilOrigin-Name: a0d47f25ae7bdf98f5b853f23776b3bf86bea7c0dda386664c1e3b1c363c518f
2018-10-29 16:07:10 +00:00
drh
d811d844cd Improvements to the dbfuzz2.c test module.
FossilOrigin-Name: d60eff493b875366981c5a25000bb65cde9f6e628192914910790acc562c17b9
2018-10-27 21:06:44 +00:00
drh
977e5dcd07 Add an entry in Makefile.in to build dbfuzz2 using clang-6.0 with
-fsanitize=fuzzer,undefined.

FossilOrigin-Name: a4a083ed8cdb106af661d2ee0203e21c576f5c2304419ce603826e4f2851c2e0
2018-10-27 16:02:16 +00:00
drh
65da285e6a Initial code for a fuzzing tool on database file that works with the
-fsanitize=fuzzer option of clang.

FossilOrigin-Name: 90d12094d36957fbded71545add8a5dc206798fdacc17d4d161d715569a7f991
2018-10-27 00:47:33 +00:00
dan
1f48e67db1 Add the sqlite3session_config() interface. For configuring global parameters
belonging to the sessions module.

FossilOrigin-Name: 1e69f3ff057b0be27a9e79842de2485f8299799f309e89bfa7597dd688e0975b
2018-10-26 17:05:00 +00:00
dan
f689400dc7 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
2018-10-26 15:36:53 +00:00
drh
8e5bfedd22 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
2018-10-25 14:15:37 +00:00
drh
e23d05e807 Add the ENABLE_GEOPOLY case to the compile_options pragma.
FossilOrigin-Name: de940296d227c96db4d0cf913fc5c0e5138729eda7cda0a0ac6b704cce1e1e1e
2018-10-24 23:55:41 +00:00
dan
0f5f54062c Fix a problem with using window functions in compound (UNION, INTERSECT etc.)
queries.

FossilOrigin-Name: 059ff53a46c7f1e4bf3e7dc558312beef67826c2753e2ab7e4e7df498b37b617
2018-10-23 13:48:19 +00:00
dan
46de072880 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
2018-10-20 13:48:09 +00:00
dan
9c18ef09a5 Take steps to avoid a potential integer overflow in sessionBufferGrow().
FossilOrigin-Name: f7affa2e708d1b4c7c47157bcb18e9f79611ca45a93ebc88de6dc96f84a677e7
2018-10-18 15:17:18 +00:00
dan
44748f27a6 Add the SQLITE_CHANGESETAPPLY_INVERT flag to sessions. For inverting and applying a changeset in a single step.
FossilOrigin-Name: d4b6406e7f5ba06ac73ab9fdef57232b2459e0af12420ed946ebed6aef46f0b1
2018-10-18 14:59:21 +00:00
drh
bafad06139 Test case modifications to support SEE.
FossilOrigin-Name: 02b6f8f2778c371130c512e980c3db07c7e76dcf7dd92a878b86e4b6a47ca307
2018-10-12 15:01:56 +00:00
drh
fa5c62ef2e Add the textkey and textrekey pragmas.
FossilOrigin-Name: f03164d45450cd7ff2162999aa9e51eec7fb5e7cab1fa83d876b544f8f841097
2018-10-11 18:41:50 +00:00
drh
e93f82658a Fix harmless compiler warnings in the CLI.
FossilOrigin-Name: 1916d2912a4ef5c251853de3c9d66417e20f0c0fc8ddfbc84c131dfd798439f6
2018-10-11 16:53:37 +00:00
drh
53f5f00762 Always reset the pager before changing the codec.
FossilOrigin-Name: 0bf0fd242b93c3bd308ab46db1be9edef141b89db07a0f5a4ed8b23c963da0d5
2018-10-11 16:38:56 +00:00
drh
f7f2a82aa0 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
2018-10-11 13:51:48 +00:00
drh
1dbb147598 In the CLI, fix a file descriptor leak following OOM and a missing va_end()
call.

FossilOrigin-Name: ec36d15a9e349f4295a9e2215dea0a18e9276e0e4ce2d05021e6b467ab7763bb
2018-10-11 10:37:24 +00:00
drh
b6c4d59e89 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
2018-10-11 02:39:11 +00:00
drh
a9e4be3b08 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
2018-10-10 18:56:40 +00:00
drh
7dd630a893 Fix an issue with the new memstat.c extension.
FossilOrigin-Name: ce6e80b1303ed161bec2c63735cd2e2bea7b4e9b4ff780d214d408b1a30d50da
2018-10-08 20:04:16 +00:00
drh
5f8cb730af 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
2018-10-08 18:55:56 +00:00
drh
bc36320f02 Add the geopoly_reverse() function to the GeoPoly extension.
FossilOrigin-Name: 690dd18a5768c5a8cdfa92d5b01901c1a7b1fb6ebb90399f56a3112e41609f92
2018-10-08 12:58:59 +00:00
drh
488cddfa86 Fix the ".help -all" option in the command-line shell.
FossilOrigin-Name: aac8f1dff0728c629b5cbf30369ee91c5862a707ede694dc2628d1d4f5a6c202
2018-10-06 14:38:17 +00:00