2416 Commits

Author SHA1 Message Date
drh
cf6e3fd787 New macro ROUND8P() which works like ROUND8() but assumes that the input is
already a multiple of the size of a pointer.  It becomes a no-op for
64-bit machines, giving a small size reduction and speed boost.

FossilOrigin-Name: d126f304cde66ebfe21a4967c22dcba0bac27cbce56318b14bd50051e49c978c
2022-04-01 18:45:11 +00:00
drh
27e456458e Fix a harmless compiler warning.
FossilOrigin-Name: 5d739aff96c47146dba72fd76fed62d4e43ded09b32246fdde13d5467f713135
2022-03-11 15:16:50 +00:00
drh
105dcaa503 Refactor Window.pFunc into Window.pWFunc to disambiguate from other uses of
the variable or field named "pFunc".

FossilOrigin-Name: d9475ebcde169272ad7b1d3a82b2326df55dafc68217bfecd9fcd1f2b89efbd9
2022-03-10 16:01:14 +00:00
drh
46dc631a32 Fix the sqlite_dbpage virtual table so that it starts a write transaction
on all attached schemas.

FossilOrigin-Name: 642a0b4752743216271e4f855a465515ef7f6a985f280251e18d67e3d5fb694b
2022-03-09 14:22:28 +00:00
drh
f357cafaf5 Cache values of UnpackedRecord.aMem[0] into new fields of UnpackedRecord.
This avoids extra indirections and saves about 750K cycles.

FossilOrigin-Name: 7cf2d1f0396362aae7b93da75c2036d52ba86acba1cc90abca560bcf0314a22f
2022-02-27 21:10:49 +00:00
drh
d7e185ce5d Enhance SQLITE_TESTCTRL_LOCALTIME_FAULT so that is able to install an
alternative localtime() interface so that the localtime logic an be better
tested.

FossilOrigin-Name: 6e25cb0890e8cdc63c9a21e841844d066267fc32ad143527843f7c8d05612b53
2022-02-10 21:26:53 +00:00
drh
4f77c9208a Enhance sqlite3_error_offset() to report the position of unresolved
identifiers.

FossilOrigin-Name: 5b8d2577907abda10de29884716bacc10bff0df1451228a0ac40342dbea6d589
2022-02-05 23:11:19 +00:00
drh
796588ae07 Record the position of many identifiers in the parse using the new
Expr.w.iOfst field.  This is done with the idea of providing offset
results for sqlite3_error_offset() for a more kinds of errors, though that
part is not yet implemented.

FossilOrigin-Name: 32a3a53b62ab09ac2212905e7f42fe6f1b09d891e015203e5caf4cb16262f18e
2022-02-05 21:49:47 +00:00
drh
0fe7e7d924 Add new interfaces to enable virtual table to process IN operator constraints
all at once, rather than one element at a time.

FossilOrigin-Name: eb84b80e1f6d8c32bf0c9e1731f0233de0160a13f714f766779ae01fdf504e7b
2022-02-01 14:58:29 +00:00
drh
895bab3383 Give the virtual table xBestIndex method access to (some) OFFSET and LIMIT
clauses.

FossilOrigin-Name: 74fa5757ee0a8499bcd6546dac1a3ecc6048ba9cff9e3e574e28e6e82e894a3d
2022-01-27 16:14:50 +00:00
drh
c692df2784 Make it so that any Parse object is always linked into the database conenction
while it is active.  Hence, an OOM will cause Parse.nErr to be set.

FossilOrigin-Name: 6a45d8fe8bfbc11a5b86d25237e1f8bccfb0f22f3dcaf004ba797aeb57b365ec
2022-01-24 15:34:55 +00:00
drh
3cdb1394b9 Make sure the sqlite3OomFault() routine sets an error in the Parse object
if there is a Parse object active and linked to the database connection.

FossilOrigin-Name: ad7aace761c6b21ba453eaf43c68d985be7cbd5a200fe0d2e27a0c7150f99874
2022-01-24 12:48:54 +00:00
drh
9dbf96bd70 An attempt to integrate the JSON functions directly into the SQLite core,
rather than holding them as an extension.

