]> git.ipfire.org Git - thirdparty/sqlite.git/log
thirdparty/sqlite.git
3 years agoPrototype implementation of IF EXISTS and IF NOT EXISTS clauses on the alter-table-if-exists
drh [Wed, 9 Feb 2022 16:18:44 +0000 (16:18 +0000)] 
Prototype implementation of IF EXISTS and IF NOT EXISTS clauses on the
various forms of ALTER TALE.

FossilOrigin-Name: 460abf93ac6c47b0e3462e941d5de8e6b678dce9fac04a1e4923e2bf65cb59b2

3 years agoWrites to the subjournal should be all-or-nothing. Fix for
drh [Tue, 8 Feb 2022 15:14:18 +0000 (15:14 +0000)] 
Writes to the subjournal should be all-or-nothing.  Fix for
dbsqlfuzz fe3c397fb90029313446c4e0f4a6cd0c81dd9621.

FossilOrigin-Name: 22cc55e84f67f6f39b7dba07a4ef7ae958b2d926633faec91a278922053e50c6

3 years agoProvide sqlite3_error_offset() data for some new errors.
drh [Tue, 8 Feb 2022 13:41:23 +0000 (13:41 +0000)] 
Provide sqlite3_error_offset() data for some new errors.

FossilOrigin-Name: 1269206db810460e55a52e178ba3332add42a11f66c5f292f8f0d29ccd61a4b8

3 years agocomment-only change to sqlite3.h
larrybr [Tue, 8 Feb 2022 12:24:43 +0000 (12:24 +0000)] 
comment-only change to sqlite3.h

FossilOrigin-Name: f815cf4a5f97778f177d373814700e8f2f6429dc467b68b799b5b349cc00b7a2

3 years agoDo not show the error code number of CLI error messages unless the error
drh [Tue, 8 Feb 2022 12:13:16 +0000 (12:13 +0000)] 
Do not show the error code number of CLI error messages unless the error
is something other than 1 (SQLITE_ERROR).

FossilOrigin-Name: b471601892df98c5103bb55132bbdecf3e4dfc428aaecc47bfec1e1d51e583c7

3 years agoImproved error message formatting in the shell. Distinguish between
drh [Tue, 8 Feb 2022 11:52:45 +0000 (11:52 +0000)] 
Improved error message formatting in the shell.  Distinguish between
"Parse errors" and "Runtime errors".

FossilOrigin-Name: ae3e322a029952f575e49c73fb50b46bbea55be6792cc225cb94f5e0cbd046d9

3 years agoDisable the sqlite3_error_offset() when the error occurs in a trigger or
drh [Mon, 7 Feb 2022 18:52:56 +0000 (18:52 +0000)] 
Disable the sqlite3_error_offset() when the error occurs in a trigger or
view or some other bit of text that is not part of the original statement.

FossilOrigin-Name: 0e909e34fa74e7b9b7954e4ed4c39dd293c1d413b58fda03607faab74aa382ad

3 years agoWhen create table/view fails due to name taken, say which took it.
larrybr [Mon, 7 Feb 2022 01:09:49 +0000 (01:09 +0000)] 
When create table/view fails due to name taken, say which took it.

FossilOrigin-Name: 9a206e37fb49a203a7b5fdc93c41acc39e9ceb37144c78432a235e2f0d54a210

3 years agoFix unreachable branches in the sqlite3_error_offset() logic.
drh [Sun, 6 Feb 2022 23:54:41 +0000 (23:54 +0000)] 
Fix unreachable branches in the sqlite3_error_offset() logic.

FossilOrigin-Name: 031381aea371892a35737e550121846af41241711a36c1a2086af3b0c11bf7b6

3 years agoThe sqlite3_vtab_in() interface should return false for a vector IN constraint.
drh [Sun, 6 Feb 2022 22:13:35 +0000 (22:13 +0000)] 
The sqlite3_vtab_in() interface should return false for a vector IN constraint.

FossilOrigin-Name: 245d0241c78870c6a41af3e02b82b13151472e2102fbd62989672f8122feca73

