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).
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.
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.
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().
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.
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].
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].
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].
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.
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.
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.
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.
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.
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.
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].
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.
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.
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.
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.
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.
Ensure that the OP_VColumn opcode does set sqlite3_vtab_nochange() unless
the OPFLAG_NOCHNG bit is set in P5. Fix for ticket
[69d642332d25aa3b7315a6d385]
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.