]> git.ipfire.org Git - thirdparty/sqlite.git/log
thirdparty/sqlite.git
3 years agoAdd a NEVER() on an unreachable branch. vtab-limit-offset
drh [Fri, 28 Jan 2022 23:19:01 +0000 (23:19 +0000)] 
Add a NEVER() on an unreachable branch.

FossilOrigin-Name: 388926254b9da6169da7267bd4d5a1a66a26576be435c88269ab8db9eaedc079

3 years agoInclude hidden columns of table valued functions that are constrained
drh [Fri, 28 Jan 2022 19:53:37 +0000 (19:53 +0000)] 
Include hidden columns of table valued functions that are constrained
by the function arguments in the colUsed bitmask.

FossilOrigin-Name: 8f8cab0d0e219f0c4bc2b8061c0013d90a2a5e598dd6cf420d302dfd1b7cbe11

3 years agoRemove a NEVER() that has become reachable now that we have the
drh [Fri, 28 Jan 2022 18:43:33 +0000 (18:43 +0000)] 
Remove a NEVER() that has become reachable now that we have the
sqlite3_vtab_rhs_value() interface.

FossilOrigin-Name: c4c30df7cd858315359bd9bfa90a07152d87a2301eaec865c5bc1c65e272eec8

3 years agoEnable SQLITE_INDEX_CONSTRAINT_LIMIT/OFFSET even if there are vector
drh [Fri, 28 Jan 2022 13:18:40 +0000 (13:18 +0000)] 
Enable SQLITE_INDEX_CONSTRAINT_LIMIT/OFFSET even if there are vector
comparison operators in the WHERE clause.  Also:  Do not enable
sqlite3_vtab_rhs_value() for LIMIT/OFFSET if the value is negative, as this
violates an invariant on Expr.u.iValue.

FossilOrigin-Name: 140480b3ec5466513b165d4818f1180cff6e4a5edcd47efb54cbff74a7107507

3 years agoQuery planner always honors the aConstraintUsage[].omit flag for the
drh [Thu, 27 Jan 2022 21:18:14 +0000 (21:18 +0000)] 
Query planner always honors the aConstraintUsage[].omit flag for the
SQLITE_INDEX_CONSTRAINT_OFFSET constraint.

FossilOrigin-Name: 38c5151eb8cc789ad082a1b40d16b2ddb55454219bd685b6e420995af6a15f55

3 years agoMake LIMIT and OFFSET values available to sqlite3_vtab_rhs_value().
drh [Thu, 27 Jan 2022 18:45:26 +0000 (18:45 +0000)] 
Make LIMIT and OFFSET values available to sqlite3_vtab_rhs_value().

FossilOrigin-Name: b2d37c086c87fe4aee013bba4eab26f642207cd2a797fe4888a6ef868884c191

3 years agoGive the virtual table xBestIndex method access to (some) OFFSET and LIMIT
drh [Thu, 27 Jan 2022 16:14:50 +0000 (16:14 +0000)] 
Give the virtual table xBestIndex method access to (some) OFFSET and LIMIT
clauses.

FossilOrigin-Name: 74fa5757ee0a8499bcd6546dac1a3ecc6048ba9cff9e3e574e28e6e82e894a3d

3 years agoEnforce the restriction that 'unixepoch' only works as the first modifier
drh [Thu, 27 Jan 2022 13:52:01 +0000 (13:52 +0000)] 
Enforce the restriction that 'unixepoch' only works as the first modifier
after the time-value.  This has been documented since 2004, but has never
actually been enforced before.  Also add new test cases for date/time
functions with evidence marks.

FossilOrigin-Name: 64fa9e8c87179211cec248e6dfd7578502e6e969a19e91a4f0e21ed9b972a6bc

3 years agoMinor adjustment to error handling in sqlite3FinishCoding().
drh [Tue, 25 Jan 2022 00:03:25 +0000 (00:03 +0000)] 
Minor adjustment to error handling in sqlite3FinishCoding().

FossilOrigin-Name: a8db69411b0d1275909adeb21027784ada17af24efe3a59ae0ae2a897659ff17

3 years agoRemove an unnecessary assert() that is sometimes not true following an OOM.
drh [Mon, 24 Jan 2022 21:47:00 +0000 (21:47 +0000)] 
Remove an unnecessary assert() that is sometimes not true following an OOM.

FossilOrigin-Name: e9361d72f362b390a31f667363b01cf9d4b78aa19ed5c97f21afe9da764b89c0

3 years agoNew dbsqlfuzz cases added to test/fuzzdata8.db.
drh [Mon, 24 Jan 2022 20:20:35 +0000 (20:20 +0000)] 
New dbsqlfuzz cases added to test/fuzzdata8.db.

FossilOrigin-Name: d1fbf63330830c4b9549d0e67f6cdc19fe7a9dc3fcf509795fd1175499fddc82

3 years agoOne of the ALWAYS() macros in the previous check-in could sometimes be
drh [Mon, 24 Jan 2022 20:16:37 +0000 (20:16 +0000)] 
One of the ALWAYS() macros in the previous check-in could sometimes be
false, following an OOM.  Remove it.  Problem found by dbsqlfuzz.

