]> git.ipfire.org Git - thirdparty/sqlite.git/log
thirdparty/sqlite.git
3 years agoImproved error messages for the SQLITE_CONSTRAINT_DATATYPE error. strict-tables
drh [Fri, 20 Aug 2021 08:05:42 +0000 (08:05 +0000)] 
Improved error messages for the SQLITE_CONSTRAINT_DATATYPE error.

FossilOrigin-Name: 39abca01479c0f4f747b7b21fa05181896b00ed7559f0ab74aa575c23097ac21

3 years agoDo not allow the xfer-optimization to move the content of an ordinary
drh [Fri, 20 Aug 2021 01:12:39 +0000 (01:12 +0000)] 
Do not allow the xfer-optimization to move the content of an ordinary
table into a strict table.

FossilOrigin-Name: 1ed1b594d3c03ced68eb2b1285dfd8b9641cda20db1b1b7ae1afee217a3a9fe2

3 years agoImproved comments. Fewer opcodes for integrity_check on strict tables.
drh [Thu, 19 Aug 2021 16:29:33 +0000 (16:29 +0000)] 
Improved comments.  Fewer opcodes for integrity_check on strict tables.

FossilOrigin-Name: 4ee57fb588b41ab76649c605f57c7bcf5b7b638435af458d69f69a8ccbb121e8

3 years agoEnhance PRAGMA integrity_check so that it verifies the datatype of
drh [Thu, 19 Aug 2021 02:58:15 +0000 (02:58 +0000)] 
Enhance PRAGMA integrity_check so that it verifies the datatype of
all columns in STRICT tables.

FossilOrigin-Name: 97c9248b3b81facce569bfa3fb405d44a1d1041e87132e8f649458c95620ccb2

3 years agoSTRICT tables require all fields of the PRIMARY KEY to be NOT NULL.
drh [Thu, 19 Aug 2021 00:24:43 +0000 (00:24 +0000)] 
STRICT tables require all fields of the PRIMARY KEY to be NOT NULL.

FossilOrigin-Name: 5efdf9acad9d54783f5134b7e9338f44336862d87dc324d315b8d55e44df1923

3 years agoMerge the WITHOUT ROWID, NOT NULL ON CONFLICT bug fix into the strict-tables
drh [Wed, 18 Aug 2021 23:00:43 +0000 (23:00 +0000)] 
Merge the WITHOUT ROWID, NOT NULL ON CONFLICT bug fix into the strict-tables
branch.

FossilOrigin-Name: 7ee01ee47da247a80bcf16f88eb187b8c0928024536435ed20797a1a90495511

3 years agoFix ON CONFLICT clause processing for NOT NULL constraints of PRIMARY KEY
drh [Wed, 18 Aug 2021 22:26:51 +0000 (22:26 +0000)] 
Fix ON CONFLICT clause processing for NOT NULL constraints of PRIMARY KEY
columns on WITHOUT ROWID tables.
Ticket [f2be158c57aaa8c6]

FossilOrigin-Name: 13abba0941a724eb62455650976b03678e4455b6b3090c84a2ab2f4a7656b4d8

3 years agoTrying to insert an incorrect datatype into a STRICT table raises an
drh [Wed, 18 Aug 2021 19:22:27 +0000 (19:22 +0000)] 
Trying to insert an incorrect datatype into a STRICT table raises an
SQLITE_CONSTRAINT_DATATYPE error.  Seems to work, though lots more testing
is needed.

FossilOrigin-Name: a19305e5cfedf5c472200d6e05c1396443e348f052a40a0979f860f2ff06851d

3 years agoWhat would it be like if you could add the keyword "STRICT" after a CREATE
drh [Wed, 18 Aug 2021 13:13:58 +0000 (13:13 +0000)] 
What would it be like if you could add the keyword "STRICT" after a CREATE
TABLE statement to cause the table to (1) allow only a few well-defined
datatypes, (2) rigidly enforce those types, (3) require NOT NULL on PK
columns, (4) always enforce foreign key constraint, and so forth?  This
branch seeks to explore that question.

FossilOrigin-Name: 78732b9f98936693ae29c85a692c35a84c7d065aec79903af34b08d18f10a5e6

3 years agoRename the Column.eType field to Column.eCType - with an extra "C".
drh [Wed, 18 Aug 2021 12:05:22 +0000 (12:05 +0000)] 
Rename the Column.eType field to Column.eCType - with an extra "C".

FossilOrigin-Name: b9b0dcd5af072c22f2ce71cf9584b5b572fbcfbce6410a7d703b586adb8938ba

3 years agoFix an off-by-one error in the error-handling logic of the Lemon
drh [Tue, 17 Aug 2021 19:59:09 +0000 (19:59 +0000)] 
Fix an off-by-one error in the error-handling logic of the Lemon
parser-generator.  This does not affect SQLite.
[forum:/forumpost/cff80737bf|Forum cff80737bf].

FossilOrigin-Name: 7cca80808cef192fe0479477056a028e230a164fd368e72100def065d424ca2c

3 years agoBy default, do not use memory mapping to access the temporary files used for external...
dan [Thu, 12 Aug 2021 14:22:30 +0000 (14:22 +0000)] 
By default, do not use memory mapping to access the temporary files used for external sorts. The old behaviour (to use memory mapping by default) may be restored by building with SQLITE_ENABLE_SORTER_MMAP defined.

FossilOrigin-Name: 306694dfb462f9d1f128461e7a8f15a0bb9b21fbc696caa1832f4b20749490d1

