]> git.ipfire.org Git - thirdparty/sqlite.git/log
thirdparty/sqlite.git
5 years agoDo not allow CREATE TABLE or CREATE VIEW of an object with a name that looks defensive-improvements
drh [Sat, 16 Nov 2019 14:15:19 +0000 (14:15 +0000)] 
Do not allow CREATE TABLE or CREATE VIEW of an object with a name that looks
like a shadow table name.

FossilOrigin-Name: 6aef58b629d89955f85f65191ba2be67b2adfac4f0327fe9a7141cb2705dbc00

5 years agoBreak out the test for writable shadow tables into a separate subroutine.
drh [Sat, 16 Nov 2019 13:51:31 +0000 (13:51 +0000)] 
Break out the test for writable shadow tables into a separate subroutine.

FossilOrigin-Name: 8ad34d36a141fa8f5d9bd784dfeb892c983897a6dc6b867607cc668508acf944

5 years agoDo not allow shadow tables to be dropped in defensive mode.
drh [Sat, 16 Nov 2019 12:04:38 +0000 (12:04 +0000)] 
Do not allow shadow tables to be dropped in defensive mode.

FossilOrigin-Name: 70390bbca49e706649ca5b7c031f0baf416fc38798c17e5f3b73746b3e66e3b5

5 years agoFix a potential NULL pointer dereference on a RENAME TABLE that references
drh [Sat, 16 Nov 2019 11:33:39 +0000 (11:33 +0000)] 
Fix a potential NULL pointer dereference on a RENAME TABLE that references
a VIEW with a logic error in a window function in the ORDER BY clause.

FossilOrigin-Name: 0adb273f7e7671efb0e0a1619887e369500dfd2db7ef1b1e125c2414ea96e96f

5 years agoModify three test cases so that they work even with unusual versions of the
drh [Fri, 15 Nov 2019 21:16:34 +0000 (21:16 +0000)] 
Modify three test cases so that they work even with unusual versions of the
library printf().

FossilOrigin-Name: 8f4a3750b7d272daf96831655ffee80d457875ee121fc4537008046b9a00d0e7

5 years agoFix table-valued functions so that they will work as the right table
drh [Fri, 15 Nov 2019 00:52:13 +0000 (00:52 +0000)] 
Fix table-valued functions so that they will work as the right table
in a LEFT JOIN.  Ticket [2ae0c599b735d59e]

FossilOrigin-Name: 2c35d3f67b67a53ead08b1c395e7ca8e5bf65f94a5a962a0562994a3c66c95d9

5 years agoAdd support for the sqlite3_hard_heap_limit64() interface and the
drh [Thu, 14 Nov 2019 18:07:28 +0000 (18:07 +0000)] 
Add support for the sqlite3_hard_heap_limit64() interface and the
hard_heap_limit pragma.

FossilOrigin-Name: 6399c47ea89c5766274bd6abdc9b6a85fe5b7f6c1078972c2f58e624bae59b7c

5 years agoFix a bug in the hard_heap_limit pragma so that it returns the new value of hard-heap-limit
drh [Thu, 14 Nov 2019 17:46:32 +0000 (17:46 +0000)] 
Fix a bug in the hard_heap_limit pragma so that it returns the new value of
the hard_heap_limit, not the soft_heap_limit.  Change SQLITE_MAX_MEMORY so
that it works by setting the default hard_heap_limit value.

FossilOrigin-Name: 33fd0c3abcad5555a150990a22d9c1bab99e79be01143fccb9fafc9b52cf92c8

5 years agoMerge recent enhancements from trunk.
drh [Thu, 14 Nov 2019 15:21:15 +0000 (15:21 +0000)] 
Merge recent enhancements from trunk.

FossilOrigin-Name: b8a631fd30d0732505679230684b3362c965438197a2b11518f01a77599c9202

5 years agoMinor documentation enhancements. No changes to code.
drh [Thu, 14 Nov 2019 15:10:48 +0000 (15:10 +0000)] 
Minor documentation enhancements.  No changes to code.

FossilOrigin-Name: 6153f3aada0cc9c5e773753797892ee78b518b0d76568382f5fbc9ee960f814c

5 years agoNew test cases added to fuzzdata8.db.
drh [Thu, 14 Nov 2019 13:57:15 +0000 (13:57 +0000)] 
New test cases added to fuzzdata8.db.

FossilOrigin-Name: 5baffcda7d5a42a99fa905faa834f14b94b1e2a26b5221f15d8ae8f1f5e3236a

5 years agoEnsure that the same subquery does not go through the window-function rewrite
drh [Thu, 14 Nov 2019 13:24:04 +0000 (13:24 +0000)] 
Ensure that the same subquery does not go through the window-function rewrite
more than once, even when that subquery is part of a virtual table constraint
that lacks the omit flag.

FossilOrigin-Name: d0bc7db6b0a53edc04815622c46250d26f526f56e59f14875f4e18c75b49000d

5 years agoAdd header guard to the expert extension.
mistachkin [Wed, 13 Nov 2019 18:50:36 +0000 (18:50 +0000)] 
Add header guard to the expert extension.

FossilOrigin-Name: 7e3151855fd4370fb7d4fff20516c2c2d1980134620df924106e6989bc130583