FossilOrigin-Name: 11df9187dad0eb33b0f6288b76d74f9700420ec855e8106b0bc71df48c485ad1

3 years agoAdd ALWAYS() macros. Change some existing ALWAYS() into assert(). Other
drh [Mon, 24 Jan 2022 19:38:56 +0000 (19:38 +0000)] 
Add ALWAYS() macros.  Change some existing ALWAYS() into assert().  Other
code simplifications.

FossilOrigin-Name: 4aa27b4fcd1ffd06c38357a87ba3f5776367570439c49652f0903873def0bb23

3 years agoRemove many redundant checks for sqlite3.mallocFailed now that any OOM should
drh [Mon, 24 Jan 2022 16:47:12 +0000 (16:47 +0000)] 
Remove many redundant checks for sqlite3.mallocFailed now that any OOM should
cause Parse.nErr to be non-zero.

FossilOrigin-Name: 1f7fa46126ea33ed30e93186aff3df51068aeb4be6f79a102bfe8c4e44941d71

3 years agoMake it so that any Parse object is always linked into the database conenction
drh [Mon, 24 Jan 2022 15:34:55 +0000 (15:34 +0000)] 
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

3 years agoFix testcase for CLI .read recursion.
larrybr [Mon, 24 Jan 2022 14:01:31 +0000 (14:01 +0000)] 
Fix testcase for CLI .read recursion.

FossilOrigin-Name: 53d4404458fb6f0b6b2b69c2225d66b39f09099c356ba3c3e990474f14aba31a

3 years agoMake sure the sqlite3OomFault() routine sets an error in the Parse object
drh [Mon, 24 Jan 2022 12:48:54 +0000 (12:48 +0000)] 
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

3 years agoEnsure that any error encountered while coding a trigger program is transfered to...
dan [Mon, 24 Jan 2022 11:25:42 +0000 (11:25 +0000)] 
Ensure that any error encountered while coding a trigger program is transfered to the main Parse structure before it is used with any other routine that might set the error code.

FossilOrigin-Name: 4293656578811b500786335de7cc9ac0d6ccc6fb273b9419a86968a095404c43

3 years agoLimit CLI input redirect nesting
larrybr [Mon, 24 Jan 2022 06:36:16 +0000 (06:36 +0000)] 
Limit CLI input redirect nesting

FossilOrigin-Name: 7a073931752d16ba71f1a606091461e427ca5ccf4d135d3c5141bfdd4e67e2d5

3 years agoAdd support for the sqlite3_vtab_distinct() interface. Virtual table
drh [Sat, 22 Jan 2022 22:28:32 +0000 (22:28 +0000)] 
Add support for the sqlite3_vtab_distinct() interface.  Virtual table
implementations can use this API to determine more detail about the ordering
requirements needed by the query plan and perhaps reduce the amount of
work required to compute a correct answer.  This is an optimization
opportunity for the virtual table implementation.  The correct answer should
still be obtained (though perhaps more slowly) even if sqlite3_vtab_distinct()
is ignored.

FossilOrigin-Name: e4caf1e3932b1bd0dea072df7fc9458aed98c84ea397b6948b89292603949c41

3 years agoBring sqlite3_vtab_distinct() up to spec so that it works as described in the sqlite3_vtab_distinct
drh [Sat, 22 Jan 2022 20:45:57 +0000 (20:45 +0000)] 
Bring sqlite3_vtab_distinct() up to spec so that it works as described in the
documentation.

FossilOrigin-Name: 4289edf3c5e32a05b51f232020099b33f6f5e79b0ceca2b96baf1186168d9af6

3 years agoIimproved documentation for sqlite3_vtab_distinct(). No changes to code.
drh [Sat, 22 Jan 2022 19:19:35 +0000 (19:19 +0000)] 
Iimproved documentation for sqlite3_vtab_distinct().  No changes to code.

FossilOrigin-Name: 7af03f02940b5380ee7375672ca8d0ff68c5f741d0ea206911631f3eb5a78555

3 years agoOmit the WhereLoopBuilder.pOrderBy field, which is no longer needed.
drh [Sat, 22 Jan 2022 02:52:22 +0000 (02:52 +0000)] 
Omit the WhereLoopBuilder.pOrderBy field, which is no longer needed.

FossilOrigin-Name: a13afc909c8bb643aa154b39ba8c023bae7352d3cd7cfb96be3891fa0e4bc045

3 years agoAn initial attempt to implement sqlite3_vtab_distinct().
drh [Sat, 22 Jan 2022 00:18:01 +0000 (00:18 +0000)] 
An initial attempt to implement sqlite3_vtab_distinct().

FossilOrigin-Name: d571262d2345bb11e71bef395cf078e5d7303b974b38b4e319adda6194ccc1c5

3 years agoUpdate evidence marks for the latest changes to the documentation.
drh [Fri, 21 Jan 2022 19:26:18 +0000 (19:26 +0000)] 
Update evidence marks for the latest changes to the documentation.

FossilOrigin-Name: 19247e919fab9748cae561cb12c4c3c106064390a37e32e724d9a9066cfaff8e