3 years agoDuring DELETE, if an index entry is missing, do not raise the
drh [Wed, 11 Aug 2021 18:43:54 +0000 (18:43 +0000)] 
During DELETE, if an index entry is missing, do not raise the
SQLITE_CORRUPT_INDEX error (added by [f339f31f9e9a856b]) if in
"PRAGMA writable_schema=ON" mode.

FossilOrigin-Name: 19e56291a7344c7aa69e2845f11cb865ee10a6b89a00bbe74b3babbeebe0357b

3 years agoDo not apply the push-down optimization to CTE subqueries that will be
drh [Wed, 11 Aug 2021 13:48:56 +0000 (13:48 +0000)] 
Do not apply the push-down optimization to CTE subqueries that will be
reused in other contexts in where the same optimization is unlikely to
be valid.  Fix for the bug reported by
[forum:/forumpost/d496c3d29bc93736|forum post d496c3d29bc93736].

FossilOrigin-Name: a7ce29a6ef2e0362bbc9b23719d936dce07209b2651153c774682f599bbd888e

3 years agoImproved comment on the OP_OpenDup used to get a new cursor for a
drh [Wed, 11 Aug 2021 13:19:13 +0000 (13:19 +0000)] 
Improved comment on the OP_OpenDup used to get a new cursor for a
reused materialized CTE.

FossilOrigin-Name: b1926cc0ab2b81c7df30c4baa6014efcfddb9631f6e46a55c1cec0113ee1afdc

3 years agoFix a compiler warning in pcache1. Reduce the maximum size of a pcache1
drh [Mon, 9 Aug 2021 19:54:27 +0000 (19:54 +0000)] 
Fix a compiler warning in pcache1.  Reduce the maximum size of a pcache1
cache to 2147418112 pages.

FossilOrigin-Name: 4bc93658aa563f2fa84f7f85f7f9f336dc80425640140c0fc2aec4a3606fad48

3 years agoFurther improvements to the eOpenState bit values.
mistachkin [Mon, 9 Aug 2021 18:13:38 +0000 (18:13 +0000)] 
Further improvements to the eOpenState bit values.

FossilOrigin-Name: d44f74f14a387960ce105913526b572f4a3d1935351c6aab10cee85946488a9e

3 years agoEnsure that the pcache1 cache size does not get so big that it overflows
drh [Mon, 9 Aug 2021 18:07:06 +0000 (18:07 +0000)] 
Ensure that the pcache1 cache size does not get so big that it overflows
the integer that is keeping track of the cache size.

FossilOrigin-Name: bf9d70fc2fde06a3f132270a26d4abe321687169066aff26ad9e92757c7f9ee4

3 years agoFix harmless compiler warnings and improve the presentation for the new
drh [Mon, 9 Aug 2021 17:45:00 +0000 (17:45 +0000)] 
Fix harmless compiler warnings and improve the presentation for the new
--threadsafe option to the CLI.

FossilOrigin-Name: 7929dc2f6f304b077c174d41711b49a24120adeb0b29cb6acb4d6a40852d7e00

3 years agoUndocumented "--threadsafe N" option added to the CLI for testing purposes.
drh [Mon, 9 Aug 2021 17:37:58 +0000 (17:37 +0000)] 
Undocumented "--threadsafe N" option added to the CLI for testing purposes.
One of SQLITE_CONFIG_SINGLETHREAD, _MULTITHREAD, or _SERIALIZED is called
depending on the value of the N integer.

FossilOrigin-Name: 2d8f297c115f378854c1f2198e47ac5af5f222a5de8cc7575c42154094e71b53

3 years agoImproved Hamming bit-distance between the SQLITE_STATE constants.
drh [Mon, 9 Aug 2021 17:36:22 +0000 (17:36 +0000)] 
Improved Hamming bit-distance between the SQLITE_STATE constants.

FossilOrigin-Name: 5100b0456bc91f11e4a0bcf0d426ae4d8328cd9341ee2f9c83d0fa9f73047a83

3 years agoFix comments associated with sqlite3.eOpenState. No logic changes.
drh [Mon, 9 Aug 2021 13:06:59 +0000 (13:06 +0000)] 
Fix comments associated with sqlite3.eOpenState.  No logic changes.

FossilOrigin-Name: fd8f498f5d5f7fcb78dd8f6f9323d20b9e2904b249ec735477a0f03cb47b8561

3 years agoRefactor sqlite3.magic into sqlite3.eOpenState.
drh [Sat, 7 Aug 2021 23:16:52 +0000 (23:16 +0000)] 
Refactor sqlite3.magic into sqlite3.eOpenState.

FossilOrigin-Name: e5d6512aa1fa0016a679c6e0cb665a0c67ad16f1daa0c18a96b2ebae1beefd15

3 years agoFix an RBU problem with restarting an update after the *-oal file is already larger...
dan [Fri, 6 Aug 2021 20:17:39 +0000 (20:17 +0000)] 
Fix an RBU problem with restarting an update after the *-oal file is already larger than 4GiB.

FossilOrigin-Name: 087b8b41c6ed76b55c11315e7e95679d67590be20ae21108b593d00bb7d1c57a

3 years agoAttempt to fix the showwal.c utility program so that it works on WAL files
drh [Fri, 6 Aug 2021 19:38:23 +0000 (19:38 +0000)] 
Attempt to fix the showwal.c utility program so that it works on WAL files
larger than 4GiB.

FossilOrigin-Name: 5c0f9ea98a2b944857fe05d53a0143cb827b7d8215c37f33f1bce47ec1189952