5 years agoFix the sqlite3TreeView() output to consistently use a colon and not a
drh [Wed, 13 Nov 2019 16:50:06 +0000 (16:50 +0000)] 
Fix the sqlite3TreeView() output to consistently use a colon and not a
comma after the table number in the AST dumps.

FossilOrigin-Name: fa2416f623d83fe93253137302a74fcd6cdd041da337a0756df344d7d09a19f5

5 years agoFor for the previous check-in: Always enable the nUri variable, even
drh [Tue, 12 Nov 2019 16:21:27 +0000 (16:21 +0000)] 
For for the previous check-in:  Always enable the nUri variable, even
when debugging is turned off.

FossilOrigin-Name: f84a15394c369cbdb6fba87c603a609722cf1f499626c7f20699060273ab5081

5 years agoEnsure that the main filename and the journal filenames in the pager
drh [Tue, 12 Nov 2019 14:43:47 +0000 (14:43 +0000)] 
Ensure that the main filename and the journal filenames in the pager
object are all correctly double-zero terminated.

FossilOrigin-Name: df51ae19c1aa4c26f2dcd427eddc1c9cc24b698e1ab0a948b198a57432e25e1e

5 years agoRemove a harmless unused variable.
drh [Tue, 12 Nov 2019 03:45:23 +0000 (03:45 +0000)] 
Remove a harmless unused variable.

FossilOrigin-Name: 28091a48aa6994f8d7c142b5851bcd6b4e9a93a7bbef6c927a6182d24f3245b4

5 years agoRemove an asm() block from build tool mksourceid.c, as it causes build failures on...
dan [Mon, 11 Nov 2019 15:13:11 +0000 (15:13 +0000)] 
Remove an asm() block from build tool mksourceid.c, as it causes build failures on some systems and performance is not important at build-time.

FossilOrigin-Name: 8e100e6c35c30e0d7e4014b9435f81f9f61ddab2386dfe9a4218d8190a6da3be