3 years agoFix some of the new date/time function features to comply with the spec.
drh [Fri, 21 Jan 2022 18:57:30 +0000 (18:57 +0000)] 
Fix some of the new date/time function features to comply with the spec.
Update requirement marks.

FossilOrigin-Name: 2f5dc7a9eed89baf6814e9e123354b262c806c853dee1243c93286c564b9aba8

3 years agoWhen computing a vector to be used as a key for an index lookup, do not
drh [Fri, 21 Jan 2022 16:41:11 +0000 (16:41 +0000)] 
When computing a vector to be used as a key for an index lookup, do not
check for NULL values and abort until after all key values have been
computed, in case one of the later key values involves some initialization
that is needed by a LEFT JOIN.  Fix for the problem identified by
[forum:/forumpost/ab95010d410a0a55|Forum post ab95010d410a0a55].

FossilOrigin-Name: 4db5217a28ce767fa14ddfe51cf3ca25eceb72079d46a2fc00f7d6b8ae9abe0b

3 years agoAdd the sqlite3_vtab_rhs_value() interface, allowing the xBestIndex method
drh [Fri, 21 Jan 2022 01:00:53 +0000 (01:00 +0000)] 
Add the sqlite3_vtab_rhs_value() interface, allowing the xBestIndex method
of a virtual table to access known values on the right-hand side of
constraint expressions.

FossilOrigin-Name: e19a0b132a641f0e9f3d72586af538b95b4db8665b1555f84bc0a291bf1a4056

3 years agoAdd requirements marks and tuning. sqlite3_vtab_rhs_value
drh [Fri, 21 Jan 2022 00:38:49 +0000 (00:38 +0000)] 
Add requirements marks and tuning.

FossilOrigin-Name: ac951490fd7d5864fe422a80ee8557478e823e79461bec2ee538f57b6733eb5a

3 years agoTest cases for sqlite3_vtab_rhs_value() based on the qpvtab extension.
drh [Thu, 20 Jan 2022 19:00:48 +0000 (19:00 +0000)] 
Test cases for sqlite3_vtab_rhs_value() based on the qpvtab extension.

FossilOrigin-Name: 577d3d66558368c34acab8a9e552957cf3fa054c348f1383a9121de6e8b281b7

3 years agoEnhancements to the qpvtab virtual table to make it more useful for testing
drh [Thu, 20 Jan 2022 18:27:54 +0000 (18:27 +0000)] 
Enhancements to the qpvtab virtual table to make it more useful for testing
and verification of virtual table interfaces.

FossilOrigin-Name: 850efc4cf3d136fba9173c380e9417b43bb93c050f7eeb85d07fd39a4b1cc6aa

3 years agoInitial implementation of the sqlite3_vtab_rhs_value() interface and the
drh [Thu, 20 Jan 2022 17:10:59 +0000 (17:10 +0000)] 
Initial implementation of the sqlite3_vtab_rhs_value() interface and the
qpvtab extension used for testing the virtual table interface.

FossilOrigin-Name: 0873c76b9b96b66fa9d13ddc8bca126d575ea3352349c7fd648f0c2f75d770f5

3 years agoA better and more robust fix for the problem of reading a read-only WAL
drh [Thu, 20 Jan 2022 14:40:34 +0000 (14:40 +0000)] 
A better and more robust fix for the problem of reading a read-only WAL
mode database with existing -wal and -shm files, replacing [f426874e005e3c23].

FossilOrigin-Name: 71bfd0b57ab197405606b8096b8521d784ff174c4eecf1d9804d38342c03cc80

3 years agoFix harmless scan-build warnings.
drh [Thu, 20 Jan 2022 12:58:15 +0000 (12:58 +0000)] 
Fix harmless scan-build warnings.

FossilOrigin-Name: ab160e8bae3a4fc2067d73fe33542f261652985390fe9b0390a4f9c33a1990bf

3 years agoFix the ability to read read-only WAL-mode database when -shm is present,
drh [Thu, 20 Jan 2022 02:04:53 +0000 (02:04 +0000)] 
Fix the ability to read read-only WAL-mode database when -shm is present,
([00ec95fcd02bb415|check-in 00ec95fcd02bb415]) so that it works
for the case of 64K page size.

FossilOrigin-Name: f426874e005e3c23e8a00083b7c201408e072bca413e52bfc436da6483afb0cd

3 years agoFix a test result for alterauth2.test due to the recent fix to authorizer
drh [Wed, 19 Jan 2022 18:31:43 +0000 (18:31 +0000)] 
Fix a test result for alterauth2.test due to the recent fix to authorizer
calls for ALTER TABLE DROP COLUMN.

FossilOrigin-Name: e799a35f2bf85ce43b476738bfbd9b6b378bbf02fa0708dda0deba71dd37f608

3 years agoFix ALTER TABLE DROP COLUMN so that it invokes the authorizer. Fix for
drh [Tue, 18 Jan 2022 16:16:32 +0000 (16:16 +0000)] 
Fix ALTER TABLE DROP COLUMN so that it invokes the authorizer. Fix for
[forum:/forumpost/fd82b85947541dec|forum post fd82b85947541dec].