FossilOrigin-Name: 583b47d865fb8d2c9ae4d3a4e70356a8a758978efb0a282f6b19775bf41fb748
2022-01-06 01:40:09 +00:00
drh
44a5c0257f Clear the cache of triggers used to implement CASCADE foreign key constraints
whenever the schema changes.  Fix for the problem identified by
[forum:/forumpost/2831335356|forum post 2831335356].

FossilOrigin-Name: 5232c9777fe4fb13e1ecfe5b5d644e2c45d0514f95884dbed49a03fb9b67304c
2022-01-02 12:01:03 +00:00
drh
54bc63815a Simplify the sqlite3RunParser() routine by omitting the third parameter.
Results in a binary that is about 100 bytes smaller and 1.4M cycles faster.

FossilOrigin-Name: 6fb2a1bb0280d6e31291e3fd06bbcbbb28ef5fb27d3898e2327a50ac738ae1f3
2021-12-31 19:20:42 +00:00
drh
b296ab6f6a Move the pTriggerPrg and pCleanup elements of the Parse object up into the
section of that object that is persisted across calls to sqlite3NestedParse().
This fixes a memory leak
[forum:/info/24bd1fef7e9323ef|reported in forum post 24bd1fef7e9323ef].

FossilOrigin-Name: 562805cf488a455cdc57adcb110fef9b5416d813d5eaeabacd28bccb76d7f39d
2021-12-31 16:37:46 +00:00
drh
38cebe07bb When implementing a multi-way compound SELECT using merge, try to balance
the merge tree.

FossilOrigin-Name: bb8522fe0dc54282ec13672eba9b44ee08f9cb55c1663f1699a61bf96ec1fd04
2021-12-30 00:37:11 +00:00
drh
f62641e91c Add the sqlite3_error_offset() interface. Use it in the CLI to provide
better context for error messages.

FossilOrigin-Name: b518ce77439852759bc0901071f36d622b1314c9bf3d29c279dfcc405188b975
2021-12-24 20:22:13 +00:00
drh
ef95d5583b Factor out the logic that does quoting for the SQL quote() function, so that
it might be reused for other purposes.

FossilOrigin-Name: 8e98ba1eeb1a5a61b7cb2de337ef8bca3d07494266a50d62b9c6bc60ad0a955f
2021-12-10 21:01:24 +00:00
drh
5a4ac1cc30 Remove unused code and fix comments. Final cleanup before merging.
FossilOrigin-Name: ce42039f5647b1f276acf5d9911528ecb47df1544a587def72c8cd6b2f664289
2021-12-09 19:42:52 +00:00
drh
7e910f6422 Add SQLITE_TESTCTRL_LOGEST and enhance the LogEst utility program.
Improvements to testability of bloom filters.

FossilOrigin-Name: 88b43d798cc5aa59855e92d3e658aee9f0a5def6ffbc5db77af048d75ecdf8cc
2021-12-09 01:28:15 +00:00
drh
50fb7e09b4 Omit the OP_FilterInit opcode. Use OP_Blob to initialize each Bloom filter
instead.  Size the Bloom filter based on sqlite_stat1 size estimates rather
than a run-time measurement for improved testability.

FossilOrigin-Name: 8a9036ee617a6ad93bfe827b0789773c49d3d45b085cb76fa4b9b20a41b79b97
2021-12-06 20:16:53 +00:00
drh
5baaf40af1 Attempt to vary the size of Bloom filters based on an estimate of how many
keys the filter will hold.

FossilOrigin-Name: a7adcf69088cba4b86cc5731a45c9a5263af4355bc0a38f5225cab421c915f7f
2021-12-06 13:07:28 +00:00
drh
6ae49e67cc Run as many Bloom filters as possible before index lookups.
FossilOrigin-Name: 06f6fefd67086896bc49272c6319545ff6c6792f18babe23aced27b60b032119
2021-12-05 20:19:47 +00:00
drh
879ac4d673 Merge trunk fixes into the bloom-filter branch.
FossilOrigin-Name: 0864bfbf079a98beaa484911edb17c3dc728e78eca231d4247b282fd824cc098
2021-12-01 21:07:05 +00:00
drh
3b26b2b56b Check for foreign key constraint errors prior to returning the results from
a RETURNING clause.  See [forum:/forumpost/793beaf322|forum post 793beaf322].