3 years agoFix harmless compiler warnings. Omit redundant copies of os_common.h and
drh [Fri, 6 Aug 2021 15:26:01 +0000 (15:26 +0000)] 
Fix harmless compiler warnings.  Omit redundant copies of os_common.h and
hwtime.h from the amalgamation.

FossilOrigin-Name: 091427007818537bb2f860c42dad867cb19050899186d4d180d195a1c6a98798

3 years agoStore the collating sequence name for each column of a table as an
drh [Thu, 5 Aug 2021 15:27:19 +0000 (15:27 +0000)] 
Store the collating sequence name for each column of a table as an
extension to the column name, for an additional savings in the heap space
needed to hold the schema.

FossilOrigin-Name: 832ac4c1ee384be0de72a4bdd55ed87e0f8294e7df5eefcf6b4942db3d85a69e

3 years agoAdd NEVER() macros on recently introduced unreachable branches.
drh [Wed, 4 Aug 2021 14:50:23 +0000 (14:50 +0000)] 
Add NEVER() macros on recently introduced unreachable branches.

FossilOrigin-Name: 806939eb5947f9187dc9c4814b26e9f94ec0186596c7be97981dbea7c2169c26

3 years agoAlways prefer built-in SQL functions over app-defined SQL functions within
drh [Wed, 4 Aug 2021 13:42:12 +0000 (13:42 +0000)] 
Always prefer built-in SQL functions over app-defined SQL functions within
sqlite3NestedParse().  Formerly this was the case for a few calls to
sqlite3NestedParse(), but not for all of them.

FossilOrigin-Name: 164662ef01ad45ca570c44631a1117cccce6e34b00dbba7f422c089e8ffaa932

3 years agoAvoid using LIKE with the target db in RBU. It is possible the user may issue "PRAGMA...
dan [Wed, 4 Aug 2021 11:29:18 +0000 (11:29 +0000)] 
Avoid using LIKE with the target db in RBU. It is possible the user may issue "PRAGMA case_sensitive_like = 1" or override the like() user function, causing RBU to malfunction.

FossilOrigin-Name: 7cbd8cd5aa768a0b72f769fa390fae1158d1dcfac5273b9d0238ecf2f52e273d

3 years agoFix the build for SQLITE_ENABLE_UPDATE_DELETE_LIMIT.
drh [Tue, 3 Aug 2021 23:23:23 +0000 (23:23 +0000)] 
Fix the build for SQLITE_ENABLE_UPDATE_DELETE_LIMIT.

FossilOrigin-Name: 5150d2da06ab3c7e3bea1865413cd21c64d5cefb91d3d874e9dd0bf51aea754b

3 years agoImproved harmony with the reuse-schema branch.
drh [Tue, 3 Aug 2021 18:45:41 +0000 (18:45 +0000)] 
Improved harmony with the reuse-schema branch.

FossilOrigin-Name: cbc703f70d16de0e93b276528fc761290f30af770ceb4b4d11d6a6e6506ac67c

3 years agoRefactor field names in the Column object, zCnName and zCnColl, to make them
drh [Mon, 2 Aug 2021 18:03:43 +0000 (18:03 +0000)] 
Refactor field names in the Column object, zCnName and zCnColl, to make them
unique and thus easier to find amid all the other code.

FossilOrigin-Name: 8b781dcaf68e0cf12a844708c82eee00193e340195cbca915d077e4846983bf3

3 years agoRefactor the Table object to reduce its memory footprint.
drh [Mon, 2 Aug 2021 16:41:57 +0000 (16:41 +0000)] 
Refactor the Table object to reduce its memory footprint.

FossilOrigin-Name: bbb6759bcf6e01d36dfc787a82a610d359f50aaeac8104b73883a84906d54e1f

3 years agoRefactor the way that DEFAULT expressions are stored on columns, in order
drh [Sat, 31 Jul 2021 20:30:41 +0000 (20:30 +0000)] 
Refactor the way that DEFAULT expressions are stored on columns, in order
to save memory in the common case where the column has no DEFAULT clause.

FossilOrigin-Name: 8646547e54211d44c415663c33775c4268550f8332949c4731a4bb6ec9cc663a