FossilOrigin-Name: aca6c61d79215519fb006af19d9011029df68f195a4ce65aff7a1bf4e36efb94

3 years agoAllow an "IntReal" value to count as a REAL when checking types for
drh [Mon, 17 Jan 2022 23:37:25 +0000 (23:37 +0000)] 
Allow an "IntReal" value to count as a REAL when checking types for
insertion into a generated column on a STRICT table.
[forum:/forumpost/fa012c77796d9399|Forum post fa012c77796d9399].

FossilOrigin-Name: 1ec44d55da2ced1a1b0b78b489caff628652464f5709ee827e35409eb20ea794

3 years agoFix incorrect testcase() and assert() macros in json.c. They were not causing
drh [Mon, 17 Jan 2022 15:23:57 +0000 (15:23 +0000)] 
Fix incorrect testcase() and assert() macros in json.c.  They were not causing
problems.  The assert() was simply unreachable.  The testcase() added an
unreachable condition.

FossilOrigin-Name: 5623497adc8af9950fd79392000a68ba6fdca43594603eadaa7e19c8fb845a7d

3 years agoNever allow the b-tree layers view of the number of pages in the database
drh [Mon, 17 Jan 2022 14:42:38 +0000 (14:42 +0000)] 
Never allow the b-tree layers view of the number of pages in the database
file exceed the actual number of pages in the database file, even when
PRAGMA writeable_schema=ON.  This helps with earlier detection of corruption,
and prevents excess memory usage and CPU cycles in some integrity_check ops.

FossilOrigin-Name: 0407c8793700491b8519a649b9624f569b0e7e9b94d0db79d4a08139e0ecdb69

3 years agoFix test cases so that they all still work even with -DSQLITE_DQS=0.
drh [Sun, 16 Jan 2022 19:11:13 +0000 (19:11 +0000)] 
Fix test cases so that they all still work even with -DSQLITE_DQS=0.

FossilOrigin-Name: 4883776669ee2f2310ea82b0d6df4d008eebaa7cb252102539cf21a635402ebb

3 years agoFix ALTER TABLE so that it works even when compiled using -DSQLITE_DQS=0.
drh [Sun, 16 Jan 2022 15:15:39 +0000 (15:15 +0000)] 
Fix ALTER TABLE so that it works even when compiled using -DSQLITE_DQS=0.
[forum:/forumpost/3c1a00b66fca81fe|Forum post 3c1a00b66fca81fe].

FossilOrigin-Name: 092ad64faa4ae93b1e09ccd52159621d619e6817bcb4573331e9053d97f731fd

3 years agoRemove code from lemon.c that was made superfluous by
drh [Fri, 14 Jan 2022 23:28:11 +0000 (23:28 +0000)] 
Remove code from lemon.c that was made superfluous by
[1b22b42e59793af1|check-in 1b22b42e59793af1] in late 2017.

FossilOrigin-Name: 6d2f95a474a0c196f36317d88557bfb449ce125c1d012fc1844378c450697a05

3 years agoFix a NEVER() in the byte-code engine that can sometimes be true.
drh [Fri, 14 Jan 2022 21:34:49 +0000 (21:34 +0000)] 
Fix a NEVER() in the byte-code engine that can sometimes be true.
Test case in TH3.

FossilOrigin-Name: 7ac91b5339f820f49b0eb52055d42b6a55905444883426caf792fada63079516

3 years agoFor .import schema, quote it as for other identifiers.
larrybr [Fri, 14 Jan 2022 16:29:45 +0000 (16:29 +0000)] 
For .import schema, quote it as for other identifiers.

FossilOrigin-Name: bff9153ceedcc7be77f2daf5139fee29c2fab742ff1fce49877965423a7d4be3

3 years agoAdd --schema S option to .import
larrybr [Thu, 13 Jan 2022 21:22:54 +0000 (21:22 +0000)] 
Add --schema S option to .import

FossilOrigin-Name: 38d9dbca166078013a44214c88805fc7cca578976ceed9fc62f5159a38ec96a7

3 years agoWhen the result of a subquery is to be stored in a register and that
drh [Wed, 12 Jan 2022 20:31:14 +0000 (20:31 +0000)] 
When the result of a subquery is to be stored in a register and that
subquery has an ORDER BY clause and an OFFSET, NULL out the destination
register before starting the ORDER BY so that the register will be set
correctly even if the OFFSET is larger than the number of output rows.
Fix for the problem reported in
[forum:/forumpost/0ec80f12d02acb3f|forum post 0ec80f12d02acb3f].

FossilOrigin-Name: 9282bcde301cee2a5c3c068b5b0b7ce992c155ece894413a6a9a51a81e4133fd

3 years agoMake tool/mctimec.tcl effect more regular and obvious
larrybr [Wed, 12 Jan 2022 01:42:50 +0000 (01:42 +0000)] 
Make tool/mctimec.tcl effect more regular and obvious

FossilOrigin-Name: 02aaa10f34ab17e76feb7b6f79048309536c0794fcb534b934e06f3daedfeaba