3 years agoWith the new ALTER TABLE under PRAGMA writable_schema=ON processing, do not
drh [Sun, 6 Feb 2022 21:13:59 +0000 (21:13 +0000)] 
With the new ALTER TABLE under PRAGMA writable_schema=ON processing, do not
ignore non-parser errors such as OOMs.

FossilOrigin-Name: 36653ccef68cf61b6001000a713b06e951cb6fddced6b6a906c3b17d70a8af87

3 years agoFaster computation of Expr.nHeight.
drh [Sun, 6 Feb 2022 11:51:23 +0000 (11:51 +0000)] 
Faster computation of Expr.nHeight.

FossilOrigin-Name: a7a5af327ba8bafcd58b828e3e7a10d0008bb780d55a6c573aa15896dcc8ab89

3 years agoRecord the error offset on INTEGER tokens.
drh [Sun, 6 Feb 2022 11:26:51 +0000 (11:26 +0000)] 
Record the error offset on INTEGER tokens.

FossilOrigin-Name: 38e057a580613be176552e230e40b4434a9ed57a82d407e92a23c7b8e62c0b0e

3 years agoFurther improvements to localization of errors in input SQL.
drh [Sun, 6 Feb 2022 00:30:04 +0000 (00:30 +0000)] 
Further improvements to localization of errors in input SQL.

FossilOrigin-Name: fa34676042720161ca03f3926814152eb1d144ec12fd2b44e5429408ea4ad5b0

3 years agoEnhance sqlite3_error_offset() to report the position of unresolved
drh [Sat, 5 Feb 2022 23:11:19 +0000 (23:11 +0000)] 
Enhance sqlite3_error_offset() to report the position of unresolved
identifiers.

FossilOrigin-Name: 5b8d2577907abda10de29884716bacc10bff0df1451228a0ac40342dbea6d589

3 years agoRecord the position of many identifiers in the parse using the new
drh [Sat, 5 Feb 2022 21:49:47 +0000 (21:49 +0000)] 
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

3 years agoUpdate stale evidence marks on sqlite3_vtab_rhs_value() test cases.
drh [Sat, 5 Feb 2022 13:27:52 +0000 (13:27 +0000)] 
Update stale evidence marks on sqlite3_vtab_rhs_value() test cases.

FossilOrigin-Name: 46744b83d5e1335bcbc59f9625e8ade3f360469d17f34e8d996f077ba9afa89e

3 years agoWhen PRAGMA writable_schema=ON, allow ALTER TABLE to proceed even if there
drh [Sat, 5 Feb 2022 12:39:17 +0000 (12:39 +0000)] 
When PRAGMA writable_schema=ON, allow ALTER TABLE to proceed even if there
are entries in the sqlite_schema table that do not parse.

FossilOrigin-Name: fc4c82e5694cbdae13f2cb90e5368ba9f6b826a220a81de32ead2ffe1bc5f31f

3 years agoFix a NULL pointer dereference that can occur after OOM. Problem relaxed-alter-table
drh [Sat, 5 Feb 2022 12:05:43 +0000 (12:05 +0000)] 
Fix a NULL pointer dereference that can occur after OOM.  Problem
introduced by check-in [197cbabf1767d060].

FossilOrigin-Name: d4e6b9f0f7567b76760a667a701bca4d6158ade39f9a69d205b583c5a1c0c7f4

3 years agoFix documentation typo.
drh [Sat, 5 Feb 2022 11:13:26 +0000 (11:13 +0000)] 
Fix documentation typo.

FossilOrigin-Name: 1a7d8bb5ea0d0e0c250312f89a701c0274cfbcaef9cd71995fb83bf939668504

3 years agoTypo fixes in documentation.
drh [Sat, 5 Feb 2022 01:01:07 +0000 (01:01 +0000)] 
Typo fixes in documentation.

FossilOrigin-Name: 1ec747d1c34ced9877709dd306e674376e79145de08b9c316d12bc5e06efc03e