FossilOrigin-Name: a818ba2ed635b91e279dde44236fc7446a33db2b46c9409b67021248c01bf4e5
2021-12-01 19:17:14 +00:00
drh
2db144c33b Add a Bloom filter to the automatic-index mechanism.
FossilOrigin-Name: 50ac4de1d7cbb586ea7969e1ae80ea8b021e194edc2fa7db19374b4ee9369bee
2021-12-01 16:31:02 +00:00
drh
14851b9a14 Fix a harmless comment typo.
FossilOrigin-Name: 7c567338ae4dd31097e9ae5c693b84369c35c5a52534797e8186b4be7297ba78
2021-11-27 12:03:51 +00:00
drh
9f9bdf9345 Fix the build for SQLITE_OMIT_CTE.
FossilOrigin-Name: d7ef96bae459f800241483fe8784552d18ee7f92f408f6453ac687de5530bbb9
2021-11-22 13:35:40 +00:00
dan
488b55856e Fix a problem causing an OOM within an ALTER TABLE ADD COLUMN command that adds a column with a CHECK constraint to go unreported.
FossilOrigin-Name: a33f5e93ecb7d84291f6fecc7b60f0c555034aa47e24584c63c78d8a94710d82
2021-11-16 13:36:50 +00:00
drh
46c425b4dd Make SQLITE_CORRUPT sticky: If a CORRUPT error is returned, all subsequent
write statements within the same transaction also fail early with
SQLITE_CORRUPT.

FossilOrigin-Name: 3feb0f1c3840904d28fc9a61262820e2b9b764addc1dd178aecc2cd0f952042c
2021-11-10 10:59:10 +00:00
drh
90cf38be63 Refactor the code that figures out which SELECT in a cascade of nested queries
a particular aggregate function belongs to.  This fixes the problem
reported by [forum:/forumpost/c7cc2aa3546e39c1|forum post c7cc2aa3546e39c1].
New test cases in dbsqlfuzz and th3.

FossilOrigin-Name: 74aec5dd1df95b5635f4da1f13753f113ea1d61de3dc3a1523ba51089c1900e4
2021-11-08 23:24:00 +00:00
drh
a4a871c286 Show the preferred schema table names in the output of "PRAGMA table_list".
FossilOrigin-Name: 9147390d9885a37a62edc1058f313434627f1b59965c890877d2cb119e355c78
2021-11-04 14:04:20 +00:00
drh
ddfec00de3 First the shadow table mechanism so that it works even if the shadow table
comes before the virtual table in the sqlite_schema table, as can happen
after a VACUUM.

FossilOrigin-Name: 005a8642773556825fe4c5d0b2c12517d35289308a30df0151ef7f080acb0172
2021-11-04 00:51:53 +00:00
drh
ac894af85e Improved the error message that results when a schema parse fails after
ALTER TABLE ADD COLUMN.