5 years agoProper surrogate pair decoding added to JSON functions. See the mailing list
drh [Sun, 10 Nov 2019 11:09:06 +0000 (11:09 +0000)] 
Proper surrogate pair decoding added to JSON functions.  See the mailing list
bug report and [https://bugs.python.org/issue38749].  More test cases
needed here, but it seems to work so far.

FossilOrigin-Name: 51027f08c0478f1bf9d7545d9e268c772c0a5cd5dda4b03d78f16c7d94f2f50d

5 years agoRemove an incorrect ALWAYS() macro.
drh [Sun, 10 Nov 2019 10:08:03 +0000 (10:08 +0000)] 
Remove an incorrect ALWAYS() macro.

FossilOrigin-Name: f7a74f89dbd58b47bbcb58ea2af71fbe1eb5ec2dbe36d90685c39cb28ecf5250

5 years agoChange the COLFLAG_NOTAVAIL bitmask so that it fits in the single-byte
drh [Sat, 9 Nov 2019 15:31:34 +0000 (15:31 +0000)] 
Change the COLFLAG_NOTAVAIL bitmask so that it fits in the single-byte
Walker.eCode field.

FossilOrigin-Name: 53847f5c28bdecfbc7b08685d4dcd0565526f6191491b4827c3c966a4b8d4a85

5 years agoNew dbsqlfuzz test cases added.
drh [Sat, 9 Nov 2019 14:44:18 +0000 (14:44 +0000)] 
New dbsqlfuzz test cases added.

FossilOrigin-Name: 18c3a17dc8c07b12427e372ff86668d5bcb6b34d653c46c48561ed576acefa5b

5 years agoMake sure the WITH stack in the Parse object is disabled following an error.
drh [Sat, 9 Nov 2019 14:38:58 +0000 (14:38 +0000)] 
Make sure the WITH stack in the Parse object is disabled following an error.

FossilOrigin-Name: de6e6d6846d6a41c4821454dfdc042096234df753be08c5567b79fe535d9b6ea

5 years agoWhen a virtual table reports orderByConsumed, that tells us nothing about
drh [Fri, 8 Nov 2019 20:13:44 +0000 (20:13 +0000)] 
When a virtual table reports orderByConsumed, that tells us nothing about
whether or not the SQLITE_DISTINCTBY constraint is met.
Fix for ticket [7e59041f9c4e5102].
Test cases in TH3.

FossilOrigin-Name: b59f94e4da9b1653f2004b214407a50340dd476b27e6ec7e29e501a95db9c963

5 years agoFix the xferCompatibleIndex() function so that it recognizes that a PRIMARY KEY
drh [Thu, 7 Nov 2019 14:51:24 +0000 (14:51 +0000)] 
Fix the xferCompatibleIndex() function so that it recognizes that a PRIMARY KEY
index for a WITHOUT ROWID table is different from a UNIQUE constraint index
on the primary key.  Ticket [302027baf1374498]

FossilOrigin-Name: 34f64f11ca481996b1ff1686bdc5e278946635b6856cd1fe2355fce8e298e0f8

5 years agoRestore generated column loop detection logic that was incorrectly removed
drh [Thu, 7 Nov 2019 02:32:54 +0000 (02:32 +0000)] 
Restore generated column loop detection logic that was incorrectly removed
from the previous check-in [9e07b48934e9a972].  This fixes ticket
[299b50ba812d8e54]

FossilOrigin-Name: 104a2beb57037f9353ffa77096aae0eb64e4682e667f31623bfd3d064dd8d881

5 years agoChange the way generated columns are computed so that no column is computed
drh [Wed, 6 Nov 2019 22:19:07 +0000 (22:19 +0000)] 
Change the way generated columns are computed so that no column is computed
inside branch code that might not be taken.  Ticket [4fc08501f4e56692]

FossilOrigin-Name: 9e07b48934e9a972dcf62e3538b3b21ffa044c553feba0441675ac0bbe13bcb2

5 years agoMinor simplification to the changes from check-in [36c11ad51f].
mistachkin [Wed, 6 Nov 2019 19:25:45 +0000 (19:25 +0000)] 
Minor simplification to the changes from check-in [36c11ad51f].

FossilOrigin-Name: 7bc8205dd9c1657c736a9c6a1a90dd9dad442accfbb77d296eaae2c09ab46bd1

5 years agoFix the OP_DeferredSeek index-to-table column map in P4 so that it works
drh [Wed, 6 Nov 2019 17:31:18 +0000 (17:31 +0000)] 
Fix the OP_DeferredSeek index-to-table column map in P4 so that it works
with generated columns.  Ticket [ce22a07731530118]

FossilOrigin-Name: 36c11ad51fe9ab1bde0b98d0ea9b8588e07d168cd8027486749372894941ad93

5 years agoFix the handling of NOT NULL constraint violations for generated columns in
drh [Wed, 6 Nov 2019 14:49:43 +0000 (14:49 +0000)] 
Fix the handling of NOT NULL constraint violations for generated columns in
a REPLACE statement.  Ticket [2399f5986134f79c]

FossilOrigin-Name: 77b1c90add514050fe62f22751362fecacd99f9775346cffc60e09c326e64e10

5 years agoChanges an unreachable testcase() into an assert().
drh [Mon, 4 Nov 2019 12:49:15 +0000 (12:49 +0000)] 
Changes an unreachable testcase() into an assert().

FossilOrigin-Name: 5710845b6314f924b490434b4446169f4bb50576aaa940472af68150db16e127

5 years agoFix a false-postive in the sqlite3ExprImpliesNonNullRow() decision routine,
drh [Mon, 4 Nov 2019 02:05:52 +0000 (02:05 +0000)] 
Fix a false-postive in the sqlite3ExprImpliesNonNullRow() decision routine,
that resulted in an incorrect LEFT JOIN strength reduction when the
WHERE clause contained a row-value comparison.
Ticket [02aa2bd02f97d0f2]

FossilOrigin-Name: ea20068e6d97c9349ebcc7d0a01e99ebf08c6f44363f71a0218a1abea209adc5

5 years agoThe optimization of check-in [9b2879629c34fc0a] is incorrectly reasoned.
drh [Sun, 3 Nov 2019 00:07:41 +0000 (00:07 +0000)] 
The optimization of check-in [9b2879629c34fc0a] is incorrectly reasoned.
The WHERE clause of the partial index might not be true if the table of
the partial index is the right table of a left join.  So disable the
optimization in that case.  Ticket [623eff57e76d45f6]

FossilOrigin-Name: 3be19e1151af1850b65991edb82420f9412a7798dd756c86eaa9ffdde573263a

5 years agoFix a problem in VIEW creation that was introduced by the generated columns
drh [Sat, 2 Nov 2019 17:59:10 +0000 (17:59 +0000)] 
Fix a problem in VIEW creation that was introduced by the generated columns
feature.

FossilOrigin-Name: 9c795c4d2b042d2932774bd1274fa0167ca2dc9838e127e0cf31eb9273a32f2c

5 years ago"STORED" is not actually a keyword. The parser looks for STORED as an
drh [Sat, 2 Nov 2019 13:45:03 +0000 (13:45 +0000)] 
"STORED" is not actually a keyword.  The parser looks for STORED as an
ordinary identifier.

FossilOrigin-Name: 167cd574d6a1d4fe2253f5bc5aaa7b031cbc82853e4d33b8d9b72eaf049003d4

5 years agoIn sqlite3GenerateIndexKey(), do not attempt to reuse column values from
drh [Sat, 2 Nov 2019 13:32:50 +0000 (13:32 +0000)] 
In sqlite3GenerateIndexKey(), do not attempt to reuse column values from
the previous index if the current index is a partial index as the partial
index test may have corrupted those values.  Ticket [a9efb42811fa41ee]

FossilOrigin-Name: 17e9f65814264de9c35bc5ba94e0a66fbbf1200c00d33ab9a19a0b6f92bc685a

5 years agoRestore the on-line ".help" for the ".explain" command in the CLI.
drh [Sat, 2 Nov 2019 00:00:14 +0000 (00:00 +0000)] 
Restore the on-line ".help" for the ".explain" command in the CLI.

FossilOrigin-Name: 28b8f1036d569bccce56b4e7042348024b5dd1ffa04850cbeddab1e35c49e5b7

5 years agoFix a harmless compiler warning.
drh [Fri, 1 Nov 2019 18:52:09 +0000 (18:52 +0000)] 
Fix a harmless compiler warning.

FossilOrigin-Name: f0ebea35d9d6b69a7bb4242fb79ff3db4267e429855fa6969f9f52ffee1c7a99

5 years agoThe SET DEFAULT and SET NULL conflict resolution actions for foreign key
drh [Fri, 1 Nov 2019 17:31:27 +0000 (17:31 +0000)] 
The SET DEFAULT and SET NULL conflict resolution actions for foreign key
constraints should cause an error when they appear on a generated column.

FossilOrigin-Name: b47513d2b32b61ba42c1e9b59287d28f6fee231e6c65de2a3aa19effbbaf1e7f

5 years agoFix a potential use-after-free bug that follows an OOM error in code
drh [Fri, 1 Nov 2019 16:37:53 +0000 (16:37 +0000)] 
Fix a potential use-after-free bug that follows an OOM error in code
added two days ago by check-in [84e02d773d60cffe].  Problem discovered
by OSSFuzz.

FossilOrigin-Name: 0a2eb949f8a759e5745d9468c8183d3c0b4b30e0fa2a14b3062620eb9e1d5c1d

5 years agoAdd another missing column number translation to the foreign key logic.
drh [Fri, 1 Nov 2019 16:08:20 +0000 (16:08 +0000)] 
Add another missing column number translation to the foreign key logic.

FossilOrigin-Name: 32df5edcfef2605009f45d6ef1b97c63a99df07c7b4e00dc70f93001cfb8d81f

5 years agoOmit the optimization that reduces the column-count on rowid-table cursors
drh [Fri, 1 Nov 2019 15:19:24 +0000 (15:19 +0000)] 
Omit the optimization that reduces the column-count on rowid-table cursors
when the table has generated columns, because we do not know what columns the
generator expressions might try to access.

FossilOrigin-Name: e6c96ed91e7a96d2bd30ea9df132644ac02d5a321a62f81f8f3984a8e49ed94b

5 years agoFix an fts3 assert() that could fail when operating on a database containing corrupt...
dan [Fri, 1 Nov 2019 13:37:26 +0000 (13:37 +0000)] 
Fix an fts3 assert() that could fail when operating on a database containing corrupt records.

FossilOrigin-Name: 7c52f5478f9ecf5c078208759143ae9de43c1bf191dfcd74acb8bd169d4dc883

5 years agoAdd missing column translations to foreign key logic.
drh [Fri, 1 Nov 2019 12:14:30 +0000 (12:14 +0000)] 
Add missing column translations to foreign key logic.
Ticket [c28a01da72f8957c]

FossilOrigin-Name: bc6a43e7ee6353b9ef3dea4309c77e170a1c798eefcfaa7636bf5a93e51c47ee

5 years agoFix a potential array bounds overflow in the mkkeywordhash.c code generator.
drh [Fri, 1 Nov 2019 10:49:15 +0000 (10:49 +0000)] 
Fix a potential array bounds overflow in the mkkeywordhash.c code generator.
Also add marks to omit keywords specific to generated columns when building
with -DSQLITE_OMIT_GENERATED_COLUMNS.

FossilOrigin-Name: cc6a40818387f78f89499f09e3f1c4655c7396af1cba2596c7fb2f23f3e9755f

5 years agoSlightly faster keyword hash table.
drh [Fri, 1 Nov 2019 02:30:54 +0000 (02:30 +0000)] 
Slightly faster keyword hash table.

FossilOrigin-Name: f12e743e19a04ecbf7eb69b675082f2e4dda05b38cd81f6588a1ce95dfc57ada

5 years agoCorrectly generate pre-UPDATE content for virtual columns that are used
drh [Thu, 31 Oct 2019 20:54:20 +0000 (20:54 +0000)] 
Correctly generate pre-UPDATE content for virtual columns that are used
by foreign key constraints.  Ticket [b9befa4b83a660cc]

FossilOrigin-Name: 40d3282ec285d9f724f6548283f48b601510cf5284da17485723fd650a68f436

5 years agoAdd a few simple TCL test cases for generated columns. (Full test coverage
drh [Thu, 31 Oct 2019 17:13:17 +0000 (17:13 +0000)] 
Add a few simple TCL test cases for generated columns.  (Full test coverage
of the generated column logic is provided separately by TH3.)

FossilOrigin-Name: acedb5c7f7dc1d68bef62098d42ca59e1be7a5083bb03dc07c03b9f9d817158b

5 years agoIgnore differences in Expr.op2 in sqlite3ExprCompare() in cases where it
drh [Thu, 31 Oct 2019 13:16:26 +0000 (13:16 +0000)] 
Ignore differences in Expr.op2 in sqlite3ExprCompare() in cases where it
does matter.  Ticket [1d2a8efc6c3a595a].

FossilOrigin-Name: 329820673a12ff6a6c8759f40989d4ccf272441064b0366a5f491695b55ad0e9

5 years agoEnhance the TreeView logic to show information about Expr.op2 for
drh [Thu, 31 Oct 2019 12:30:38 +0000 (12:30 +0000)] 
Enhance the TreeView logic to show information about Expr.op2 for
FUNCTION and COLUMN nodes.

FossilOrigin-Name: aceeaf9e28767a0880a16872867a1f57bff163acd0f10d19d5688068077590fa

5 years agoAlways disallow the use of non-deterministic functions in CHECK constraints,
drh [Wed, 30 Oct 2019 18:50:08 +0000 (18:50 +0000)] 
Always disallow the use of non-deterministic functions in CHECK constraints,
even date/time functions that use the 'now' or similar keywords.  Provide
improved error messages when this requirement is not met.
Ticket [830277d9db6c3ba1]

FossilOrigin-Name: 2978b65ebe25eeabe543b67cb266308cceb20082a4ae71565d6d083d7c08bc9f

5 years agoSimplify the bytecode generation for SQL function calls such that the
drh [Wed, 30 Oct 2019 16:29:02 +0000 (16:29 +0000)] 
Simplify the bytecode generation for SQL function calls such that the
OP_Function or OP_PureFunc opcodes are coded directly, rather than using
the intermediate OP_Function0 or OP_PureFunc0 - opcodes that are now removed.

FossilOrigin-Name: 84e02d773d60cffe619104991d21d7f0c68616c0f6bb99686bf54f5306c756d0

5 years agoNew tokens ALWAYS, GENERATED, and STORED used by generated columns should
drh [Wed, 30 Oct 2019 13:00:23 +0000 (13:00 +0000)] 
New tokens ALWAYS, GENERATED, and STORED used by generated columns should
all be fallback tokens.

FossilOrigin-Name: 13fe6978b7de208d2e27460d824f7fc778cf6ea0aabfe566b32bb410b8816f63

5 years agoRemove the legacy_file_format PRAGMA. In its place, provide the
drh [Tue, 29 Oct 2019 16:18:45 +0000 (16:18 +0000)] 
Remove the legacy_file_format PRAGMA.  In its place, provide the
SQLITE_DBCONFIG_LEGACY_FILE_FORMAT option to sqlite3_db_config().
Fix for ticket [6484e6ce678fffab]

FossilOrigin-Name: 4d424f3047b48fc441475137f30a719d2f079390c86fe2617710ddfb05c5e240

5 years agoTighten the generated column requirement such that every table must have
drh [Tue, 29 Oct 2019 03:39:17 +0000 (03:39 +0000)] 
Tighten the generated column requirement such that every table must have
at least one non-generated column.  Ticket [166347c6fc994155].

FossilOrigin-Name: 4fba090e678ef184736277c9ec9a9374c8bd4df4d41f51a3dc6818e2efcc103b

5 years agoAdd a missing translation from table column numbers to storage table numbers
drh [Tue, 29 Oct 2019 03:30:26 +0000 (03:30 +0000)] 
Add a missing translation from table column numbers to storage table numbers
while processing constraints on an UPDATE statement.
Ticket [9621dd78a024d07a]

FossilOrigin-Name: 361ea81ae8a13e7d2ec4c2412f30e049bb6ee320980d502c86bedc315cdd3bc0

5 years agoDisallow tables that have only virtual columns.
drh [Tue, 29 Oct 2019 01:26:24 +0000 (01:26 +0000)] 
Disallow tables that have only virtual columns.

FossilOrigin-Name: 591973217f1caf24cde91dc15b7edca2edda05dac8ae2b2cd8d71e7aa072f7d1

5 years agoFix a problem in fts3 causing it to report corruption if a doclist contains consectut...
dan [Mon, 28 Oct 2019 13:54:59 +0000 (13:54 +0000)] 
Fix a problem in fts3 causing it to report corruption if a doclist contains consectutive rowid entries that differ by more than 2^63.

FossilOrigin-Name: 0b0a3048f9df88bbc8979f2ac5247bee7d7bc1e585faca252610d2fcbe36d51d

5 years agoRemove a NEVER() comparison from sqlite3ExprCompare().
drh [Mon, 28 Oct 2019 13:07:01 +0000 (13:07 +0000)] 
Remove a NEVER() comparison from sqlite3ExprCompare().

FossilOrigin-Name: f4285297e1e7ebef90bfc0f71402a4e1726d31bc15b69fec13a1f0d98fed1f08

5 years agoALWAYS macro added for coverage.
drh [Mon, 28 Oct 2019 04:20:28 +0000 (04:20 +0000)] 
ALWAYS macro added for coverage.

FossilOrigin-Name: a1e1ba9145049491c593ac70d9e05149662d34770129c270d702f284cd19a481

5 years agoImproved detection of attempts to use a generated column as part of the
drh [Sun, 27 Oct 2019 22:22:24 +0000 (22:22 +0000)] 
Improved detection of attempts to use a generated column as part of the
primary key.  Ticket [91e86951016a6802]

FossilOrigin-Name: 6d1bbba9a004a2491c76b4a7d09edb9b738102c46fdcb3e0f7b22bffa719518e

5 years agoRemove code from the constraint checker that generates virtual column values
drh [Sat, 26 Oct 2019 23:51:44 +0000 (23:51 +0000)] 
Remove code from the constraint checker that generates virtual column values
with the incorrect time.  Turns out the the regular code for all other
columns works correctly and so the incorrect special-case code is not
actually needed.  Fix for ticket [3ea175512444b0d1].

FossilOrigin-Name: 5b4c0f2ddc6f324e23bbde0ee3d1ab672cfe8ab5044c9b693f4c33cdd75c211e

5 years agoRemove redundant code resulting from a merge error on the previous check-in.
drh [Sat, 26 Oct 2019 18:56:12 +0000 (18:56 +0000)] 
Remove redundant code resulting from a merge error on the previous check-in.

FossilOrigin-Name: 713fe86b8c9f3c9ef8af952019e99ba2f4741326226264de6a66baaeb1803d2a

5 years agoAdd support for generated columns.
drh [Sat, 26 Oct 2019 18:47:47 +0000 (18:47 +0000)] 
Add support for generated columns.

FossilOrigin-Name: b855acf1831943b3914491ed0bc333131321930cab480a5281012a3aebbba492

5 years agoPerformance optimization on sqlite3GenerateConstraintChecks() - bypass the
drh [Sat, 26 Oct 2019 17:08:06 +0000 (17:08 +0000)] 
Performance optimization on sqlite3GenerateConstraintChecks() - bypass the
loop that checks each column for NOT NULL constraints if it is known in
advance that the table has no NOT NULL constraints.

FossilOrigin-Name: e3c3f4d7872f431a95627d52553101388c1e39458cc7e7f93fc81255f49a89a5

5 years agoClarify some comments and add assert() and testcase() macros to the
drh [Sat, 26 Oct 2019 16:38:49 +0000 (16:38 +0000)] 
Clarify some comments and add assert() and testcase() macros to the
replace-trigger recheck logic for ticket [c1e19e12046d23fe]

FossilOrigin-Name: 8c0042bd5ccd83f8794d19cbb1ec7564584f0dce54bfebc0ada00b836aca065f

5 years agoFix a problem in the legacy ".explain on" formatting when it is used on
drh [Sat, 26 Oct 2019 16:02:34 +0000 (16:02 +0000)] 
Fix a problem in the legacy ".explain on" formatting when it is used on
a query with more than 8 output columns.

FossilOrigin-Name: 070b49825c5f87cce15be4b758f0dfdd65226ec379465ca527a18706a1f3b8f4

5 years agoMinor changes to help ensure the pointer returned by sqlite3VdbeGetOp() is
drh [Sat, 26 Oct 2019 15:40:17 +0000 (15:40 +0000)] 
Minor changes to help ensure the pointer returned by sqlite3VdbeGetOp() is
not used after it becomes invalid.

FossilOrigin-Name: 346bdd49fb93aa58e8bd14250974d8c0c32cc7e8317c8b12da1fa44db10d8a3a

5 years agoOvernight, OSSFuzz helpfully pointed out a potential use-after-free bug in
drh [Sat, 26 Oct 2019 12:27:55 +0000 (12:27 +0000)] 
Overnight, OSSFuzz helpfully pointed out a potential use-after-free bug in
yesterdays changes, involving continued use of a pointer after the memory
pointed to had been realloc()-ed.  Thanks Google.

FossilOrigin-Name: c422afb507dc875751e6a72e4ba5f4f0793097c0de4533c1600311f689e76ed7

5 years agoAdd missing VdbeCoverage() macro. Fix an off-by-one error in partial index
drh [Sat, 26 Oct 2019 01:43:14 +0000 (01:43 +0000)] 
Add missing VdbeCoverage() macro.  Fix an off-by-one error in partial index
handling.  New test cases.  Ticket [c1e19e12046d23fe]

FossilOrigin-Name: 41cc8e3dab998f7efc898d18837ca7fdac94ea3f89954990c5231456bf725fee

5 years agoIf replace triggers are run during uniqueness checking, then rerun all
drh [Sat, 26 Oct 2019 00:04:21 +0000 (00:04 +0000)] 
If replace triggers are run during uniqueness checking, then rerun all
uniqueness checks a second time using the ABORT algorithm.
Fix for ticket [c1e19e12046d23fe]

FossilOrigin-Name: fbac0c65d8464b126d385262d176864add55452ec9e3d5eb76ffee06e820cb9c

5 years agoPerformance optimization in sqlite3BtreeCursor().
drh [Fri, 25 Oct 2019 14:46:05 +0000 (14:46 +0000)] 
Performance optimization in sqlite3BtreeCursor().

FossilOrigin-Name: ea068b099c96b8b9526114732d2a6be186cf381b7329d102778ad25b95510c9e

5 years agoMerge fixes from trunk. generated-columns
drh [Thu, 24 Oct 2019 23:43:32 +0000 (23:43 +0000)] 
Merge fixes from trunk.

FossilOrigin-Name: 4ec57d88415fa4ea2e99d4a5671074ec6829d6824bc8509d5ae9c978d47d1419

5 years agoThe previous fix was incomplete. It is also necessary to disable the
drh [Thu, 24 Oct 2019 21:02:06 +0000 (21:02 +0000)] 
The previous fix was incomplete.  It is also necessary to disable the
Expr.y.pTab field when making the translation.

FossilOrigin-Name: b99d5701312f7472e6b606bd824f9273617e2655920485bf50aa96d408064721

5 years agoIn fts5, fix a case of overreading a buffer by 1 byte when counting characters in...
dan [Thu, 24 Oct 2019 20:35:27 +0000 (20:35 +0000)] 
In fts5, fix a case of overreading a buffer by 1 byte when counting characters in malformed utf-8. Fix for [dd1f67bf].

FossilOrigin-Name: 8d964e1c21d4cea699023e02b0616a75c5859dd083c9365cdcbc0676ebbdaae4

5 years agoFix handling of covering indexes that use virtual columns.
drh [Thu, 24 Oct 2019 20:29:25 +0000 (20:29 +0000)] 
Fix handling of covering indexes that use virtual columns.

FossilOrigin-Name: e0f7e321eca91c49102649f70728de69347cbd7b16599b854203c24cfdc348e6

5 years agoCorrection to check-in [bec5b6d4d083556d] so that it detects *all*
drh [Thu, 24 Oct 2019 19:35:26 +0000 (19:35 +0000)] 
Correction to check-in [bec5b6d4d083556d] so that it detects *all*
triggers that might perturb the insertion cursor.
Ticket [50c09fc2cf0d91ce].

FossilOrigin-Name: 521f1d36282549488a47a434484a24924ee970d29f05a8ae499b7d536bcd692b

5 years agoDo not allow ALTER TABLE ADD COLUMN for a STORED column.
drh [Thu, 24 Oct 2019 01:04:10 +0000 (01:04 +0000)] 
Do not allow ALTER TABLE ADD COLUMN for a STORED column.

FossilOrigin-Name: 42fc08bc1528a34a603c2c085b515766a8d33ae7ea0350a52b0ca24b94ebcbc5

5 years agoAdd an experimental set of UUID processing functions as the uuid.c
drh [Wed, 23 Oct 2019 21:00:40 +0000 (21:00 +0000)] 
Add an experimental set of UUID processing functions as the uuid.c
extension in ext/misc/uuid.c.

FossilOrigin-Name: 1a6e009372cf9571e540812c8607e95a86740112a1091f03e3f632339eccb629

5 years agoWhen a vector comparison appears in the WHERE clause and the constraint side
drh [Wed, 23 Oct 2019 18:09:39 +0000 (18:09 +0000)] 
When a vector comparison appears in the WHERE clause and the constraint side
has a COLLATE clause on the first term of the vector, be sure to honor that
COLLATE clause.  Ticket [135c9da7513e5a97].

FossilOrigin-Name: 978b2d20cf95d0b7143e3104ce1e9d5c85002867b554dc6b21deb528b730bbc7

5 years agoMinor adjustments for clarity and test coverage.
drh [Wed, 23 Oct 2019 15:47:33 +0000 (15:47 +0000)] 
Minor adjustments for clarity and test coverage.

FossilOrigin-Name: 30065716878d4058e75eb510b0b27b68e5193d04625eb173210de8061f20f499

5 years agoFix incorrect arguments to testcase() macros.
drh [Wed, 23 Oct 2019 03:53:10 +0000 (03:53 +0000)] 
Fix incorrect arguments to testcase() macros.

FossilOrigin-Name: 812467fbf04ce00228a8381a5eee471e4e35cc63184a4538129fcd70b7cec979

5 years agoFix the foreign key logic to be compatible with generated columns.
drh [Wed, 23 Oct 2019 00:31:01 +0000 (00:31 +0000)] 
Fix the foreign key logic to be compatible with generated columns.

FossilOrigin-Name: 3de57145a18c62ff9b556c7218d8b276000d0052e4890212fa9335235f22d03c

5 years agoTake the declared column time into account when computing the values for
drh [Tue, 22 Oct 2019 21:01:34 +0000 (21:01 +0000)] 
Take the declared column time into account when computing the values for
generated columns, and apply appropriate affinity.

FossilOrigin-Name: 9e04ba22dfce3998e61331ac229ff543ecccc590284c9dd5def21efbe594fba0

5 years agoMerge the row-value fix from trunk.
drh [Tue, 22 Oct 2019 20:16:04 +0000 (20:16 +0000)] 
Merge the row-value fix from trunk.

FossilOrigin-Name: 1fbd7438611174aa594485241c8cc2f4ea6d09c57ef2fc16c8995e8061fdfdd6

5 years agoDisqualify row-value comparisons for use by an index if the right-hand side
drh [Tue, 22 Oct 2019 19:51:29 +0000 (19:51 +0000)] 
Disqualify row-value comparisons for use by an index if the right-hand side
has an affinity that does not match the index.
Fix for ticket [6ef984af8972c2eb]

FossilOrigin-Name: 5c118617cf08e17a6edfdfba86e3fc49132a780990b68b52724c2aaeac85f506

5 years agoDo not allow generated columns in the PRIMARY KEY.
drh [Tue, 22 Oct 2019 15:45:03 +0000 (15:45 +0000)] 
Do not allow generated columns in the PRIMARY KEY.

FossilOrigin-Name: 1a54743a3d327efc8ecc45b9fde91ddfea3fca36408f9b753453c31f2e4cc69c

5 years agoIn UPDATE processing, include generated columns in the set of columns being
drh [Tue, 22 Oct 2019 13:59:23 +0000 (13:59 +0000)] 
In UPDATE processing, include generated columns in the set of columns being
updated if and only if their generator expressions reference some other
column that is being updated.

FossilOrigin-Name: d38176e93a628e03f1bd8b689fbc4152a1495388da917c2d89cefed04353d2d6

5 years agoNew testcase() macros. Fix a problem with INSERT when the IPK is to the
drh [Tue, 22 Oct 2019 13:01:24 +0000 (13:01 +0000)] 
New testcase() macros.  Fix a problem with INSERT when the IPK is to the
right of generated columns.

FossilOrigin-Name: 412799fc5527aaca987e4e04b8a4f774dcdb70fb80e3a126dc3a26d48a66935c

5 years agoMerge changes on trunk into the generated-columns branch.
drh [Tue, 22 Oct 2019 12:02:09 +0000 (12:02 +0000)] 
Merge changes on trunk into the generated-columns branch.

FossilOrigin-Name: ba123b8c201053d8f9387de38f3513b06f7721b28d79fab8489f96d336105117

5 years agoPrevious check-in to fix [b47e3627ecaadbde] was incomplete. This check-in
drh [Tue, 22 Oct 2019 11:29:22 +0000 (11:29 +0000)] 
Previous check-in to fix [b47e3627ecaadbde] was incomplete.  This check-in
completes the fix and adds a test cases.

FossilOrigin-Name: c7da1c01f1f239e68c2173ac5748b8c5798271e43bdcee68f51f97cd0ca92bd5

5 years agoMove the sqlite3LocateCollSeq(), sqlite3FindCollSeq(), and
drh [Tue, 22 Oct 2019 01:00:16 +0000 (01:00 +0000)] 
Move the sqlite3LocateCollSeq(), sqlite3FindCollSeq(), and
sqlite3GetCollSeq() routines so that they are all beside one another in
the callback.c source file.  No logic changes.

FossilOrigin-Name: 9ff80a9bf8fee776e2f282d0597215b77d48093ebc71d047ad1457da0582ddbc

5 years agoWhen flipping ("commuting") a comparison operator, set the new EP_Commuted
drh [Tue, 22 Oct 2019 00:03:41 +0000 (00:03 +0000)] 
When flipping ("commuting") a comparison operator, set the new EP_Commuted
bit rather than adding extra EP_Collate bits, to single later processing that
the order of precedence for COLLATE operators is inverted.
Fix for ticket [b47e3627ecaadbde]

FossilOrigin-Name: 90f7c477354d67d22d5eb0da22dac579f384ab44743fdc19887220e32203ebc2

5 years agoAdd a VdbeCoverage() macro that was omitted from check-in [eea1e7aa57e74c43].
drh [Mon, 21 Oct 2019 23:41:56 +0000 (23:41 +0000)] 
Add a VdbeCoverage() macro that was omitted from check-in [eea1e7aa57e74c43].

FossilOrigin-Name: cd2317d04c1c4bcf5fe63aa02a6051bdfae8f5566a098e3f45bf9ec1dd0c3ea6

5 years agoTry to fix a harmless compiler warning reported by ICC.
drh [Mon, 21 Oct 2019 16:15:57 +0000 (16:15 +0000)] 
Try to fix a harmless compiler warning reported by ICC.

FossilOrigin-Name: 7f41b44ca2ecb907ea0fd09a974ac9dbdf911463a94f0f77c826cf1b1d9c3e8c

5 years agoChanges to the INSERT logic to make it simpler and faster and so that
drh [Mon, 21 Oct 2019 01:04:11 +0000 (01:04 +0000)] 
Changes to the INSERT logic to make it simpler and faster and so that
it works with generated columns and BEFORE triggers.

FossilOrigin-Name: bc368cb090376d33d3844e3689c4f6bd19eed758e39b878ee67fef93b1c839ea

5 years agoFix a resource leak in fts5 that could occur if an auxiliary function is called from...
dan [Sun, 20 Oct 2019 08:26:08 +0000 (08:26 +0000)] 
Fix a resource leak in fts5 that could occur if an auxiliary function is called from within a query that does not use the full-text index.

FossilOrigin-Name: b528bdcd45db1b783ecd9739c3d3c890f04de7003f079668970eafaf8e23b2f3

5 years agoWork toward getting generated columns to work with triggers. Still more
drh [Sat, 19 Oct 2019 18:47:27 +0000 (18:47 +0000)] 
Work toward getting generated columns to work with triggers.  Still more
work to do in this area.

FossilOrigin-Name: 932a37275d7e932f8237d32c8fc6087ed8cd342fe01ef2f7a43c7237ab84c9ac

5 years agoAdd testcase macros.
drh [Sat, 19 Oct 2019 15:01:52 +0000 (15:01 +0000)] 
Add testcase macros.

FossilOrigin-Name: fb9c9bb284d441bd7aa34c87b6fd8ce57d036c17623d82354154fc6286bdd134

5 years agoRefactor names of column index transformation functions, for clarity.
drh [Sat, 19 Oct 2019 13:29:10 +0000 (13:29 +0000)] 
Refactor names of column index transformation functions, for clarity.
Get generated columns working with ALTER TABLE RENAME COLUMN.

FossilOrigin-Name: 27ab41c9102e7801ff829488fc123a8040da008bef373d6704efbe2f93e1da90