3 years agoTest case for permissive ALTER TABLE RENAME when writable_schema=ON.
drh [Fri, 4 Feb 2022 20:16:00 +0000 (20:16 +0000)] 
Test case for permissive ALTER TABLE RENAME when writable_schema=ON.

FossilOrigin-Name: 7ee44f66c896cdc7b6980811e8e4537dbd63b23060ead0104f25132d955890af

3 years agoOne more case of disabling errors for ALTER TABLE RENAME when
drh [Fri, 4 Feb 2022 20:07:24 +0000 (20:07 +0000)] 
One more case of disabling errors for ALTER TABLE RENAME when
writable_schema=ON.

FossilOrigin-Name: c52d0dd8f4f8fab4c3f33cbd26b4012569e76562282e85654018c836dca7b564

3 years agoAdd a compile-time option to include vt02.c in fuzzcheck.
drh [Fri, 4 Feb 2022 19:13:18 +0000 (19:13 +0000)] 
Add a compile-time option to include vt02.c in fuzzcheck.

FossilOrigin-Name: c404c8c72600c11b181519d269bf949aff304eaafb90a50d1415c6fe84d2b092

3 years agoAllow ALTER TABLE RENAME COLUMN to proceed even if there are errors in
drh [Fri, 4 Feb 2022 16:43:30 +0000 (16:43 +0000)] 
Allow ALTER TABLE RENAME COLUMN to proceed even if there are errors in
the schema, as long as PRAGMA writable_schema=ON is active.

FossilOrigin-Name: 197cbabf1767d0603928462fb75cf8100f6999f725e0db60d096c7ca20e3da28

3 years agoFix various harmless compiler warnings.
drh [Fri, 4 Feb 2022 13:15:01 +0000 (13:15 +0000)] 
Fix various harmless compiler warnings.

FossilOrigin-Name: 70049342d5ad57ea3e863bba19253934b868bacdd1c26c9371bac024a829badf

3 years agoFor the MULTI-INDEX-OR optimization, when pushing down WHERE clause terms from
drh [Fri, 4 Feb 2022 13:05:29 +0000 (13:05 +0000)] 
For the MULTI-INDEX-OR optimization, when pushing down WHERE clause terms from
the main query into the various OR-term subqueries, do not push down slices
of a vector comparison, since the right-hand operand of the comparison might
have only been initialized in a different OR branch that was not taken.
dbsqlfuzz 80a9fade844b4fb43564efc972bcb2c68270f5d1.

FossilOrigin-Name: 9f67ad00cd38b7c5ec6d14b379e1a611777bbdf6901d843a80712ba7d94d6d33

3 years agoMinor typo fix in comment. No code changes.
drh [Thu, 3 Feb 2022 18:14:22 +0000 (18:14 +0000)] 
Minor typo fix in comment. No code changes.

FossilOrigin-Name: f9b763042c5c4446115c5375a8e4731e522e36ad9fc53e9ef775de9bc297ea19

3 years agoDo not allow the vdbe-compress.tcl script to generate structures named
drh [Thu, 3 Feb 2022 14:37:06 +0000 (14:37 +0000)] 
Do not allow the vdbe-compress.tcl script to generate structures named
"do" or "if".

FossilOrigin-Name: e35ab16dd0fd40b07a71d26e1cdb19ef664a2a628a4abcb2e130f5e555de8ca9

3 years agoProhibit schema changes within xBestIndex callbacks.
drh [Thu, 3 Feb 2022 14:19:26 +0000 (14:19 +0000)] 
Prohibit schema changes within xBestIndex callbacks.

FossilOrigin-Name: bb0f056b3f2ecc3893e5e48e99c060788550ea6a8ed02b715953af051bafbad0

3 years agoImprovement to the sqlite3_vtab_in_first() documentation.
drh [Wed, 2 Feb 2022 21:06:40 +0000 (21:06 +0000)] 
Improvement to the sqlite3_vtab_in_first() documentation.

