Commit Graph

21180 Commits

Author SHA1 Message Date
drh
746461f1b8 Ensure that the main filename and the journal filenames in the pager
object are all correctly double-zero terminated.

FossilOrigin-Name: df51ae19c1aa4c26f2dcd427eddc1c9cc24b698e1ab0a948b198a57432e25e1e
2019-11-12 14:43:47 +00:00
drh
4c8056079f Remove a harmless unused variable.
FossilOrigin-Name: 28091a48aa6994f8d7c142b5851bcd6b4e9a93a7bbef6c927a6182d24f3245b4
2019-11-12 03:45:23 +00:00
dan
a3b75e982a 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
2019-11-11 15:13:11 +00:00
drh
48eb03bd0e 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
2019-11-10 11:09:06 +00:00
drh
9576802dba Remove an incorrect ALWAYS() macro.
FossilOrigin-Name: f7a74f89dbd58b47bbcb58ea2af71fbe1eb5ec2dbe36d90685c39cb28ecf5250
2019-11-10 10:08:03 +00:00
drh
12bf712707 Change the COLFLAG_NOTAVAIL bitmask so that it fits in the single-byte
Walker.eCode field.

FossilOrigin-Name: 53847f5c28bdecfbc7b08685d4dcd0565526f6191491b4827c3c966a4b8d4a85
2019-11-09 15:31:34 +00:00
drh
675f73bcab New dbsqlfuzz test cases added.
FossilOrigin-Name: 18c3a17dc8c07b12427e372ff86668d5bcb6b34d653c46c48561ed576acefa5b
2019-11-09 14:44:18 +00:00
drh
46a31cdf6b Make sure the WITH stack in the Parse object is disabled following an error.
FossilOrigin-Name: de6e6d6846d6a41c4821454dfdc042096234df753be08c5567b79fe535d9b6ea
2019-11-09 14:38:58 +00:00
drh
ff1032e5c2 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
2019-11-08 20:13:44 +00:00
drh
1e7c00e695 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
2019-11-07 14:51:24 +00:00
drh
4e8e533bf7 Restore generated column loop detection logic that was incorrectly removed
from the previous check-in [9e07b48934e9a972].  This fixes ticket
[299b50ba812d8e54]

FossilOrigin-Name: 104a2beb57037f9353ffa77096aae0eb64e4682e667f31623bfd3d064dd8d881
2019-11-07 02:32:54 +00:00
drh
dfa15270c4 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
2019-11-06 22:19:07 +00:00
mistachkin
bde3a4f680 Minor simplification to the changes from check-in [36c11ad51f].
FossilOrigin-Name: 7bc8205dd9c1657c736a9c6a1a90dd9dad442accfbb77d296eaae2c09ab46bd1
2019-11-06 19:25:45 +00:00
drh
4fb24c82cd Fix the OP_DeferredSeek index-to-table column map in P4 so that it works
with generated columns.  Ticket [ce22a07731530118]

FossilOrigin-Name: 36c11ad51fe9ab1bde0b98d0ea9b8588e07d168cd8027486749372894941ad93
2019-11-06 17:31:18 +00:00
drh
b1129c423f Fix the handling of NOT NULL constraint violations for generated columns in
a REPLACE statement.  Ticket [2399f5986134f79c]

FossilOrigin-Name: 77b1c90add514050fe62f22751362fecacd99f9775346cffc60e09c326e64e10
2019-11-06 14:49:43 +00:00
drh
06fc24555f Changes an unreachable testcase() into an assert().
FossilOrigin-Name: 5710845b6314f924b490434b4446169f4bb50576aaa940472af68150db16e127
2019-11-04 12:49:15 +00:00
drh
6c68d7592f 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
2019-11-04 02:05:52 +00:00
drh
db535390db 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
2019-11-03 00:07:41 +00:00
drh
0383661414 Fix a problem in VIEW creation that was introduced by the generated columns
feature.

FossilOrigin-Name: 9c795c4d2b042d2932774bd1274fa0167ca2dc9838e127e0cf31eb9273a32f2c
2019-11-02 17:59:10 +00:00
drh
089c4bc2e2 "STORED" is not actually a keyword. The parser looks for STORED as an
ordinary identifier.

FossilOrigin-Name: 167cd574d6a1d4fe2253f5bc5aaa7b031cbc82853e4d33b8d9b72eaf049003d4
2019-11-02 13:45:03 +00:00
drh
39b30a7d6b 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
2019-11-02 13:32:50 +00:00
drh
978256f3d8 Restore the on-line ".help" for the ".explain" command in the CLI.
FossilOrigin-Name: 28b8f1036d569bccce56b4e7042348024b5dd1ffa04850cbeddab1e35c49e5b7
2019-11-02 00:00:14 +00:00
drh
9c6a92982f Fix a harmless compiler warning.
FossilOrigin-Name: f0ebea35d9d6b69a7bb4242fb79ff3db4267e429855fa6969f9f52ffee1c7a99
2019-11-01 18:52:09 +00:00
drh
bc4974c81b 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
2019-11-01 17:31:27 +00:00
drh
f2b9d7c605 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
2019-11-01 16:37:53 +00:00
drh
dc2e331ab2 Add another missing column number translation to the foreign key logic.
FossilOrigin-Name: 32df5edcfef2605009f45d6ef1b97c63a99df07c7b4e00dc70f93001cfb8d81f
2019-11-01 16:08:20 +00:00
drh
1a9082f6d7 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
2019-11-01 15:19:24 +00:00
dan
b1c479b61d Fix an fts3 assert() that could fail when operating on a database containing corrupt records.
FossilOrigin-Name: 7c52f5478f9ecf5c078208759143ae9de43c1bf191dfcd74acb8bd169d4dc883
2019-11-01 13:37:26 +00:00
drh
f09a14fbc3 Add missing column translations to foreign key logic.
Ticket [c28a01da72f8957c]