3 years agoRecognize certain standard datatypes ("INT", "INTEGER", "REAL", "TEXT", and
drh [Fri, 30 Jul 2021 23:30:30 +0000 (23:30 +0000)] 
Recognize certain standard datatypes ("INT", "INTEGER", "REAL", "TEXT", and
"BLOB") and if a column has one of those datatypes, store the type part of
the bit-field information in the Column structure to save space.

FossilOrigin-Name: d2da62a9df63036b02dadca3798de9e623c2680b3ef0c37d2b18bb88693afd7f

3 years agoIf a generated column uses the optional keywords GENERATE ALWAYS, try to avoid
drh [Fri, 30 Jul 2021 20:09:08 +0000 (20:09 +0000)] 
If a generated column uses the optional keywords GENERATE ALWAYS, try to avoid
putting those keywords in the typename of the column.
[forum:/forumpost/ff3ffe09251c105b|Forum post ff3ffe09251c105b]

FossilOrigin-Name: 3c954863f45271a3518acf51fd685a641878811fb5cfcbdbad85154aeccdc902

3 years agoAvoid clownfeet in the names columns when the column names are quoted
drh [Fri, 30 Jul 2021 18:39:59 +0000 (18:39 +0000)] 
Avoid clownfeet in the names columns when the column names are quoted
in the original CREATE TABLE statement.

FossilOrigin-Name: 980f7292afd45a8e73272e2139b55b99ab86167febec9fd0bf0356e8167b2ee9

3 years agoReduce clownfooting in the allocation of the Table.aCol array. This reduces
drh [Fri, 30 Jul 2021 12:47:35 +0000 (12:47 +0000)] 
Reduce clownfooting in the allocation of the Table.aCol array.  This reduces
the amount of heap space required to hold large schemas by about 11%.

FossilOrigin-Name: 2941ded0acbdcf914567bf7451cfd9b770269545c20d3fa7107c40492689afad

3 years agoEnhance the wal.c source file with an ASCII-art schematic of the -shm file
drh [Thu, 29 Jul 2021 18:34:35 +0000 (18:34 +0000)] 
Enhance the wal.c source file with an ASCII-art schematic of the -shm file
header.

FossilOrigin-Name: a6c160e08a61d105f8aab959440ac5ec4f1aaca8f0d393e08e7c2c67815b5bb2

3 years agoImprovements to asserts to enforce magic numbers in the wal-index format.
drh [Thu, 29 Jul 2021 17:31:40 +0000 (17:31 +0000)] 
Improvements to asserts to enforce magic numbers in the wal-index format.
Also improve automatic configure and make builds on legacy PPC iBooks.

FossilOrigin-Name: 87b8d47889f1990442aa90398614656658207085d064381074f72bda9bdcbfa5

3 years agoComplete warning-free build on old PPC iBook. wal-asserts
drh [Thu, 29 Jul 2021 17:23:23 +0000 (17:23 +0000)] 
Complete warning-free build on old PPC iBook.

FossilOrigin-Name: ef2a0850394b1c6c1fc84b26694a3712ae1e50d52bb78fea2ec40148a7d833de

3 years agoFix an error in one of the assert() statements added by [23b08fe9db24a953].
drh [Thu, 29 Jul 2021 17:01:44 +0000 (17:01 +0000)] 
Fix an error in one of the assert() statements added by [23b08fe9db24a953].

FossilOrigin-Name: ad24334bc06dc9ae52825a1873a1eab6c258d77fcc00dec55884ddddecd9932e

3 years agoMinor tweaks to various TCL build scripts so that they work even for TCL 8.4,
drh [Thu, 29 Jul 2021 16:49:28 +0000 (16:49 +0000)] 
Minor tweaks to various TCL build scripts so that they work even for TCL 8.4,
which is obsolete, but is also all that is available for some legacy platforms.

FossilOrigin-Name: 2269ce64f707c4a198fcb9a72933648ea61a80b4251024b8058ff28ad81b4917

3 years agoImprove comments and add new assert() statements in WAL to help document
drh [Thu, 29 Jul 2021 16:48:21 +0000 (16:48 +0000)] 
Improve comments and add new assert() statements in WAL to help document
how everything works.

FossilOrigin-Name: 23b08fe9db24a953cc231b093cf74d140c9965d22964d0401ff8ab3d4ecba443

3 years agoRemove ALWAYS() macros that can be true if the internal test function
drh [Thu, 29 Jul 2021 00:33:20 +0000 (00:33 +0000)] 
Remove ALWAYS() macros that can be true if the internal test function
implies_nonnull_row() is used in the result set of a query and contains
comparison operator against a computed column.
dbsqlfuzz 4c34db5bff6247f33ee49e341a1f3018e72be0a0.

FossilOrigin-Name: 4d1dbfa35c7dc0f09321b2e274a00e506f4ca65322454652d5891d815a6966d3

3 years agoAdd test case to ensure that sessions works with DELETE statements that use the trunc...
dan [Wed, 28 Jul 2021 18:13:28 +0000 (18:13 +0000)] 
Add test case to ensure that sessions works with DELETE statements that use the truncate optimization (i.e. a DELETE without a WHERE clause).

FossilOrigin-Name: a2fc531177c3a061f2881198bb711d502db7cd831351b6a5dd415936845b6625

3 years agoFix a harmless uninitialized variable read that occurs after an error
drh [Wed, 28 Jul 2021 02:04:58 +0000 (02:04 +0000)] 
Fix a harmless uninitialized variable read that occurs after an error
associated with a subquery that uses DISTINCT.  Found by a fuzzer.

FossilOrigin-Name: e9719f975f61c4c9f40ea077b049eed97d0957b925a4b6149d9ee21ce827b6a1

3 years agoReduce the scope of a variable in order to fix a harmless compiler warning
drh [Wed, 28 Jul 2021 01:22:23 +0000 (01:22 +0000)] 
Reduce the scope of a variable in order to fix a harmless compiler warning
that occurs under -DSQLITE_OMIT_AUTOMATIC_INDEX.

FossilOrigin-Name: 36d5dbbe13562f4ea6435e620d102f8515bd0e6b8e66fd1841062a4e4621e330

3 years agoRemove sqldiff --visible-controls option, make it always happen. Add test cases for...
larrybr [Mon, 26 Jul 2021 19:49:01 +0000 (19:49 +0000)] 
Remove sqldiff --visible-controls option, make it always happen. Add test cases for controls made visible

FossilOrigin-Name: ff74c0cc4cefa5271b12ecfff3f2fd4749852d9d1d01f4ae64a07a26decc001b

3 years agoGive sqldiff --visible-controls option to deal with non-graphic text content robustly...
larrybr [Mon, 26 Jul 2021 18:28:24 +0000 (18:28 +0000)] 
Give sqldiff --visible-controls option to deal with non-graphic text content robustly across platforms

FossilOrigin-Name: 68d2373f5d578cf3aff9d1ac4b1ab3ac00b466e94e1eb516523fc7660dfc0549

3 years agoEnhance the CLI with the ".connection" command that can switch between
drh [Fri, 23 Jul 2021 18:43:58 +0000 (18:43 +0000)] 
Enhance the CLI with the ".connection" command that can switch between
up to five different database connections.  Used for manual testing of multiple
database connections in the same process.

FossilOrigin-Name: 54eaf076c05887157179459ab39c2556953f6fef9c1b14f17a8aa74087da3023

3 years agoSet the checkSchema flag if a CREATE TABLE parse fails because the table
drh [Thu, 22 Jul 2021 21:11:06 +0000 (21:11 +0000)] 
Set the checkSchema flag if a CREATE TABLE parse fails because the table
already exists, to ensure that the table was not previously deleted by
some other connection.

FossilOrigin-Name: 91bcb9621529b58d28e91a2763eb9eef3951400d5eaef105073258f3dd331872

3 years agoFix ALTER TABLE DROP COLUMN so that it generates valid bytecode even when
drh [Thu, 22 Jul 2021 18:22:51 +0000 (18:22 +0000)] 
Fix ALTER TABLE DROP COLUMN so that it generates valid bytecode even when
operating on a corrupt database and using PRAGMA writable_schema=ON.
dbsqlfuzz 5f09e7bcc78b4954d06bf9f2400d7715f48d1fef

FossilOrigin-Name: b65f4f763979ee9e0b943c787609ea22d6f7e01d41dfc1e084ec50a085a3550c

3 years agoOne of the optimizations of check-in [de9c86c9e4cdb34f] does not work for
drh [Thu, 22 Jul 2021 16:07:01 +0000 (16:07 +0000)] 
One of the optimizations of check-in [de9c86c9e4cdb34f] does not work for
terms originating in the ON/USING clause, as demonstrated by
[forum:/forumpost/6cf3bb457c3f4685|forum post 6cf3bb457c3f4685].  This
check-in disables that optimization for ON/USING terms.  Also improve the
TreeView display for the resulting "true"/"false" nodes to show that they
originate from the ON/USING clause.  Add a testcase() to the other optimization
to show that it can still be used for ON/USING terms.

FossilOrigin-Name: 1f6796044008e6f3a61bcf390c0c7eb31947e971f0edada74e7a3a211f8ae76a

3 years agoImproved robustness of cursor renumbering in the UNION ALL flattener
drh [Wed, 21 Jul 2021 15:42:05 +0000 (15:42 +0000)] 
Improved robustness of cursor renumbering in the UNION ALL flattener
when operating on vector assignments of an UPDATE FROM.
dbsqlfuzz 417d2b053b9b3c9edaf22dd515564f06999e029c

FossilOrigin-Name: 60695359dc5d3bcba68a68e1842c40f4a01650eb5af408e02fb856fd8245e16d

3 years agoRun a "PRAGMA quick_check", if necessary, on the modified table after
drh [Tue, 20 Jul 2021 16:07:15 +0000 (16:07 +0000)] 
Run a "PRAGMA quick_check", if necessary, on the modified table after
an ALTER TABLE ADD COLUMN to verify that added NOT NULL or CHECK constraints
are satisfied by existing rows.  Abort the ADD COLUMN if not.
[forum:/forumpost/c04814903d6ec4f7|Forum post c04814903d6ec4f7].

FossilOrigin-Name: e3794997c34f03db2a4ac0ca5b76727d0e031778d92b08eaaf9631689ec3e56d

3 years agoAvoid a malfunction that could occur if the same correlated column reference appears...
dan [Tue, 20 Jul 2021 14:57:49 +0000 (14:57 +0000)] 
Avoid a malfunction that could occur if the same correlated column reference appears in both the GROUP BY and the HAVING clause of a sub-select. dbsqlfuzz a779227f721a834df95f4f42d0c31550a1f8b8a2.

FossilOrigin-Name: 1e35cc6d5c2f563c6bb163bb150d7bc6ede4c993efa828af1face3261bf65a2c

3 years agoFix issues in the new ADD COLUMN constraint checking. Add preliminary add-column-constraint-check
drh [Tue, 20 Jul 2021 08:23:54 +0000 (08:23 +0000)] 
Fix issues in the new ADD COLUMN constraint checking.  Add preliminary
test cases.

FossilOrigin-Name: 48434ad3fa9504c063d812d119bc8f622548fd02b3d478ff247b11474c4ce5db

3 years agoDemonstration code to show how NOT NULL and CHECK constraints can be
drh [Tue, 20 Jul 2021 07:35:07 +0000 (07:35 +0000)] 
Demonstration code to show how NOT NULL and CHECK constraints can be
verified after an ALTER TABLE ADD COLUMN.

FossilOrigin-Name: 039f540373b03af9e0c87499e5e0423eb093d1d343829282a5ac1de2d600b881

3 years agoIt does not work to deserialized into TEMP, so do not allow it. The
drh [Tue, 20 Jul 2021 02:02:24 +0000 (02:02 +0000)] 
It does not work to deserialized into TEMP, so do not allow it.  The
sqlite3_deserialize() routine now returns SQLITE_ERROR if you try.

FossilOrigin-Name: 18068cc60698d4944a9d682cdf34b14b4d4b32f043f8d584dbf41c2bb5ac6220

3 years agoFix compilation of 'threadtest3' for some older versions of MSVC.
mistachkin [Tue, 20 Jul 2021 00:18:22 +0000 (00:18 +0000)] 
Fix compilation of 'threadtest3' for some older versions of MSVC.

FossilOrigin-Name: b5ede6a68891820bd5b6d051b1b641bc1cd49104cad2466db184134d14f58f5b

3 years agoMore precision in comparing integers and floating point values while
drh [Mon, 19 Jul 2021 20:52:31 +0000 (20:52 +0000)] 
More precision in comparing integers and floating point values while
processing the integer primary key for OP_SeekGE and similar.
[forum:/forumpost/2bdb86a068|Forum post 2bdb86a068].

FossilOrigin-Name: f9c6426de3b413ff8fcf04a00931ca5f123f996c572b35181af114afa8d811d7

3 years agoUpdates so that "threadtest3[.exe]" can be built for windows with MSVC.
dan [Mon, 19 Jul 2021 16:49:13 +0000 (16:49 +0000)] 
Updates so that "threadtest3[.exe]" can be built for windows with MSVC.

FossilOrigin-Name: 4ce585fb07274284e3add6adcb66ed06e4b109584704d1ec7152bf43ca8d5d85

3 years agoIn defensive mode, allow statements that write to shadow tables to be prepared from...
dan [Mon, 19 Jul 2021 14:00:29 +0000 (14:00 +0000)] 
In defensive mode, allow statements that write to shadow tables to be prepared from with virtual-table xSync() calls.

FossilOrigin-Name: c8601d83fbecf84ca7991d339449b380deb5a7620dc84756a91c2880f030b423

3 years agoFix minor spacing issues in the MSVC makefile.
mistachkin [Mon, 19 Jul 2021 03:38:13 +0000 (03:38 +0000)] 
Fix minor spacing issues in the MSVC makefile.

FossilOrigin-Name: d78c272b3966cc1b12bc7e83fbe909a3c517d553a942d7f1c07bddf69f2e2164

3 years agoTry to omit the ORDER BY clause in subqueries if doing so does not change
drh [Fri, 16 Jul 2021 22:43:00 +0000 (22:43 +0000)] 
Try to omit the ORDER BY clause in subqueries if doing so does not change
the result in any way. See
[forum:/forumpost/2d76f2bcf65d256a|Forum post 2d76f2bcf65d256a] for
details and history.

FossilOrigin-Name: 85ddaf1b59a19cbd9efe7724a163b30c14bafabfaf2cfced07b463e76f73e494

3 years agoMinor comment improvements. omit-subquery-order-by
drh [Fri, 16 Jul 2021 20:16:19 +0000 (20:16 +0000)] 
Minor comment improvements.

FossilOrigin-Name: 6854b5919beefa43da21ba739e82d583183c8cdfe5dd63e27a810ac1ffe2330b

3 years agoDe-typo sqlite3_expanded_sql() doc
larrybr [Fri, 16 Jul 2021 17:11:21 +0000 (17:11 +0000)] 
De-typo sqlite3_expanded_sql() doc

FossilOrigin-Name: 56b0f5418dad34d1e83d53741916e2a38a5448369031d959b8a44867774be657

3 years agoModify the generate_series() table-valued functions so that its first
drh [Fri, 16 Jul 2021 17:04:17 +0000 (17:04 +0000)] 
Modify the generate_series() table-valued functions so that its first
argument (the START value) is required.  Throw an error if that argument
is not supplied.  In this was the series.c loadable extension can be used
as a demonstration of how to code an xBestIndex function to require certain
parameters.  Compile with -DZERO_ARGUMENT_GENERATE_SERIES to obtain the
legacy behavior.

FossilOrigin-Name: 459d85a2898d6a53f43b4ad48d2f39edd1bbe37a4f97426a5d666c39c52576a4

3 years agoFix the "main.mk" makefile so that "series.c" is a dependency of "shell.c".
drh [Fri, 16 Jul 2021 15:30:19 +0000 (15:30 +0000)] 
Fix the "main.mk" makefile so that "series.c" is a dependency of "shell.c".

FossilOrigin-Name: ff959917918495ef352ce48c240b1de6da162f2a5e76e37dcc53fa50bce27642

3 years agoGet the "omit ORDER BY in FROM-clause subqueries" optimization working for the
drh [Fri, 16 Jul 2021 01:19:19 +0000 (01:19 +0000)] 
Get the "omit ORDER BY in FROM-clause subqueries" optimization working for the
core test cases.

FossilOrigin-Name: e31c5888659ffd4c6d8b68627123df3bbb84bb010b7766b0a74877bf3ba1e52b

3 years agoBy default, do not emit #line directives in the amalgamation.
mistachkin [Thu, 15 Jul 2021 23:34:14 +0000 (23:34 +0000)] 
By default, do not emit #line directives in the amalgamation.

FossilOrigin-Name: bacfa93677fbe014737fab7dbdb4e7a168a310bc5b914b17896ae2a48435c7b1

3 years agoAttempt to omit ORDER BY clauses from FROM-clause subqueries if those ORDER BY
drh [Thu, 15 Jul 2021 19:29:43 +0000 (19:29 +0000)] 
Attempt to omit ORDER BY clauses from FROM-clause subqueries if those ORDER BY
clauses do not affect the output.  See
[forum:/forumpost/2d76f2bcf65d256a|forum thread 2d76f2bcf65d256a] for
discussion.  This can help the query flattener in
some cases, resulting in faster query plans.  The current implemention does
not always work.

FossilOrigin-Name: ef97c3e7c3ea2cf1a4db6591328fe7ce3f1d189afc2d578159135824ec89e620

3 years agoChange references to the schema table in sqlite3_analyzer to the new
drh [Thu, 15 Jul 2021 16:39:42 +0000 (16:39 +0000)] 
Change references to the schema table in sqlite3_analyzer to the new
SQLITE_SCHEMA name.

FossilOrigin-Name: 3beb77d6a792d07ca605ec8e5402b8a305860cba4044fcafeed00b9fa862fa16

3 years agoFix a use-after-free error in ioerr.test caused by an error in test code.
dan [Wed, 14 Jul 2021 21:18:31 +0000 (21:18 +0000)] 
Fix a use-after-free error in ioerr.test caused by an error in test code.

FossilOrigin-Name: 1594056aab068b9fae82f6b885828c7127d9bedcc37c4340486e32791bc87c7a

3 years agoEnhance comments pertaining to the interface linkage / calling convention macros.
mistachkin [Tue, 13 Jul 2021 22:49:02 +0000 (22:49 +0000)] 
Enhance comments pertaining to the interface linkage / calling convention macros.

FossilOrigin-Name: c378e99250fe06fae8ca40c62185b607f004d6806e07dbb9f964dd849b4e55f8

3 years agoFurther revisions to #line handling for amalgamation builds.
mistachkin [Tue, 13 Jul 2021 21:59:22 +0000 (21:59 +0000)] 
Further revisions to #line handling for amalgamation builds.

FossilOrigin-Name: 9a84321229ad499ee0f7c85732c2728afb4476c72073a510401a559dda9be38f

3 years agoGet correct #line tags into amalgamation for other builds too.
larrybr [Tue, 13 Jul 2021 20:55:26 +0000 (20:55 +0000)] 
Get correct #line tags into amalgamation for other builds too.

FossilOrigin-Name: 999eb80018f1bb8a8ad73483610400faf5fb37b1be446ce30edbf7028340f50b

3 years agoGet #line tags into amalgamation, subject to configure.
larrybr [Tue, 13 Jul 2021 11:59:17 +0000 (11:59 +0000)] 
Get #line tags into amalgamation, subject to configure.

FossilOrigin-Name: 5d81b598a7cd2cea2553fdf6ca38d2f65f0f1b2d5a8eea8a01c1800f68aa2422

3 years agoMerge from trunk, rename tool option for its effect line_tags
larrybr [Tue, 13 Jul 2021 11:55:07 +0000 (11:55 +0000)] 
Merge from trunk, rename tool option for its effect

FossilOrigin-Name: 9327f73c1b87fb9ca78e261d16b092763f497bb9c6f9784a33eabdc961b06343

3 years agoDo not attempt to run Tcl sessions tests unless both SQLITE_ENABLE_PREUPDATE_HOOK...
dan [Tue, 13 Jul 2021 11:30:46 +0000 (11:30 +0000)] 
Do not attempt to run Tcl sessions tests unless both SQLITE_ENABLE_PREUPDATE_HOOK and SQLITE_ENABLE_SESSIONS are defined.

FossilOrigin-Name: 385db794477e046b5dde726489375786d7565b113084f6e730efb050b08f9a6e

3 years agoAmalgamation has #line directives by default. Minor mksqlite3c.tcl changes
larrybr [Tue, 13 Jul 2021 01:45:04 +0000 (01:45 +0000)] 
Amalgamation has #line directives by default. Minor mksqlite3c.tcl changes

FossilOrigin-Name: ba3eff71973064cbc0ddf51aa822a246c162bbb65387e9523692c60e5340acda

3 years agoClarify comment on sqlite3.h's interface decaration macros.
larrybr [Fri, 9 Jul 2021 23:12:42 +0000 (23:12 +0000)] 
Clarify comment on sqlite3.h's interface decaration macros.

FossilOrigin-Name: 7cb09aef49c0b98c0c5e332d953a2eeb71ae9e243b1e37ab1c8ed4af15d46f50

3 years agoFix an assert() that might fail if sqlite3_create_function_v2() is invoked with NULL...
dan [Fri, 9 Jul 2021 14:59:12 +0000 (14:59 +0000)] 
Fix an assert() that might fail if sqlite3_create_function_v2() is invoked with NULL xStep and xFinal callbacks and a non-NULL xDestroy.

FossilOrigin-Name: ab1550a608684b6b9104b555a975482cfabca5053b7d7dcc60d63a0e3a8d707d

3 years agoEnhance the sqlite3_create_function() interfaces to assume a value of
drh [Fri, 9 Jul 2021 13:52:01 +0000 (13:52 +0000)] 
Enhance the sqlite3_create_function() interfaces to assume a value of
SQLITE_UTF8 is presented with a nonsense value for the preferred encoding.
This is undocumented behavior added for robustness.

FossilOrigin-Name: c1bb5cff527af6a97b025d646581c68ac9b56924ae199f86964026a7bc9724fd

3 years agoAdd the usual "#ifdef __cplusplus" magic to header file ext/misc/carray.h. Also updat...
dan [Fri, 9 Jul 2021 11:52:53 +0000 (11:52 +0000)] 
Add the usual "#ifdef __cplusplus" magic to header file ext/misc/carray.h. Also update carray.h/carray.c to use SQLITE_API in the usual way.

FossilOrigin-Name: 0f97c2a459bfadc2fe19e710e8845039b4434010656d311074b9594b02d0826a

3 years agoAllow CLI shell build to #include same user-specified header as library build.
larrybr [Fri, 9 Jul 2021 00:12:05 +0000 (00:12 +0000)] 
Allow CLI shell build to #include same user-specified header as library build.

FossilOrigin-Name: eb8af9a494fb68c0a1c600b3ac71467645b51b296fc6e2116d7d855319d59a59

3 years agoRename optional SQLITE_CUSTOM_INC define to SQLITE_CUSTOM_INCLUDE.
mistachkin [Thu, 8 Jul 2021 23:35:20 +0000 (23:35 +0000)] 
Rename optional SQLITE_CUSTOM_INC define to SQLITE_CUSTOM_INCLUDE.

FossilOrigin-Name: 060aec37accae858ced5b081a2ff76dccdd8f8bcefc63d1fe2e7478257c69e76

3 years agoAllow library build to #include a user-specified header.
larrybr [Thu, 8 Jul 2021 22:12:27 +0000 (22:12 +0000)] 
Allow library build to #include a user-specified header.

FossilOrigin-Name: 71e6490bbe59939cd15f0094e507dd8a2e167fdd8de675c3ebfeaf528a01f87a

3 years agoPreserve and return to the user any error message returned by a failed xConnect(...
dan [Thu, 8 Jul 2021 18:29:25 +0000 (18:29 +0000)] 
Preserve and return to the user any error message returned by a failed xConnect() call on an eponymous virtual table that prevents a query from being compiled.

FossilOrigin-Name: bbbbeb59a6a14b94dcbaf218cbcfbd39feba4a1df5b37c0e1a955391393eeec4

3 years agoFix an issue with the SQLite Expert extension when a column has no
drh [Thu, 8 Jul 2021 12:12:39 +0000 (12:12 +0000)] 
Fix an issue with the SQLite Expert extension when a column has no
collating sequence.
[forum:/forumpost/78165fa250|Forum post 78165fa250].

FossilOrigin-Name: b1e0c22ec981cf5f8a6597abc6711b1a25019dd51de31129fbc504d3dc743bb4

3 years agoFix a harmless compiler warning in the "fuzzcheck" test program.
drh [Wed, 7 Jul 2021 19:44:32 +0000 (19:44 +0000)] 
Fix a harmless compiler warning in the "fuzzcheck" test program.

FossilOrigin-Name: 8c432642572c8c4b7251f413def0725b3b8e9e7fe10230aa0aabe86b58e5902d

3 years agoFix a harmless compiler warning - duplicate local variable named "pRHS".
drh [Wed, 7 Jul 2021 19:40:18 +0000 (19:40 +0000)] 
Fix a harmless compiler warning - duplicate local variable named "pRHS".

FossilOrigin-Name: 5bc05faf279e0c98be83cb6d56f669a60ff515c8244fca6280991ed0dc5e7ae7

3 years agoFollow-up to [68db1ff9c44fa9c3]: The number of registers needed by
drh [Wed, 7 Jul 2021 16:48:24 +0000 (16:48 +0000)] 
Follow-up to [68db1ff9c44fa9c3]:  The number of registers needed by
PRAGMA foreign_key_check was increased too late for an assert() deep
down inside of sqlite3ExprCode().  So move the size increase a little
earlier.
[forum:/forumpost/79c9e4797d|Forum post 79c9e4797d].

FossilOrigin-Name: 7072404ad0267b8ee774b2804ea59ea28e29316521d76d76a701595e51d1be97

3 years agoFix a recently introduced segfault that might occur if a sub-select were used as...
dan [Wed, 7 Jul 2021 15:52:44 +0000 (15:52 +0000)] 
Fix a recently introduced segfault that might occur if a sub-select were used as a term on the RHS of an IN(...) operator for which the LHS is a row-value.

FossilOrigin-Name: f586c06a5d03943db32add4d3d058a5aa09c819870b29cd8b54cf69433a8cdb1

3 years agoImprove the error message in cases where there is a row-value on the LHS of an IN...
dan [Wed, 7 Jul 2021 13:53:55 +0000 (13:53 +0000)] 
Improve the error message in cases where there is a row-value on the LHS of an IN() operator, the RHS is a list (not a sub-select) and at least one element of the list is not a row-value with the correct number of elements.

FossilOrigin-Name: 6b22f4e71dbc14c887ebbda67095b5faaa8079cac87cd4ab5a2ae90c71cd9633

3 years agoInstead of disallowing writes to fts5 tables if there are fts5vocab cursors open...
dan [Wed, 7 Jul 2021 11:51:03 +0000 (11:51 +0000)] 
Instead of disallowing writes to fts5 tables if there are fts5vocab cursors open on them (commit [c49a6ed7]), abort any fts5vocab queries if the on-disk structure of the fts5 table changes.

FossilOrigin-Name: 9dbdc9001e3258e71ca995fbcdebf66ab95890ded87fa7125c6cb4bd43010aaf

4 years agoHandle "<vector> IN (<vector>, <vector> ...)" in the same way as "<vector> IN (VALUES...
dan [Tue, 6 Jul 2021 20:44:32 +0000 (20:44 +0000)] 
Handle "<vector> IN (<vector>, <vector> ...)" in the same way as "<vector> IN (VALUES(<vector>, <vector>, ...)".

FossilOrigin-Name: 981d230ece98ce89502dab02aa44f73699a9d0e4fce3e9e9dfd47444a5a9990f

4 years agoDo not allow writes to an fts5 table if there are any open fts5vocab cursors.
dan [Mon, 5 Jul 2021 19:01:09 +0000 (19:01 +0000)] 
Do not allow writes to an fts5 table if there are any open fts5vocab cursors.

FossilOrigin-Name: c49a6ed78a917d4972e048e2a9bbe4d400691f97ce7e022f0e4436ceaed7fb73