FossilOrigin-Name: 403e7ac900e53407282393747b784dc0cd4303958394534e3936fce138bc1bc5

3 years agoAdd the sqlite3_vtab_in() interface that allows virtual tables to process
drh [Wed, 2 Feb 2022 19:51:44 +0000 (19:51 +0000)] 
Add the sqlite3_vtab_in() interface that allows virtual tables to process
IN constraints all at once, rather than one value at a time.

FossilOrigin-Name: 52559af093809b572082b5ebaacf97b727ee1860ae118530761b62e937545163

3 years agoAdditional test cases. batch-in-operator
drh [Wed, 2 Feb 2022 19:30:24 +0000 (19:30 +0000)] 
Additional test cases.

FossilOrigin-Name: 733d81c3a6a513b0b893a7d14894f36aebbbca9da375c326db8a72df4f0c6238

3 years agoTest cases for sqlite3_vtab_in() and sqlite3_vtab_distinct().
drh [Wed, 2 Feb 2022 19:15:53 +0000 (19:15 +0000)] 
Test cases for sqlite3_vtab_in() and sqlite3_vtab_distinct().

FossilOrigin-Name: 21afb81d0a73af39aacd9329b1441faa2b535a52a52036daec89fd303a8b344f

3 years agoImproved documentation for sqlite3_vtab_in(). No code changes.
drh [Wed, 2 Feb 2022 18:47:56 +0000 (18:47 +0000)] 
Improved documentation for sqlite3_vtab_in().  No code changes.

FossilOrigin-Name: c99df4ab5db2c32b044366c5b0ac70fd8887d1456d53323e75fede23cc61c236

3 years agoRelax the restriction that the RHS of the IN operator must be a list in order
drh [Wed, 2 Feb 2022 16:24:01 +0000 (16:24 +0000)] 
Relax the restriction that the RHS of the IN operator must be a list in order
for sqlite3_vtab_in() to work.  Change an unreachable branch into an assert().

FossilOrigin-Name: 3bf2153440dce0e8c0572c4fd39e6b9f34ead75ccab2cea80a646d4ff9d19146

3 years agoBe sure that sqlite3_vtab_in_first() and _next() set the correct encoding.
drh [Wed, 2 Feb 2022 15:10:45 +0000 (15:10 +0000)] 
Be sure that sqlite3_vtab_in_first() and _next() set the correct encoding.

FossilOrigin-Name: 04edf36ee8e043c83235a5169a7ced23f211edd2f7ef3290d96413d5fd229ad7

3 years agoRefactor sqlite3_vtab_in() to make use of the existing
drh [Wed, 2 Feb 2022 14:36:58 +0000 (14:36 +0000)] 
Refactor sqlite3_vtab_in() to make use of the existing
sqlite3_value_pointer() mechanism for passing the list of IN operator
RHS values into xFilter, for improved memory safety.

FossilOrigin-Name: 8965929be236fe1a6994f31b94c1b7590c7c1e809470c542a76f3e0e275d032f

3 years agoFix a harmless code indentation issue.
drh [Wed, 2 Feb 2022 11:37:49 +0000 (11:37 +0000)] 
Fix a harmless code indentation issue.

FossilOrigin-Name: 41d8d26e48a440da44582763f6b0c097febe3b8ac16adb662f688c3662c301bf

3 years agoTweaks to the sqlite3_vtab_in() interface.
drh [Tue, 1 Feb 2022 21:59:43 +0000 (21:59 +0000)] 
Tweaks to the sqlite3_vtab_in() interface.

FossilOrigin-Name: 75040183b8e14f20bfedfdcc1a9fb968f2f0193bc698605d1b4791a3699b93d9

3 years agoIndex in 2nd argument to sqlite3_vtab_in() should be on the aConstraint[]
drh [Tue, 1 Feb 2022 16:30:57 +0000 (16:30 +0000)] 
Index in 2nd argument to sqlite3_vtab_in() should be on the aConstraint[]
array, not the internal array of all constraints.