3 years agoFix mkctimec.tcl with the updated compile-time options for JSON.
drh [Wed, 12 Jan 2022 00:52:34 +0000 (00:52 +0000)] 
Fix mkctimec.tcl with the updated compile-time options for JSON.

FossilOrigin-Name: 8ded3f5b0025eb6cc11669c1208681e592862ce352dfff11173dff68daafad30

3 years agoFix harmless compiler warning seen with MSVC.
mistachkin [Wed, 12 Jan 2022 00:28:12 +0000 (00:28 +0000)] 
Fix harmless compiler warning seen with MSVC.

FossilOrigin-Name: adebb9d7478d092f16fb0ef7d5246ce152b166479d6f949110b5878b89ea2cec

3 years agoMerge the JSON interface into the core. Add -> and ->> operators for JSON
drh [Tue, 11 Jan 2022 23:28:12 +0000 (23:28 +0000)] 
Merge the JSON interface into the core.  Add -> and ->> operators for JSON
that are compatible with by MySQL and PG.

FossilOrigin-Name: 4cbb3e3efeb40cc41df15e96c7a0c9d6a8c12ca9f2c139ff1b31ea5416735d34

3 years agoRemove vestigial traces of json_ntype(). json-in-core
drh [Tue, 11 Jan 2022 22:06:25 +0000 (22:06 +0000)] 
Remove vestigial traces of json_ntype().

FossilOrigin-Name: 8da07c8b09ff83436a34e539e4cce8ba9524390017ca14f4af8344a12e351550

3 years agoFix the PG-compatible -> and ->> path parsing.
drh [Tue, 11 Jan 2022 18:01:17 +0000 (18:01 +0000)] 
Fix the PG-compatible -> and ->> path parsing.

FossilOrigin-Name: 22d5138315fb77eeea1c7e66ccc4190bcae18d058a99aa37ddd119e54b52f723

3 years agoFix typo in the json-enhancements.md document.
drh [Mon, 10 Jan 2022 17:43:54 +0000 (17:43 +0000)] 
Fix typo in the json-enhancements.md document.

FossilOrigin-Name: feba24ef774d80ebbaf87a93fc106cb7e482edcc3f237edd4c9d4e918ffb3131

3 years agoImplement the new PG-compliant versions of the -> and ->> operators.
drh [Mon, 10 Jan 2022 15:43:13 +0000 (15:43 +0000)] 
Implement the new PG-compliant versions of the -> and ->> operators.

FossilOrigin-Name: 39eff3b9bf1f318d3606d8e5361a2adb2ba8bc1ca2a436ce4f9a204aa4cf20dd

3 years agoNew proposal for -> and ->> operators.
drh [Mon, 10 Jan 2022 13:55:08 +0000 (13:55 +0000)] 
New proposal for -> and ->> operators.

FossilOrigin-Name: 1108e12a2244edc6247050a0e9ad25b912bba6c57c71c51c2bc55167a6955175

3 years agoTypo fix in doc/json-enhancements.md.
drh [Sun, 9 Jan 2022 20:51:59 +0000 (20:51 +0000)] 
Typo fix in doc/json-enhancements.md.

FossilOrigin-Name: c3b01d496479b3250a8895c245f79ab43ac469148d163593fea00894db195a37

3 years agoUpdate the doc/json-enhancements.md document to better explain the features
drh [Sun, 9 Jan 2022 20:42:55 +0000 (20:42 +0000)] 
Update the doc/json-enhancements.md document to better explain the features
of this branch.

FossilOrigin-Name: b8ac938f41eff8e5a23037c0e8b035a65e1b9505eca2a601221c195225595788

3 years agoDo not enclude ENABLE_JSON1 in the compile-time options.
drh [Sun, 9 Jan 2022 19:44:36 +0000 (19:44 +0000)] 
Do not enclude ENABLE_JSON1 in the compile-time options.

FossilOrigin-Name: 8bf41bc5cb19fcde569ed2c788553a848ebd9c79065bd3d2aa99e5a6bfed9696

3 years agoMerge trunk enhancements into the json-in-core branch.
drh [Sun, 9 Jan 2022 19:36:39 +0000 (19:36 +0000)] 
Merge trunk enhancements into the json-in-core branch.

FossilOrigin-Name: ea755771699dcbffe0ddfd204d42fae9b6e79e107485c725b8eb6caab92aacb8

3 years agoAdd a new built-in subtype() function.
drh [Sun, 9 Jan 2022 16:54:02 +0000 (16:54 +0000)] 
Add a new built-in subtype() function.

FossilOrigin-Name: a25f4ce255c034fc694c33728aedb98289ebccda9c48920829ef780b92b8faee

3 years agoAdd NEVER() macros to two branches that became unreachable due to
drh [Sat, 8 Jan 2022 21:50:00 +0000 (21:50 +0000)] 
Add NEVER() macros to two branches that became unreachable due to
[e199a851e316bd47].

FossilOrigin-Name: 71272caff5874137ad0b1ddfc22ced4bb66e6c97f7868fdae0347a186f589b38