FossilOrigin-Name: bc6a43e7ee6353b9ef3dea4309c77e170a1c798eefcfaa7636bf5a93e51c47ee
2019-11-01 12:14:30 +00:00
drh
e7d9814fe4 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
2019-11-01 10:49:15 +00:00
drh
bd0f0eb037 Slightly faster keyword hash table.
FossilOrigin-Name: f12e743e19a04ecbf7eb69b675082f2e4dda05b38cd81f6588a1ce95dfc57ada
2019-11-01 02:30:54 +00:00
drh
ff37c40787 Correctly generate pre-UPDATE content for virtual columns that are used
by foreign key constraints.  Ticket [b9befa4b83a660cc]

FossilOrigin-Name: 40d3282ec285d9f724f6548283f48b601510cf5284da17485723fd650a68f436
2019-10-31 20:54:20 +00:00
drh
29974f7b91 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
2019-10-31 17:13:17 +00:00
drh
04307c8a3f Ignore differences in Expr.op2 in sqlite3ExprCompare() in cases where it
does matter.  Ticket [1d2a8efc6c3a595a].

FossilOrigin-Name: 329820673a12ff6a6c8759f40989d4ccf272441064b0366a5f491695b55ad0e9
2019-10-31 13:16:26 +00:00
drh
d493353e99 Enhance the TreeView logic to show information about Expr.op2 for
FUNCTION and COLUMN nodes.

FossilOrigin-Name: aceeaf9e28767a0880a16872867a1f57bff163acd0f10d19d5688068077590fa
2019-10-31 12:30:38 +00:00
drh
20cee7d0bb 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
2019-10-30 18:50:08 +00:00
drh
920cf596e6 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
2019-10-30 16:29:02 +00:00
drh
9ee94147f0 New tokens ALWAYS, GENERATED, and STORED used by generated columns should
all be fallback tokens.

FossilOrigin-Name: 13fe6978b7de208d2e27460d824f7fc778cf6ea0aabfe566b32bb410b8816f63
2019-10-30 13:00:23 +00:00
drh
66c48907a2 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
2019-10-29 16:18:45 +00:00
drh
f4658b68fa Tighten the generated column requirement such that every table must have
at least one non-generated column.  Ticket [166347c6fc994155].

FossilOrigin-Name: 4fba090e678ef184736277c9ec9a9374c8bd4df4d41f51a3dc6818e2efcc103b
2019-10-29 03:39:17 +00:00
drh
b6d861e523 Add a missing translation from table column numbers to storage table numbers
while processing constraints on an UPDATE statement.
Ticket [9621dd78a024d07a]

FossilOrigin-Name: 361ea81ae8a13e7d2ec4c2412f30e049bb6ee320980d502c86bedc315cdd3bc0
2019-10-29 03:30:26 +00:00
drh
2c40a3eb35 Disallow tables that have only virtual columns.
FossilOrigin-Name: 591973217f1caf24cde91dc15b7edca2edda05dac8ae2b2cd8d71e7aa072f7d1
2019-10-29 01:26:24 +00:00
dan
9930cfe878 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
2019-10-28 13:54:59 +00:00
drh
0f28e1bdd9 Remove a NEVER() comparison from sqlite3ExprCompare().
FossilOrigin-Name: f4285297e1e7ebef90bfc0f71402a4e1726d31bc15b69fec13a1f0d98fed1f08
2019-10-28 13:07:01 +00:00
drh
76baf799a2 ALWAYS macro added for coverage.
FossilOrigin-Name: a1e1ba9145049491c593ac70d9e05149662d34770129c270d702f284cd19a481
2019-10-28 04:20:28 +00:00
drh
a0e16a2261 Improved detection of attempts to use a generated column as part of the
primary key.  Ticket [91e86951016a6802]

FossilOrigin-Name: 6d1bbba9a004a2491c76b4a7d09edb9b738102c46fdcb3e0f7b22bffa719518e
2019-10-27 22:22:24 +00:00
drh
1231b4773d 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
2019-10-26 23:51:44 +00:00
drh
c34f05cca7 Remove redundant code resulting from a merge error on the previous check-in.
FossilOrigin-Name: 713fe86b8c9f3c9ef8af952019e99ba2f4741326226264de6a66baaeb1803d2a
2019-10-26 18:56:12 +00:00
drh
a88c8c1ae4 Add support for generated columns.
FossilOrigin-Name: b855acf1831943b3914491ed0bc333131321930cab480a5281012a3aebbba492
2019-10-26 18:47:47 +00:00
drh
cbda9c7ac7 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
2019-10-26 17:08:06 +00:00