FossilOrigin-Name: 5acf90a931b27b7d627c0a8fee68170430e09b028d6643b959b0ec14fd59f7ac

3 years agoAdd new interfaces to enable virtual table to process IN operator constraints
drh [Tue, 1 Feb 2022 14:58:29 +0000 (14:58 +0000)] 
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

3 years agoCLI: Take extra care to not split a multi-byte unicode character when doing
drh [Tue, 1 Feb 2022 13:17:11 +0000 (13:17 +0000)] 
CLI: Take extra care to not split a multi-byte unicode character when doing
wordwrap.

FossilOrigin-Name: 00b1b7020a564976da3237532434e47ccf17eb5d620e6ac45f3e70b5d5739200

3 years agoCLI: Add the --ww option as an alias for --wordwrap. Improve the wordwrap
drh [Tue, 1 Feb 2022 12:28:17 +0000 (12:28 +0000)] 
CLI: Add the --ww option as an alias for --wordwrap.  Improve the wordwrap
algorithm so that it breaks at punctuation if it cannot find space.  Always
wordwrap with --ww even if there is a .width setting for the column.

FossilOrigin-Name: 1b528e31f8c62797e0814568b520c0680ff23a2ee877ca6aa70a167d40ebdf80

3 years agoAdd "--wordwrap on/off" option for CLI columnar modes, qwbox shortcut
larrybr [Tue, 1 Feb 2022 02:50:45 +0000 (02:50 +0000)] 
Add "--wordwrap on/off" option for CLI columnar modes, qwbox shortcut

FossilOrigin-Name: 10dbc278708cd2cce7fef90738082dbe31750d93e44b5fa5413a9a32dae7703a

3 years agoCLI: In ".mode column" output, if any row contains a newline or wraps, then
drh [Tue, 1 Feb 2022 00:00:08 +0000 (00:00 +0000)] 
CLI: In ".mode column" output, if any row contains a newline or wraps, then
put a single blank line in between each pair of rows to provide additional
visual separately.

FossilOrigin-Name: fd42f4c304079356358e606dd96d4b84cf211c4334c586118b99fe9ad20e20ea

3 years agoCLI: for columnar output modes, make sure the header is not too big.
drh [Mon, 31 Jan 2022 22:14:53 +0000 (22:14 +0000)] 
CLI: for columnar output modes, make sure the header is not too big.
Also, improve the help text.

FossilOrigin-Name: 070fae3a09cea675e722340870cb2bee9e1ac96954d3baacfdb7f5400ddb1b20

3 years agoCLI: Fix a problem with tabs in the new qbox mode.
drh [Mon, 31 Jan 2022 20:39:27 +0000 (20:39 +0000)] 
CLI: Fix a problem with tabs in the new qbox mode.

FossilOrigin-Name: ca96ab3ef78479d95e831cacdb80f23c119cbaa77b3821eac7a3f110bfe20cc9

3 years agoFix harmless compiler warnings in MSVC.
drh [Mon, 31 Jan 2022 16:29:06 +0000 (16:29 +0000)] 
Fix harmless compiler warnings in MSVC.

FossilOrigin-Name: 3ec6141c41a71eea0d96a65aa35c828e4d852d60e090513c312b925d0e257f9a

3 years agoDo not attempt to limit the number of columns used in a table to a prefix
drh [Mon, 31 Jan 2022 15:59:43 +0000 (15:59 +0000)] 
Do not attempt to limit the number of columns used in a table to a prefix
if the table will be used to construct an automatic index or bloom filter.
dbsqlfuzz 787d9bd73164c6f0c85469e2e48b2aff19af6938.

FossilOrigin-Name: f8766231d2a77bb8b95726b514736d4c2d20b056f7fe60bdbc98ebf5e5b15ae9

