Commit Graph

21192 Commits

Author SHA1 Message Date
drh
195a843691 Add support for the sqlite3_hard_heap_limit64() interface and the
hard_heap_limit pragma.

FossilOrigin-Name: 6399c47ea89c5766274bd6abdc9b6a85fe5b7f6c1078972c2f58e624bae59b7c
2019-11-14 18:07:28 +00:00
drh
31999c5cac 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
2019-11-14 17:46:32 +00:00
drh
803f06bf62 Merge recent enhancements from trunk.
FossilOrigin-Name: b8a631fd30d0732505679230684b3362c965438197a2b11518f01a77599c9202
2019-11-14 15:21:15 +00:00
drh
39d1a2a100 Minor documentation enhancements. No changes to code.
FossilOrigin-Name: 6153f3aada0cc9c5e773753797892ee78b518b0d76568382f5fbc9ee960f814c
2019-11-14 15:10:48 +00:00
drh
01d1801cab New test cases added to fuzzdata8.db.
FossilOrigin-Name: 5baffcda7d5a42a99fa905faa834f14b94b1e2a26b5221f15d8ae8f1f5e3236a
2019-11-14 13:57:15 +00:00
drh
ba01634cd3 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
2019-11-14 13:24:04 +00:00
mistachkin
b88eaf1619 Add header guard to the expert extension.
FossilOrigin-Name: 7e3151855fd4370fb7d4fff20516c2c2d1980134620df924106e6989bc130583
2019-11-13 18:50:36 +00:00
drh
dbf1c4ba8a Fix the sqlite3TreeView() output to consistently use a colon and not a
comma after the table number in the AST dumps.

FossilOrigin-Name: fa2416f623d83fe93253137302a74fcd6cdd041da337a0756df344d7d09a19f5
2019-11-13 16:50:06 +00:00
drh
d2c40e9310 For for the previous check-in: Always enable the nUri variable, even
when debugging is turned off.

FossilOrigin-Name: f84a15394c369cbdb6fba87c603a609722cf1f499626c7f20699060273ab5081
2019-11-12 16:21:27 +00:00
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