3 years agoAdd function format() as an alias for printf(), for compatibility with other
drh [Sat, 8 Jan 2022 21:00:38 +0000 (21:00 +0000)] 
Add function format() as an alias for printf(), for compatibility with other
systems.

FossilOrigin-Name: 68bffc612c467b2419bf5fe85a8ca16b787003e0e8c11f7c051a879f5865b847

3 years agoMerge the JSON function enhancements from the json-enhancements branch into
drh [Sat, 8 Jan 2022 15:37:13 +0000 (15:37 +0000)] 
Merge the JSON function enhancements from the json-enhancements branch into
json-in-core.

FossilOrigin-Name: e116501c2f0e594eb7a3dd804daa943cc508f32ded3078aed21b695ec83bcd4c

3 years agoImproved commenting of changes in the json1.c extension.
drh [Sat, 8 Jan 2022 15:05:53 +0000 (15:05 +0000)] 
Improved commenting of changes in the json1.c extension.

FossilOrigin-Name: 4d81425e1bf2cff6fa961d0a7936b5f62d3f8ffe9bffea89c1e8b8ddf8fad6f4

3 years agoNotes on the JSON enhancement proposals.
drh [Fri, 7 Jan 2022 18:09:56 +0000 (18:09 +0000)] 
Notes on the JSON enhancement proposals.

FossilOrigin-Name: 18160985ea6b2bbf27de25e0f4f3a1ebcdb079a36af039fc06e37a834e49e772

3 years agoReverse the meaningn of -> and ->>. ->> raises an error on invalid JSON
drh [Fri, 7 Jan 2022 17:26:40 +0000 (17:26 +0000)] 
Reverse the meaningn of -> and ->>.  ->> raises an error on invalid JSON
but -> does not.  This allows ->> to behave the same as PG and MySQL.

FossilOrigin-Name: 85f8170555ee0d4d28cb7e120a7062e9f64c331a936fdfa29fc0e67224eea7c6

3 years agoChange the -> operator to use json_extract(). The ->> operator continues
drh [Fri, 7 Jan 2022 17:14:35 +0000 (17:14 +0000)] 
Change the -> operator to use json_extract().  The ->> operator continues
to use json_nextract().

FossilOrigin-Name: b4c8a62381755b9f1447e10ab95df7209eebda91f9a4583ef1c093a13f6b4725

3 years agoNew json_nextract() function that works like json_extract() except that it
drh [Fri, 7 Jan 2022 17:08:48 +0000 (17:08 +0000)] 
New json_nextract() function that works like json_extract() except that it
returns NULL instead of raising an error if the first argument is not
well-formed JSON.  Or if the first argument is not well-formed JSON and
the second argument is '$', then return the first argument quoted.  The
"->" and "->>" operators are converted to use json_nextract().

FossilOrigin-Name: dc00f5286d26524b149de071490320afaa203fec5777b3eb813f07963614861a

3 years agoAdd the json_ntype() SQL function. Works like the 1-argument json_type()
drh [Fri, 7 Jan 2022 16:03:00 +0000 (16:03 +0000)] 
Add the json_ntype() SQL function.  Works like the 1-argument json_type()
except that it returns NULL if the argument is not well-formed JSON, rather
than raising an error.

FossilOrigin-Name: ed9956f5ddca68141eded81d5362847db603257329801622c4eb3b0732112f14

3 years agoAccept abbreviated JSON Paths on the right-hand side of the -> and ->> operators.
drh [Fri, 7 Jan 2022 15:47:12 +0000 (15:47 +0000)] 
Accept abbreviated JSON Paths on the right-hand side of the -> and ->> operators.

FossilOrigin-Name: d15410900dccbb7159683c29f640fa321b1e019718827334f5fefe89da623008

3 years agoAdd new binary operators "->" and "->>" to the parser that evaluate to
drh [Fri, 7 Jan 2022 14:58:47 +0000 (14:58 +0000)] 
Add new binary operators "->" and "->>" to the parser that evaluate to
2-argument SQL functions by the same name.  Add new "->" and "->>" functions
to the JSON extension that are aliases for json_extract().

FossilOrigin-Name: c4e4e3a3fc5da0381ccb7930706e57d7831d87f9c63bafe49ae64117701e1cfe