3 years agoCLI: Enhancements to columnar output modes. (See
drh [Mon, 31 Jan 2022 14:14:29 +0000 (14:14 +0000)] 
CLI: Enhancements to columnar output modes.  (See
[forum/forumpost/5b53cd851f66441f9|forum post 5b53cd851] for discussion.)
New output mode "qbox".  New output options "--quote" and "--wrap N".

FossilOrigin-Name: 539cef5214446a7181614793e9cf323e95ba00ba0f888585b14b598dd2ff0808

3 years agoFix an obscure problem in sqlite3_backup_init() caused by
drh [Mon, 31 Jan 2022 12:29:14 +0000 (12:29 +0000)] 
Fix an obscure problem in sqlite3_backup_init() caused by
[6a45d8fe8bfbc11a|check-in 6a45d8fe8bfbc11a].  See
[forum:/forumpost/8b39fbf3e7b5c278|forum post 8b39fbf3e7] for
the original bug report.

FossilOrigin-Name: 639fc7633bd740421d6b48617b9f68e6be525107e4049673fe720ea6158a393f

3 years agoCLI: Fix the new ".mode box" output so that it works with unicode characters.
drh [Mon, 31 Jan 2022 10:55:50 +0000 (10:55 +0000)] 
CLI: Fix the new ".mode box" output so that it works with unicode characters.

FossilOrigin-Name: 454af48724c78bf8e06379a426e01b1597f56fcc83211ee062ff0dbeb6a140b1

3 years agoCLI: For columnar modes ("box", "column", "table", "markdown") the ".width"
drh [Sun, 30 Jan 2022 21:09:03 +0000 (21:09 +0000)] 
CLI: For columnar modes ("box", "column", "table", "markdown") the ".width"
is now both the minimum and maximum width of the column.  Text that spans
multiple lines or that contains tabs is properly formatted.  If any part of
the output contains multi-line text, then extra separators are provided between
each row.

FossilOrigin-Name: c10ed4a7fe33fd9330967ab714b1f09ad57c972997160dfc71477e43b905f69c

3 years agoAlways enable all JSON tests, now that JSON is included by default.
drh [Sun, 30 Jan 2022 11:44:17 +0000 (11:44 +0000)] 
Always enable all JSON tests, now that JSON is included by default.

FossilOrigin-Name: 8c9f350182140604a71e11d226acb3f80d1f2b4f75e5c3b55ec8f8a7c02941f3

3 years agoRemove a faulty NEVER(). Fix for dbsqlfuzz 4678cf825d27f87c9b8343720121e12cf944b71a
drh [Sun, 30 Jan 2022 11:42:56 +0000 (11:42 +0000)] 
Remove a faulty NEVER().  Fix for dbsqlfuzz 4678cf825d27f87c9b8343720121e12cf944b71a

FossilOrigin-Name: d4e402458dd4cadb623a30158eb9ff5f24f011240b3b1bc5b1d6ae3c5b855892

3 years agoDocumentation enhancements. No code changes.
drh [Sat, 29 Jan 2022 21:41:15 +0000 (21:41 +0000)] 
Documentation enhancements.  No code changes.

FossilOrigin-Name: 312642d982f7861fd4db416e5eb24d863535b3ade40539a32f2dfe3f6fc45d46

3 years agoAdd the SQLITE_INDEX_CONSTRAINT_LIMIT and SQLITE_INDEX_CONSTRAINT_OFFSET
drh [Fri, 28 Jan 2022 23:44:27 +0000 (23:44 +0000)] 
Add the SQLITE_INDEX_CONSTRAINT_LIMIT and SQLITE_INDEX_CONSTRAINT_OFFSET
constraints to the sqlite3_index_info for the xBestIndex method of virtual
tables.

FossilOrigin-Name: 1e227ad9f413227f767b45b91e5439b82c98a3368fb20643414dab5c0f4818c6

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 agoWhen nesting Parse objects, make sure the new one has nErr set if there
drh [Fri, 28 Jan 2022 21:39:29 +0000 (21:39 +0000)] 
When nesting Parse objects, make sure the new one has nErr set if there
has been an OOM error.

FossilOrigin-Name: ae088cbc968a565c3e0a8dd74ce150cac4a87978b593a3204f475fa196f1603c

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