FossilOrigin-Name: b007a39dd3a46d13fe06f2a1eeb4e3fd4cad1a77892be6d175b31db1edd6f6a8
2021-11-03 15:59:17 +00:00
dan
e7c23433fb Merge trunk changes into this branch.
FossilOrigin-Name: 638c1b0c50229800067eb1ba29d829b4d6e008256c21a1f67b4ce4d19ea307b3
2021-10-30 17:30:48 +00:00
drh
dcf10a1a4b Fix harmless compiler warnings. Improve the independence of some TCL tests.
FossilOrigin-Name: 1a038242dc6c0cab97dd9375acfce62aa1c386debc36aaed388d366b87ddd931
2021-10-22 11:17:29 +00:00
drh
9fdd66e3c0 Enabled the testcase() macros under SQLITE_DEBUG.
FossilOrigin-Name: 0ae8dd132db8331ca9cc42ad511066924f9d3a1d158ecdb630cebc41b6bd2493
2021-10-20 17:58:33 +00:00
drh
1bbfc6744c Demostrate a prototype sqlite3_autovacuum_pages() interface.
FossilOrigin-Name: bb6f2b8b486c225043bc64e5f74ff6bbad6c5d1f337f0c81eeb6172b087bb943
2021-10-15 23:02:27 +00:00
mistachkin
77978a64f4 Fix harmless compiler warnings in the debug build for MSVC.
FossilOrigin-Name: 1ceb73f316ddc736aebd1e82ef3a0d9c173d025ac5b7fcfbde0a65a0eeb60a4b
2021-10-12 02:17:39 +00:00
drh
b18b3df1da Further to the previous check-in, remove the "harmless()" macro definition as
it is no longer used.

FossilOrigin-Name: b8c9a54664a87ac464b413390572c3feb912e1efc9c8a78c61f1b370e2165c05
2021-10-08 18:15:50 +00:00
drh
074a131245 Minor improvements to comments in the data structure definitions. No
changes to code.

FossilOrigin-Name: e77ac4050cf6c24118ce2af4c075f60e3eeb2dafe6d222c848bc4e541eef7172
2021-10-08 10:25:06 +00:00
drh
dbfbb5a0c5 New assert() statements to protect the u1 and u2 unions of SrcList.
FossilOrigin-Name: 9b91fbcfcc14048f7d0755d47d9b7f9212fa2eaa6f3c04f417fa16c3a47943bf
2021-10-07 23:04:50 +00:00
drh
477572b9f1 Protect access to the Expr.y union using nearby assert()s and branches.
FossilOrigin-Name: 87e2f5eb436fc448427b0e24fb70f29688796b513b8c7b12f1a21540dae1e56d
2021-10-07 20:46:29 +00:00
drh
a4eeccdfdf Protect all accesses to the Expr.x union using nearby assert()s and branches.
FossilOrigin-Name: 8eaa1d4a98b24adf245bbd2fe9212aa6a924a0f09c445906d7f87574f36a7423
2021-10-07 17:43:30 +00:00
drh
f975107437 Protect all accesses to the FuncDef.u and Expr.u unions using nearby
assert()s or branches.

FossilOrigin-Name: 9af863f065e0bef491c2ab7525194505f9516f4e6dfc789d2e3a9d2c2438533a
2021-10-07 13:40:29 +00:00
drh
16a8f28e49 Fix a macro typo introduced by [5da112c02f9e8d0b] that prevented coverage
tests from working.

FossilOrigin-Name: 566e6974892ebd3d3de8d77b24655257a5efe14434c553e1a25fc680b201b336
2021-10-06 10:36:56 +00:00
drh
11a9ad5669 Fix harmless static analyzer warnings in sessions, rtree, fts3 and fts5.
Add the -DSQLITE_OMIT_AUXILIARY_SAFETY_CHECKS compile-time option to cause
ALWAYS() and NEVER() macros to be omitted from the build.

FossilOrigin-Name: 1c67f957fc77e37ce8f0d447c41ca975e8e79a35d332739c24a633649b5b0387
2021-10-04 18:21:14 +00:00
drh
5bf4715e01 Add the sqlite3ResultStrAccum() internal interface to simplify the
the implementation of functions that return strings.

FossilOrigin-Name: e548e9299d3fd6ce5b647cf0dd93ff8e917a5eda43076c6a02389c52640e2e50
2021-10-03 00:12:43 +00:00
drh
260ff08133 Fix a problem with group_concat() when it is used as a window function with
a sliding window, as described by
[forum:/forumpost/f3eb24a6c0|forum thread f3eb24a6c0].

FossilOrigin-Name: f47f7f78227830c065d9ce715b8456eab81a38d680f76bf4ff08f298d84f9c7a
2021-10-01 22:48:52 +00:00