3 years agoAdd the '-guard:cf' compiler option for Windows 10, per [forum:/forumpost/8d3b4ad694...
mistachkin [Thu, 6 Jan 2022 17:13:56 +0000 (17:13 +0000)] 
Add the '-guard:cf' compiler option for Windows 10, per [forum:/forumpost/8d3b4ad694|forum post 8d3b4ad694].

FossilOrigin-Name: 2d6a16caa7d28ad5c766036b2eb6c2020683fcc9389b3c7df2013739929dd36f

3 years agoAn attempt to integrate the JSON functions directly into the SQLite core,
drh [Thu, 6 Jan 2022 01:40:09 +0000 (01:40 +0000)] 
An attempt to integrate the JSON functions directly into the SQLite core,
rather than holding them as an extension.

FossilOrigin-Name: 583b47d865fb8d2c9ae4d3a4e70356a8a758978efb0a282f6b19775bf41fb748

3 years agoRemove two NEVER() macros that can sometimes be true if the database is
drh [Wed, 5 Jan 2022 21:01:26 +0000 (21:01 +0000)] 
Remove two NEVER() macros that can sometimes be true if the database is
corrupt.  dbsqlfuzz 0414d2c18290fc80fd5fb540def7d3e46c1ae9c6.

FossilOrigin-Name: b6a82f3c3b9d89fdf628c7f117b6a4a64383a36c84fe84d47c80e845c9bd8a4f

3 years agoFix an assert() failure that could follow an OOM when coding a RETURNING trigger...
dan [Wed, 5 Jan 2022 15:54:02 +0000 (15:54 +0000)] 
Fix an assert() failure that could follow an OOM when coding a RETURNING trigger. dbsqlfuzz case 5d3e2438f15dc32b473d9f29413157857efa1212.

FossilOrigin-Name: 7ae596dd4a73a09585c5dc9f4faf75d126d0733fc2fb32c1de64126a1088d967

3 years agoImproved handling of OOM errors in sqlite3ExpandReturning().
drh [Wed, 5 Jan 2022 11:49:58 +0000 (11:49 +0000)] 
Improved handling of OOM errors in sqlite3ExpandReturning().
dbsqlfuzz 1040b720f0bbc3bdcfe7336acffbf71517e3ef82.

FossilOrigin-Name: 33c6b8e94bda12df13b4d2dd782b3120c3628596b86ef531d20b3100bf159b50

3 years agoTest .mode quote blob output
larrybr [Mon, 3 Jan 2022 19:33:44 +0000 (19:33 +0000)] 
Test .mode quote blob output

FossilOrigin-Name: ef4dcd1080241a62a50eff28ef12c49da0116032f10843aaf048ae7ad3cdfd0e

3 years agoSmall performance and size optimization to allocateCursor().
drh [Mon, 3 Jan 2022 01:43:28 +0000 (01:43 +0000)] 
Small performance and size optimization to allocateCursor().

FossilOrigin-Name: 23f042669aff535afa6ee9de367656848d01e90a1c9dab9359fa938a615b4195

3 years agoRemove unnecessary assignment operations in the btree search algorithm,
drh [Sun, 2 Jan 2022 21:53:54 +0000 (21:53 +0000)] 
Remove unnecessary assignment operations in the btree search algorithm,
for a small size reduction and performance increase.

FossilOrigin-Name: 01bd266eb682feed901a0995c2232b62d8444d19dbb227095dfbfe8edeaa5d88

3 years agoIn the CLI, fix ".mode quote" output for UTF16 BLOBs.
drh [Sun, 2 Jan 2022 20:54:33 +0000 (20:54 +0000)] 
In the CLI, fix ".mode quote" output for UTF16 BLOBs.
[forum:/forumpost/b4bfe62fe6|Forum post b4bfe62fe6].

FossilOrigin-Name: 728e9dcc6d211acd787837c41cb62275284b5e02f55bd28bf5a44e233bcb057a

3 years agoDo not open a rollback journal file when the journal_mode is OFF, even if
drh [Sun, 2 Jan 2022 19:32:43 +0000 (19:32 +0000)] 
Do not open a rollback journal file when the journal_mode is OFF, even if
such a file exists on disk. See
[forum/forumpost/ec2a102440|forum post ec2a102440] for a description.  I so
far have been unable to find any harm to come of the problem, other than the
assertion fault when in DEBUG mode.

FossilOrigin-Name: fdf9ed665b2fb07d26f3852bfd2170f2fb56851edd2851d47672116a8ea58463

3 years agoImprove formatting of an assert(). No functional changes.
drh [Sun, 2 Jan 2022 19:10:49 +0000 (19:10 +0000)] 
Improve formatting of an assert().  No functional changes.

FossilOrigin-Name: 4bb78ce8b50af3c6f04ffdf4de4438e61370a73ccfa971479af5d58a0a7e5fbb

3 years agoPerformance optimization in btreeParseCellPtr() by unrolling the loop that
drh [Sun, 2 Jan 2022 16:48:00 +0000 (16:48 +0000)] 
Performance optimization in btreeParseCellPtr() by unrolling the loop that
decodes the rowid.

FossilOrigin-Name: fef72368a2eef5cb68ffc56e4f01be212d5e3318ebdb56a23ab26e1ef454272e

3 years agoSmall performance optimization and size reduction in sqlite3BtreeDelete().
drh [Sun, 2 Jan 2022 14:55:43 +0000 (14:55 +0000)] 
Small performance optimization and size reduction in sqlite3BtreeDelete().

FossilOrigin-Name: da0af4dd9ba4180a16543fac1549fd4ccecdc66dcf6d275f77de21fd80708882

3 years agoClear the cache of triggers used to implement CASCADE foreign key constraints
drh [Sun, 2 Jan 2022 12:01:03 +0000 (12:01 +0000)] 
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

3 years agoEarlier detection of corruption in sqlite3BtreeDelete(). Fix for
drh [Sun, 2 Jan 2022 11:25:51 +0000 (11:25 +0000)] 
Earlier detection of corruption in sqlite3BtreeDelete().  Fix for
the assertion fault reported by
[forum:/forumpost/9d78389221|forum post 9d78389221].

FossilOrigin-Name: 13e9ff9e84a114374b49986484dbee05953a496f3017dd5089fba6f495a17c40

3 years agoDo not raise an SQLITE_SCHEMA error if in sqlite3Init(). Fix for PoC #2 in
drh [Sat, 1 Jan 2022 22:55:31 +0000 (22:55 +0000)] 
Do not raise an SQLITE_SCHEMA error if in sqlite3Init().  Fix for PoC #2 in
[forum:/forumpost/b03d86f951|forum post b03d86f951].  See TH3 for test
cases.

FossilOrigin-Name: e199a851e316bd471bfc54204b8c250d3ae93b829261214158a2c74acad4093e

3 years agoFix an assert() in pager.c to avoid the possibility of side-effects.
dan [Sat, 1 Jan 2022 20:02:58 +0000 (20:02 +0000)] 
Fix an assert() in pager.c to avoid the possibility of side-effects.

FossilOrigin-Name: 1d1fe03c752267f03f015ada975876f65e2a7b967e19f057b5c73f95d7df8a9c

3 years agoAttempt to fix a harmless compiler warning in FTS5.
drh [Sat, 1 Jan 2022 19:55:29 +0000 (19:55 +0000)] 
Attempt to fix a harmless compiler warning in FTS5.

FossilOrigin-Name: 8e619c21e2326be1538b60908e7cd211558ec840835c6eb69e768eb190e1fd0b

3 years agoFix an obscure problem with releasing savepoints stored in an in-memory journal that...
dan [Sat, 1 Jan 2022 19:29:50 +0000 (19:29 +0000)] 
Fix an obscure problem with releasing savepoints stored in an in-memory journal that could cause subsequent savepoint rollback to fail.

FossilOrigin-Name: 73c2b50211d3ae26aeb89976ec7b9fcd7de9f152b283ec7d0809ad18bddc603e

3 years agoRemove an obsolete assert() statement that no longer does anything useful
drh [Sat, 1 Jan 2022 17:21:55 +0000 (17:21 +0000)] 
Remove an obsolete assert() statement that no longer does anything useful
and which is not always true.  Fix for PoC #1 of
[forum:/forumpost/b03d86f951|forum post b03d86f951].

FossilOrigin-Name: c76a4c0b3cb625017ba09c8bccfcf1b5826df6873f1d3705d3345716079d5ec9

3 years agoFix a faulty assert() statement - adding a CORRUPT_DB term - based on a test
drh [Sat, 1 Jan 2022 12:26:01 +0000 (12:26 +0000)] 
Fix a faulty assert() statement - adding a CORRUPT_DB term - based on a test
case derived from [562805cf488a455c].  Also add a test case to that prior
issue.

FossilOrigin-Name: 0dd6b5fccd554ebe4c0b081601863acd7b6ea81b51e14b508b23244f2a570e7e

3 years agoMark the REGEXP operator in the built-in extension as deterministic.
drh [Fri, 31 Dec 2021 22:53:15 +0000 (22:53 +0000)] 
Mark the REGEXP operator in the built-in extension as deterministic.

FossilOrigin-Name: e654b57a9fc32021453eed48d1c1bba65c833fb1aac3946567968c877e4cbd10

3 years agoSimplify the sqlite3RunParser() routine by omitting the third parameter.
drh [Fri, 31 Dec 2021 19:20:42 +0000 (19:20 +0000)] 
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

3 years agoFix harmless compiler warnings in the shell.
mistachkin [Fri, 31 Dec 2021 19:08:20 +0000 (19:08 +0000)] 
Fix harmless compiler warnings in the shell.

FossilOrigin-Name: f3ea36d79b6aa95470bf13e8d4ed5250a6b19bc16032b29e4dcdfc49b47a1edf

3 years agoFix harmless compiler warnings seen with MSVC.
mistachkin [Fri, 31 Dec 2021 18:26:50 +0000 (18:26 +0000)] 
Fix harmless compiler warnings seen with MSVC.

FossilOrigin-Name: a9bfb621091b6d92d1caeb69134d3809d9e0b43fe764608c5995db277ac785be

3 years agoPerformance optimization and size reduction in sqlite3RunParser().
drh [Fri, 31 Dec 2021 17:54:48 +0000 (17:54 +0000)] 
Performance optimization and size reduction in sqlite3RunParser().

FossilOrigin-Name: 41ee2bac5731d8434322e92abba580f7c759a137e576dd286fe01ab23fc440ea

3 years agoMove the pTriggerPrg and pCleanup elements of the Parse object up into the
drh [Fri, 31 Dec 2021 16:37:46 +0000 (16:37 +0000)] 
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

3 years agoRemove unnecessary conditionals around the ORDER BY resolver calls in
drh [Thu, 30 Dec 2021 17:46:15 +0000 (17:46 +0000)] 
Remove unnecessary conditionals around the ORDER BY resolver calls in
multiSelectOrderBy().

FossilOrigin-Name: f2887e018be71bc406526935c7e99e42f12fc5d1d1c65a89dc2b9bfbca01d43d