]> git.ipfire.org Git - thirdparty/sqlite.git/log
thirdparty/sqlite.git
5 years agoMinor enhancement to Win32 locking semantics. win32LockFlags
mistachkin [Thu, 19 Dec 2019 00:59:01 +0000 (00:59 +0000)] 
Minor enhancement to Win32 locking semantics.

FossilOrigin-Name: ed66ffce57de556e495241cb78af57411691c883e4e512df31904432119c1d10

5 years agoChange an unreachable testcase() into an assert()
drh [Wed, 18 Dec 2019 21:22:40 +0000 (21:22 +0000)] 
Change an unreachable testcase() into an assert()

FossilOrigin-Name: 062e00c4d7e30155299339eaefe6cbe01953894baebf0af6d7ab3295b7436eb7

5 years agoContinue to back away from the LEFT JOIN optimization of check-in [41c27bc0ff1d3135]
drh [Wed, 18 Dec 2019 20:51:58 +0000 (20:51 +0000)] 
Continue to back away from the LEFT JOIN optimization of check-in [41c27bc0ff1d3135]
by disallowing query flattening if the outer query is DISTINCT.  Without this fix,
if an index scan is run on the table within the view on the right-hand side of the
LEFT JOIN, stale result registers might be accessed yielding incorrect results,
and/or an OP_IfNullRow opcode might be invoked on the un-opened table, resulting
in a NULL-pointer dereference.  This problem was found by the Yongheng and Rui fuzzer.

FossilOrigin-Name: 862974312edf00e9d1068115d1a39b7235b7db68b6d86b81d38a12f025a4748e

5 years agoAdd the --vdbe-debug option to fuzzcheck.
drh [Wed, 18 Dec 2019 13:42:04 +0000 (13:42 +0000)] 
Add the --vdbe-debug option to fuzzcheck.

FossilOrigin-Name: 289158aa24b066c453d2bce4bc2dead1c56fb0b23c3f7c4810b34b13627cef34

5 years agoEnhancements to fuzzcheck on unix so that it captures signals and prints
drh [Wed, 18 Dec 2019 13:02:18 +0000 (13:02 +0000)] 
Enhancements to fuzzcheck on unix so that it captures signals and prints
the current test file and test number prior to terminating.

FossilOrigin-Name: ae7cbb246bff3717c283869ccf27ce83611422f3801176819465a8d96f6481bf

5 years agoAdd a test case for fix in check-in [1ca0bd982ab1183b]
drh [Wed, 18 Dec 2019 09:17:55 +0000 (09:17 +0000)] 
Add a test case for fix in check-in [1ca0bd982ab1183b]

FossilOrigin-Name: 519864da8bb671941a64bf333c2086ad9a068b5f85759e7abd368f0706d3aefd

5 years agoCorrectly unwind the savepoint stack if the database goes read-only in
drh [Wed, 18 Dec 2019 02:12:04 +0000 (02:12 +0000)] 
Correctly unwind the savepoint stack if the database goes read-only in
the middle of a savepoint.

FossilOrigin-Name: a96d02b4ab8c70cc20b322e4fa3a4b8814f05c51f5d8b071ec9d69e7379f3ea5

5 years agoRemove an assert() in the code generator that can fail due to an invalid
drh [Wed, 18 Dec 2019 01:31:21 +0000 (01:31 +0000)] 
Remove an assert() in the code generator that can fail due to an invalid
INSERT statement.  The same assert() appears again in the VDBE and will fire
there if the problem persists in an SQL statement that does not contain
errors.  Gramfuzz find.

FossilOrigin-Name: 9bdd57cb9ad8ac1f4a0f1a3942d94ca5193109eeb1975343c4f0c7abf7135946

5 years agoWhen processing constant integer values in ORDER BY clauses of window
drh [Wed, 18 Dec 2019 00:05:50 +0000 (00:05 +0000)] 
When processing constant integer values in ORDER BY clauses of window
definitions (see check-in [7e4809eadfe99ebf]) be sure to fully disable
the constant value to avoid an invalid pointer dereference if the expression
is ever duplicated. This fixes a crash report from Yongheng and Rui.

FossilOrigin-Name: 1ca0bd982ab1183bbafce0d260e4dceda5eb766ed2e7793374a88d1ae0bdd2ca

5 years agoClean up the ExprList that holds the names of columns in a CTE before checking
drh [Tue, 17 Dec 2019 12:03:30 +0000 (12:03 +0000)] 
Clean up the ExprList that holds the names of columns in a CTE before checking
for unused references in the ALTER TABLE implementation.

FossilOrigin-Name: 8223e79f987feda5c8e51ec52cec6798cca16d070b10558939e2888ca1a25b8e

5 years agoWhen a table is part of a LEFT JOIN and should be a completely NULL row due to
drh [Mon, 16 Dec 2019 16:52:22 +0000 (16:52 +0000)] 
When a table is part of a LEFT JOIN and should be a completely NULL row due to
the semantics of a LEFT JOIN, make sure any generated columns on that row
evaluate to NULL.  Ticket [3b84b42943644d6f]

FossilOrigin-Name: 0271491438ad2a985aeff355173a8d0f1e5813954c82147bc68cb26cca5804c8

5 years agoEnsure that all ON CONFLICT REPLACE indexes are sorted to the end of the list
drh [Sun, 15 Dec 2019 02:49:32 +0000 (02:49 +0000)] 
Ensure that all ON CONFLICT REPLACE indexes are sorted to the end of the list
of indexes for a table, even for weird cases where the same UNIQUE constraint
occurs twice with the ON CONFLICT REPLACE clause only on the second one.  This
avoids an out-of-order contraint processing problem that can arise due
to the optimization of check-in [469a62ca33081854].

FossilOrigin-Name: 1e3918ca2f2c1cfcfa44249b1d7b847d52cbb8d302a8d4a335c090cfdf22d7a1

5 years agoAbort the OP_Savepoint opcode early if a virtual table xSync method fails,
drh [Sun, 15 Dec 2019 00:36:33 +0000 (00:36 +0000)] 
Abort the OP_Savepoint opcode early if a virtual table xSync method fails,
perhaps due to an interrupt.

FossilOrigin-Name: 672e749aef7351de3c69b365c1f80c756fda4e261b5d2ac1faa01d3a7d5a4c49

5 years agoWhen a generated column expression is initially parsed, if it contains errors
drh [Sat, 14 Dec 2019 19:55:31 +0000 (19:55 +0000)] 
When a generated column expression is initially parsed, if it contains errors
convert the expression to a simple NULL.  This prevents additional pieces of
the expression tree that are allocated from lookaside from leaking into the
schema, where lookaside allocations are not allowed.

FossilOrigin-Name: a89b38605661e36d192df1d074383b704b34a959fcbc169837c0d4f6848f3208

5 years agoDue to the previous change, the p5 parameter to OP_VColumn no longer ever
drh [Sat, 14 Dec 2019 18:08:22 +0000 (18:08 +0000)] 
Due to the previous change, the p5 parameter to OP_VColumn no longer ever
contains extraneous bits, so change a testcase() into an assert() to show
as much.

FossilOrigin-Name: 5b4a88cd3b3a32b1242e0eb733cc0bc4becb830a887b8e6604a4c7452050e163

5 years agoDo not set OP_Column flags on the instructions generated by
drh [Sat, 14 Dec 2019 17:43:37 +0000 (17:43 +0000)] 
Do not set OP_Column flags on the instructions generated by
sqlite3ExprCodeGetColumn() if the opcode generated is not really an
OP_Column, which might happen if the column is virtual.
Fix for ticket [b439bfcfb7deedc6]

FossilOrigin-Name: 2401e04730a156aa48787b91af4e516406cb7635145e430be62fd16481816237

5 years agoMake the sqlite3ExprCodeTarget() expression code generator routine robust
drh [Sat, 14 Dec 2019 15:01:55 +0000 (15:01 +0000)] 
Make the sqlite3ExprCodeTarget() expression code generator routine robust
in the face of unknown opcodes - it simply generates a NULL value.

FossilOrigin-Name: f8e876c82a246ceed32b166f64e05dfe5ce4ab4c6820be60404109b43d36bb80

5 years agoFix problems in fts3 with processing corrupt records and undefined integer overflows.
dan [Sat, 14 Dec 2019 14:15:21 +0000 (14:15 +0000)] 
Fix problems in fts3 with processing corrupt records and undefined integer overflows.

FossilOrigin-Name: 3b873029ef1903f76442445343af3786cd59ee66b0e5e0e6b76a0b6b1b5eb88a

5 years agoFix an utterly harmless "applying zero offset to null pointer" UB warning
drh [Fri, 13 Dec 2019 23:38:57 +0000 (23:38 +0000)] 
Fix an utterly harmless "applying zero offset to null pointer" UB warning
in sqlite3AtoF():

FossilOrigin-Name: 052fdf5e58b41ccadaa5aac293ceb4d309ced661d46f3a52be9eb8d01d347a82

5 years agoPatch to the page cache to avoid harmless pointer arithmetic that due to bugs
drh [Fri, 13 Dec 2019 21:24:46 +0000 (21:24 +0000)] 
Patch to the page cache to avoid harmless pointer arithmetic that due to bugs
in the STD-C spec is technically UB.  This is to fix a harmless UBSAN
complaint that OSSFuzz is hitting.

FossilOrigin-Name: c29fc21288e37f81a1617c5e2961c575d3bca6a1d1b013b2e0a99774afb1dcdb

5 years agoEnsure that there is a containing SELECT statement when processing a
drh [Fri, 13 Dec 2019 11:42:56 +0000 (11:42 +0000)] 
Ensure that there is a containing SELECT statement when processing a
normal aggregate function as if it were a window function.

FossilOrigin-Name: c1014e80b26131200a115beb86929a8f0ded2dd65b075e47373346c0f170576a

5 years ago*Remove* the macros, not just comment them out.
drh [Fri, 13 Dec 2019 11:32:28 +0000 (11:32 +0000)] 
*Remove* the macros, not just comment them out.

FossilOrigin-Name: e5dc2939d3e8694d648fc9b73b1174da5b1349e20fbb9cf1c91268939f308f89

5 years agoRemove unused macros formerly used to define built-in aggregate functions.
drh [Fri, 13 Dec 2019 11:31:47 +0000 (11:31 +0000)] 
Remove unused macros formerly used to define built-in aggregate functions.

FossilOrigin-Name: 3ef0d44edd0354cda9b6237f992cb67a2170ee8f1f464b1f38ac36e3a133bc71

5 years agoFactor out the conditional (which is only true for rare errors) from the
drh [Thu, 12 Dec 2019 15:19:18 +0000 (15:19 +0000)] 
Factor out the conditional (which is only true for rare errors) from the
notValid() function in resolve.c, for a performance improvement and size
reduction.  Also cause failures to set the Expr node to a NULL operator so
that it does not cause problems later in case PRAGMA writable_schema=ON has
been set.  Test cases in TH3.

FossilOrigin-Name: c6af9f655b73200ecc0c4189698e421af6ca584babdc76e73a36d468b2eea1f9

5 years agoFix goofy string formatting in lemon.c that dates from the K&R-C days.
drh [Thu, 12 Dec 2019 00:20:40 +0000 (00:20 +0000)] 
Fix goofy string formatting in lemon.c that dates from the K&R-C days.

FossilOrigin-Name: 48ba5e5a2227257cebafacbb09e9dd91d9b89ab2d52a8b4e4113c1d017d95f41

5 years agoImproved tracing output from the LEMON-generated parser.
drh [Wed, 11 Dec 2019 18:53:51 +0000 (18:53 +0000)] 
Improved tracing output from the LEMON-generated parser.

FossilOrigin-Name: 4d6d2fc046d586a1e5989bbb2757f13d0371fbfad0acf45a0e2fd77dffd8d8f9

5 years agoStrengthen check-in [83da4d4104ee1870] by ignoring *all* WHERE-clause
drh [Wed, 11 Dec 2019 16:22:53 +0000 (16:22 +0000)] 
Strengthen check-in [83da4d4104ee1870] by ignoring *all* WHERE-clause
constraints for a virtual table that is the right table of a LEFT JOIN,
as such constraints are never useful.
This fixes an issue discovered by Manuel Rigger.

FossilOrigin-Name: 840de36df1aaeb4bad9a7c18e97cc560ba3b8c629c4520a05bc456d67b3347b9

5 years agoWhen trying to drop a virtual table that has no xDestroy method, invoke
drh [Wed, 11 Dec 2019 15:07:09 +0000 (15:07 +0000)] 
When trying to drop a virtual table that has no xDestroy method, invoke
the xDisconnect method rather than doing nothing, to avoid a memory leak.

FossilOrigin-Name: 1fa29a5f2a89b6a1ee067f9cb86de1b66455126349efe3502599fc7ad224170c

5 years agoThe xDestroy method of a module might be NULL if the schema is corrupt.
drh [Wed, 11 Dec 2019 14:25:11 +0000 (14:25 +0000)] 
The xDestroy method of a module might be NULL if the schema is corrupt.

FossilOrigin-Name: 0457e7d1961ab1f63e31d9028a9064a895f5c3fcfb56ba25e4f37e90197e3a9f

5 years agoEnhance LEMON to provide the ability to mark a rules as one that will never
drh [Tue, 10 Dec 2019 20:41:48 +0000 (20:41 +0000)] 
Enhance LEMON to provide the ability to mark a rules as one that will never
reduce due to intervention of actions.  Use this new capability to designate
the EXPLAIN rule as NEVER-REDUCES.

FossilOrigin-Name: 136cdefb2f7b582ff1771ac7f9e733dc24c357605526cbfb1834937697c8a922

5 years agoUse a statement journal on a CREATE VIRTUAL TABLE statement in case the
drh [Tue, 10 Dec 2019 18:10:12 +0000 (18:10 +0000)] 
Use a statement journal on a CREATE VIRTUAL TABLE statement in case the
VCreate opcode fails.

FossilOrigin-Name: aa3b0eb8c3438ddd3b660bc6bce4b1f4a0e3b5ec897079445231ee1b61210d6a

5 years agoFix parser bugs: require a semicolon after an EXPLAIN command.
drh [Tue, 10 Dec 2019 15:05:09 +0000 (15:05 +0000)] 
Fix parser bugs: require a semicolon after an EXPLAIN command.

FossilOrigin-Name: 707a058a22bd00ef14431cee0d02048cf1be745c0ef5254eda76c325435738ff

5 years agoAvoid a buffer overread in fts5 that could occur when parsing corrupt configuration...
dan [Tue, 10 Dec 2019 03:40:11 +0000 (03:40 +0000)] 
Avoid a buffer overread in fts5 that could occur when parsing corrupt configuration records.

FossilOrigin-Name: 355afd77df21a2265871ca6d075f26b1fa121c7c2682cf512281944ff0c2186d

5 years agoSet the affinity of regular columns prior to computing the values of
drh [Tue, 10 Dec 2019 02:48:41 +0000 (02:48 +0000)] 
Set the affinity of regular columns prior to computing the values of
generated columns.  Ticket [d7c3f125c925c522]

FossilOrigin-Name: d47d66e3d360d8aa6203a855228d2bc40d9a00d69c15f5066b7632d8fb1ed2cc

5 years agoRename a local variable to avoid masking a function parameter and thus
drh [Mon, 9 Dec 2019 19:44:45 +0000 (19:44 +0000)] 
Rename a local variable to avoid masking a function parameter and thus
causing a harmless compiler warning.

FossilOrigin-Name: f065cf003bd2a3a580cb5b9fa2eacd8be075fe8c2bbc5688e9a9406abbfb3804

5 years agoAdd a NEVER() to the ALTER TABLE fix in check-in [1d2e53a39b87e364]
drh [Mon, 9 Dec 2019 19:29:10 +0000 (19:29 +0000)] 
Add a NEVER() to the ALTER TABLE fix in check-in [1d2e53a39b87e364]

FossilOrigin-Name: c7309ed3c7588c7e51e09418bf5cfd4611539b44c39cef9ed4ae0e385bae7625

5 years agoThe previous check-in was not quite correct, and introduced a new problem
drh [Mon, 9 Dec 2019 18:22:17 +0000 (18:22 +0000)] 
The previous check-in was not quite correct, and introduced a new problem
with the USING clause.  Use this version instead.

FossilOrigin-Name: ed28aaa4851202111a502f883ca06359d89b25bba4055c29d7bce2b501cfcc68

5 years agoEnsure that the SrcList_item.colUsed field is set correctly (set to have a
drh [Mon, 9 Dec 2019 17:14:48 +0000 (17:14 +0000)] 
Ensure that the SrcList_item.colUsed field is set correctly (set to have a
1 for all columns of the table) when a generated column appears in the USING
clause of a join.

FossilOrigin-Name: 1923efb283e8840fa7436eb20b9d2174ef7cace1690d3b97b572a0db2048b8e3

5 years agoFix the NOT NULL verification logic in PRAGMA integrity_check so that it
drh [Mon, 9 Dec 2019 15:52:07 +0000 (15:52 +0000)] 
Fix the NOT NULL verification logic in PRAGMA integrity_check so that it
works for generated columns whose value is the result of a comparison operator.
Ticket [bd8c280671ba44a7]

FossilOrigin-Name: f3b39c71b88cb6721f443de56cdce4c08252453a5e340b00a2bd88dc10c42400

5 years agoFix a gramfuzz find. If a partial index that does not reference any column
drh [Mon, 9 Dec 2019 14:34:37 +0000 (14:34 +0000)] 
Fix a gramfuzz find.  If a partial index that does not reference any column
of its table is used by an UPDATE statement in one-pass mode, then avoid the
use of OP_DeferredSeek since the seek might not be resolved prior to the
OP_Delete and OP_Insert that implement the UPDATE.

FossilOrigin-Name: e3398c5ffb060b2b26334b8598e2c63953741e2d6f5124dbd6bdfc8e94742539

5 years agoAvoid infinite recursion in the ALTER TABLE code when a view contains an unused CTE...
dan [Mon, 9 Dec 2019 08:13:43 +0000 (08:13 +0000)] 
Avoid infinite recursion in the ALTER TABLE code when a view contains an unused CTE that references, directly or indirectly, the view itself.

FossilOrigin-Name: 1d2e53a39b87e364685e21de137655b6eee725e4c6d27fc90865072d7c5892b5

5 years agoFix possible null pointer dereferences in the fts5_expr() scalar function.
dan [Mon, 9 Dec 2019 02:20:37 +0000 (02:20 +0000)] 
Fix possible null pointer dereferences in the fts5_expr() scalar function.

FossilOrigin-Name: c5d44143599f3fe98492b2b900fa3d77925c7be545096251055ceeab899a41f1

5 years agoFix incorrect column-usage accounting associated with generated columns
drh [Sun, 8 Dec 2019 00:06:39 +0000 (00:06 +0000)] 
Fix incorrect column-usage accounting associated with generated columns
and added by check-in [6601da58032d18ae].  Fix for ticket [b92e5e8ec2cdbaa1].

FossilOrigin-Name: 9d75e1ccc72e9f536f45df3b24e9ecd25076cc1f7cf16b806b19e0e1b68e8326

5 years agoCorrectly deal with multi-row VALUES clauses that contain window functions.
drh [Sat, 7 Dec 2019 13:42:47 +0000 (13:42 +0000)] 
Correctly deal with multi-row VALUES clauses that contain window functions.

FossilOrigin-Name: 26d991f214db143976e2593d3564b5003eb3539a2728d1a0ccae2a2accece76f

5 years agoIgnore type affinity for auxiliary columns in RTREE as it is too error-prone
drh [Sat, 7 Dec 2019 12:13:54 +0000 (12:13 +0000)] 
Ignore type affinity for auxiliary columns in RTREE as it is too error-prone
to try to parse out the type from other constraints.
Ticket [8bf76328ac940d52]

FossilOrigin-Name: 7fa664ea0ea1e0283a9af50c9ff8dd360ee6042f9e491a136f53d9bcbbc9c7ef

5 years agoFix a problem with foreign keys and generated columns discovered by
drh [Sat, 7 Dec 2019 00:22:18 +0000 (00:22 +0000)] 
Fix a problem with foreign keys and generated columns discovered by
Manuel Rigger.

FossilOrigin-Name: 27c0fdab1ba4d4993b164eb4b777c63e82aa247c3fa406121dc8ed94970a0b35

5 years agoEarly detection and reporting of too few columns in an rtree CREATE VIRTUAL
drh [Fri, 6 Dec 2019 19:07:44 +0000 (19:07 +0000)] 
Early detection and reporting of too few columns in an rtree CREATE VIRTUAL
TABLE statement.

FossilOrigin-Name: ef73107f475e40e6bdd8b722e96992070f81fd2b7a3cb718ec8f251c89ca3e81

5 years agoIn the rtree extension, actively suppress extra tokens on the column names,
drh [Fri, 6 Dec 2019 13:10:29 +0000 (13:10 +0000)] 
In the rtree extension, actively suppress extra tokens on the column names,
and be pedantic about column affinities.  Ticket [367a86e28859f1ff]

FossilOrigin-Name: 97fb5a72f91a44d579466e67c33aa862384c4d1c95c2010cf4ae9dbd172bbcfb

5 years agoThe check-in [b7810062ec2489e1] was not quite right in that it allowed an
drh [Fri, 6 Dec 2019 11:48:27 +0000 (11:48 +0000)] 
The check-in [b7810062ec2489e1] was not quite right in that it allowed an
oversized shift operation (which is UB in C) on some obscure inputs.  OSSFuzz
found the problem for us overnight.

FossilOrigin-Name: 62f2235adf796c72882b26313489cf49804ec3ec4972e0eee5034176cbb07f84

5 years agoFurther enhancements to RTREE, following up to check-in [f898d04cf272ef01]
drh [Fri, 6 Dec 2019 01:38:24 +0000 (01:38 +0000)] 
Further enhancements to RTREE, following up to check-in [f898d04cf272ef01]
so that constraints are allowed to be compared to strings that look like
numbers.  Ticket [aa573a787b8f1fdf]

FossilOrigin-Name: 32772dfd50b602c049d8c30bc28cde60a18b7495a997d728081f689ff417c956

5 years agoDo not allow UPSERT of a view.
drh [Fri, 6 Dec 2019 01:23:38 +0000 (01:23 +0000)] 
Do not allow UPSERT of a view.

FossilOrigin-Name: ebf897e861c19e214c57f1e73841b505182202cc8d7d39e24d5a1e5625e26b4a

5 years agoFix to the rowvalue logic that avoids disabling rowvalue inequality
drh [Thu, 5 Dec 2019 21:46:23 +0000 (21:46 +0000)] 
Fix to the rowvalue logic that avoids disabling rowvalue inequality
contraints on a virtual table when the virtual table sets the omit flag.
The logic has been incorrect since row-values were added.  However, this
does not come up often as very few virtual tables implement inequality
constraints using the omit flag.  Ticket [f096d191b6641daa]

FossilOrigin-Name: b7810062ec2489e1c5ca6638dbeb0892e4ce376c5c1834a31d1a332ebab8a871

5 years agoDocumentation update: Clarify that the sqlite3_index_info.aConstraintUsage.omit
drh [Thu, 5 Dec 2019 18:29:52 +0000 (18:29 +0000)] 
Documentation update:  Clarify that the sqlite3_index_info.aConstraintUsage.omit
flag is a hint only and that the code generator is not obligated to follow
the hint.

FossilOrigin-Name: 7d3e3f6e7e55da41bf776fab094df54fb6a33b2967881d3184cf854c8a637518

5 years agoAdditional debugging information printed with the ".wheretrace 0x100" option.
drh [Thu, 5 Dec 2019 17:31:58 +0000 (17:31 +0000)] 
Additional debugging information printed with the ".wheretrace 0x100" option.
No changes to normally delivered code.

FossilOrigin-Name: fc72ec52c92ca6a953e765b48e21d52021fdb23a2cd84f737da4e43c642f6a5d

5 years agoMake sure the rowid of an RTREE virtual table has integer affinity.
drh [Thu, 5 Dec 2019 14:42:26 +0000 (14:42 +0000)] 
Make sure the rowid of an RTREE virtual table has integer affinity.
Ticket [9fe487ba3c064b4e]

FossilOrigin-Name: 7ae8c0d52f6aa7f27537216f85456ef49dade040366cfb250c789206ecd4dc5a

5 years agoFix a problem in ALTER TABLE that could occur if an index, view or trigger in the...
dan [Thu, 5 Dec 2019 14:31:43 +0000 (14:31 +0000)] 
Fix a problem in ALTER TABLE that could occur if an index, view or trigger in the schema features an expression of the form ((SELECT ...) IN ()) where the SELECT statement uses a CTE.

FossilOrigin-Name: 7e5ad8e0ab7ee91a5ccb19a9654d6a036233f74d2fdc45f7315feb3d9d035fd4

5 years agoBe strict about type enforcement on rowid look-ups in the RTREE extension.
drh [Thu, 5 Dec 2019 13:34:13 +0000 (13:34 +0000)] 
Be strict about type enforcement on rowid look-ups in the RTREE extension.
Ticket [30e2c183b6b356e4]

FossilOrigin-Name: d43e0efb9642037dd751cfed13438e71cfceb50e14a0ec603880c6c3be2e93b1

5 years agoEnhance the RTREE extension so that it give correct query results even if
drh [Thu, 5 Dec 2019 00:44:47 +0000 (00:44 +0000)] 
Enhance the RTREE extension so that it give correct query results even if
the query uses non-numeric constraints.  Ticket [a55ab6d97d01ecbc]

FossilOrigin-Name: f898d04cf272ef0130dcae146cb86d8630b10a6f19aecfc2fa70e97e082bd51c

5 years agoWindow functions are never constant.
drh [Wed, 4 Dec 2019 19:45:52 +0000 (19:45 +0000)] 
Window functions are never constant.

FossilOrigin-Name: 35f0b5a8c7921f7419eeb11be8201fd6988047042fcaeffa297fc322bc480c1f

5 years agoEnsure that an ALWAYS() in the rename logic really is always true, even
drh [Wed, 4 Dec 2019 15:08:58 +0000 (15:08 +0000)] 
Ensure that an ALWAYS() in the rename logic really is always true, even
for faulty inputs.

FossilOrigin-Name: 54410f0e7710542d5159d0449898598d2b7f7676bfd993644ca47da1bf1fcdac

5 years agoFix an assert() failure that could occur in ALTER TABLE code when the schema contains...
dan [Wed, 4 Dec 2019 14:26:38 +0000 (14:26 +0000)] 
Fix an assert() failure that could occur in ALTER TABLE code when the schema contains a view that uses a CTE.

FossilOrigin-Name: 75b04a4b0d2e65bfcd02cf4e0b6d8f1954957c590814a9b8f9a9ee2adc2ec022

5 years agoFix a buffer overread that could occur in fts3 with corrupt %_stat records.
dan [Wed, 4 Dec 2019 03:46:50 +0000 (03:46 +0000)] 
Fix a buffer overread that could occur in fts3 with corrupt %_stat records.

FossilOrigin-Name: e01fdbf9f700e1bd9dd5283c65547d10d26ce4f4506d3cfef9e1087aecdc2305

5 years agoFix an incorrect NEVER() macro.
drh [Wed, 4 Dec 2019 03:31:29 +0000 (03:31 +0000)] 
Fix an incorrect NEVER() macro.

FossilOrigin-Name: 96b6a76da09a94182414ec1a56da91728c37329d2b55f889e433054ca21605ce

5 years agoFix a double-free that could occur when a component of a compound SELECT with an...
dan [Wed, 4 Dec 2019 01:42:07 +0000 (01:42 +0000)] 
Fix a double-free that could occur when a component of a compound SELECT with an ORDER BY clause uses named window definitions.

FossilOrigin-Name: 92893b7980cbb0c6e26bc0b21390a717193205c9897fea5f26476462928897f9

5 years agoAvoid a crash that could occur when a database containing a table with a temp trigger...
dan [Tue, 3 Dec 2019 03:34:06 +0000 (03:34 +0000)] 
Avoid a crash that could occur when a database containing a table with a temp trigger that has the same name as a temp table is detached.

FossilOrigin-Name: c4cb9708d48ead10ee9543f86878be8382cd6e850950d5384c95254bac4a8d6e

5 years agoAvoid a harmless zero offset of a null pointer in FTS3, so as to not provoke
drh [Tue, 3 Dec 2019 03:31:11 +0000 (03:31 +0000)] 
Avoid a harmless zero offset of a null pointer in FTS3, so as to not provoke
unnecessary warnings from run-time checkers.

FossilOrigin-Name: 85d95abec4a596eb3ffd2ea19b4067dc1a6970264222ed5d69e75764ac21597c

5 years agoAvoid computing a zero offset of a null pointer, which though this is
drh [Tue, 3 Dec 2019 02:51:50 +0000 (02:51 +0000)] 
Avoid computing a zero offset of a null pointer, which though this is
technically harmless, is upsetting to pedantic run-time checkers.

FossilOrigin-Name: 3ce804e99bbef83d49ec309157448a7c1422725606516cef904e6122aadd3922

5 years agoDo not allow a term in the WHERE clause of the query to qualify a partial
drh [Sat, 30 Nov 2019 19:29:19 +0000 (19:29 +0000)] 
Do not allow a term in the WHERE clause of the query to qualify a partial
index on the right table of a LEFT JOIN.  Ticket [7f39060a24b47353]

FossilOrigin-Name: 4066a34da7bcdcece6c438c27f3a11bc49b8c8373b7e1603f30f6225e2bc800a

5 years agoAdd comments in the parse.sql file to help demonstrate how rules are
drh [Fri, 29 Nov 2019 13:01:57 +0000 (13:01 +0000)] 
Add comments in the parse.sql file to help demonstrate how rules are
encoded.

FossilOrigin-Name: 2c4f714892327a1a9a303267b1f9685e310cca5dcea9c61287d95e26291b0506

5 years agoFix the parse.sql output file so that it is readable into a database where
drh [Fri, 29 Nov 2019 12:51:00 +0000 (12:51 +0000)] 
Fix the parse.sql output file so that it is readable into a database where
foreign keys are enforced.

FossilOrigin-Name: 3a82c554c3bde4640df6865686f8f70e2c1e07c581fed4772b6b0a8ec1b10bb6

5 years agoMore details on the comment justifying the aleged data race in the WAL-mode
drh [Wed, 27 Nov 2019 20:40:44 +0000 (20:40 +0000)] 
More details on the comment justifying the aleged data race in the WAL-mode
checkpoint logic.

FossilOrigin-Name: 0fab65c79f675c825ed7e85c82b65ce6f990c9d0796ebb3886942d241df7b268

5 years agoFix various documentation typos suggested by Mark Benningfield.
drh [Tue, 26 Nov 2019 14:24:12 +0000 (14:24 +0000)] 
Fix various documentation typos suggested by Mark Benningfield.
No changes to code.

FossilOrigin-Name: 08f09dc4f986a27f4e4e69f8226dbfaf0cfe1269cefc2830bf0fbef7b9bbda48

5 years agoFix to check-in [5d9a369301a65f32] so that it compiles without SQLITE_DEBUG.
drh [Tue, 26 Nov 2019 11:10:59 +0000 (11:10 +0000)] 
Fix to check-in [5d9a369301a65f32] so that it compiles without SQLITE_DEBUG.

FossilOrigin-Name: fefe2d046725254367f9f82a8c8cb137e8b75dbbf4bc48debf0649479ff2f0c2

5 years agoAdd the new -S option to the lemon parser generator to cause it to output
drh [Tue, 26 Nov 2019 02:22:39 +0000 (02:22 +0000)] 
Add the new -S option to the lemon parser generator to cause it to output
SQL that describes the input grammar.

FossilOrigin-Name: 4dbd398d640852d4a696d68c72ee039968023d402a8053b5e6b4ef1d75e982a8

5 years agoFix an assert() in fts3 that could fail due to corrupt database records.
dan [Tue, 26 Nov 2019 02:03:16 +0000 (02:03 +0000)] 
Fix an assert() in fts3 that could fail due to corrupt database records.

FossilOrigin-Name: 5d9a369301a65f320a0696fcf1f062ca5976ef34350590c07aecf5335c66d872

5 years agoModify journal3.test so that it can handle Tcl command "file attr <file> -perm" retur...
dan [Mon, 25 Nov 2019 04:15:33 +0000 (04:15 +0000)] 
Modify journal3.test so that it can handle Tcl command "file attr <file> -perm" returning octal values in either "00755" or "0o755" format.

FossilOrigin-Name: b0b655625cf491c832a259d29a67660b8d5943c201617900a83d0660b2673377

5 years agoMinor enhancements to the TclKit download tool.
mistachkin [Mon, 25 Nov 2019 00:07:03 +0000 (00:07 +0000)] 
Minor enhancements to the TclKit download tool.

FossilOrigin-Name: 75e31b1d56781fc4d28aea6c7f1393a18fd34870a5beb92df81c088d61351b4a

5 years agoAbort the window function tree rewrite early following an OOM.
drh [Sat, 23 Nov 2019 16:34:40 +0000 (16:34 +0000)] 
Abort the window function tree rewrite early following an OOM.

FossilOrigin-Name: d66f95a51530259ab48f78c9f91acc38055caf338b6fee846b99a8c077466e95

5 years agoAvoid evaluating PARTITION BY or ORDER BY expressions multiple times for window funct...
dan [Sat, 23 Nov 2019 15:10:28 +0000 (15:10 +0000)] 
Avoid evaluating PARTITION BY or ORDER BY expressions multiple times for window function queries that use multiple window functions with the same window-definition.

FossilOrigin-Name: 57070c68bbe15fc1d19a765182432e844c082909bdbc63b58fd86b96e2c521dd

5 years agoEnhance the path arguments in JSON functions to access "#-N" array indexes.
drh [Sat, 23 Nov 2019 08:51:21 +0000 (08:51 +0000)] 
Enhance the path arguments in JSON functions to access "#-N" array indexes.

FossilOrigin-Name: ffeec62cb5223ae70bc1889df4c0b241f5d17b1a10156362ca59953028741480

5 years agoFix a memory leak in fts5 error handling code.
dan [Sat, 23 Nov 2019 08:36:35 +0000 (08:36 +0000)] 
Fix a memory leak in fts5 error handling code.

FossilOrigin-Name: de6637e15d95b7aee2caea8b8d5b9865f276cbbf152ecf0401c4c7bfdf6dee6f

5 years agoExtend the json-path mechanism with array indexes of the form "#" or "#-n" for json-path-enhancement
drh [Fri, 22 Nov 2019 17:37:56 +0000 (17:37 +0000)] 
Extend the json-path mechanism with array indexes of the form "#" or "#-n" for
some positive number "n", to reference the end of an array.

FossilOrigin-Name: 35ed68a651f4cf8740597433b0f1c3b345841868022e0904e9f342840ba0e502

5 years agoFix a harmless compiler warning.
drh [Fri, 22 Nov 2019 11:49:39 +0000 (11:49 +0000)] 
Fix a harmless compiler warning.

FossilOrigin-Name: 34343c4b0657767f2676a2a9feb670cf000824e3eadfb1a6d87b57404191d8f9

5 years agoFix an indentation error and improve the placement of an assert() based
drh [Fri, 22 Nov 2019 11:47:04 +0000 (11:47 +0000)] 
Fix an indentation error and improve the placement of an assert() based
on a tweet from Yuri Kotov.

FossilOrigin-Name: e6314e386c6877c669bd32788d3886253b0a187bee2c3889f4eaba219f5e52c7

5 years agoAdd more test cases from Yongheng Chen and Rui Zhong.
drh [Fri, 22 Nov 2019 11:38:40 +0000 (11:38 +0000)] 
Add more test cases from Yongheng Chen and Rui Zhong.

FossilOrigin-Name: f24e6ca4f23008212ec05cace9202dbeb37ee34530ead91fac2f5e3eac7f6347

5 years agoFix a crash that could occur if a sub-select that uses both DISTINCT and window funct...
dan [Fri, 22 Nov 2019 10:14:01 +0000 (10:14 +0000)] 
Fix a crash that could occur if a sub-select that uses both DISTINCT and window functions also used an ORDER BY that is the same as its select list.

FossilOrigin-Name: bcdd66c1691955c697f3d756c2b035acfe98f6aad72e90b0021bab6e9023b3ba

5 years agoRevise the SQLITE_OPEN_NOFOLLOW so that it actually uses O_NOFOLLOW in the
drh [Fri, 22 Nov 2019 00:42:01 +0000 (00:42 +0000)] 
Revise the SQLITE_OPEN_NOFOLLOW so that it actually uses O_NOFOLLOW in the
open() system call.  This backs out the SQLITE_ACCESS_SYMLINK value but adds
the new SQLITE_OK_SYMLINK return code from the xFullPathname method of
sqlite3_vfs when that routine resolves symbolic links. O_NOFOLLOW is always
included in open() system calls for journal files.

FossilOrigin-Name: 6a64fb6a2da6c98f1e87b55ad5689967e1db4eae2e08345471d95e28cd567e0f

5 years agoAdd all fuzz-test cases received from Yongheng Chen and Rui Zhong. Also
drh [Thu, 21 Nov 2019 20:24:04 +0000 (20:24 +0000)] 
Add all fuzz-test cases received from Yongheng Chen and Rui Zhong.  Also
fix a minor problem in gencol1.test cases.

FossilOrigin-Name: ac080432b480062507452d3cdbe6c0f759e6f95b65d9862e0462017405ab2b8e

5 years agoFix an out-of-bounds array reference in the generated column logic.
drh [Thu, 21 Nov 2019 20:10:31 +0000 (20:10 +0000)] 
Fix an out-of-bounds array reference in the generated column logic.
Problem discovered by valgrind.

FossilOrigin-Name: a0ab42f779b9a96f4e43879210dfaba8fa593de77fc0ec0e2e6f116d9301ea59

5 years agoWhenever a generated column is used, assume that all columns are used.
drh [Thu, 21 Nov 2019 19:37:00 +0000 (19:37 +0000)] 
Whenever a generated column is used, assume that all columns are used.

FossilOrigin-Name: 6601da58032d18ae00b466c0f2077fb2b1ecd84225b56e1787724bea478eedc9

5 years agoFix a problem that comes up when using generated columns that evaluate to a
drh [Thu, 21 Nov 2019 18:28:44 +0000 (18:28 +0000)] 
Fix a problem that comes up when using generated columns that evaluate to a
constant in an index and then making use of that index in a join.

FossilOrigin-Name: 8b12e95fec7ce6e0de82a04ca3dfcf1a8e62e233b7382aa28a8a9be6e862b1af

5 years agoFix a recently introduced memory leak in the test code in test_vfs.c.
dan [Thu, 21 Nov 2019 17:14:55 +0000 (17:14 +0000)] 
Fix a recently introduced memory leak in the test code in test_vfs.c.

FossilOrigin-Name: 2d53a30cc23e53033af8e8666457654db5dcc453ed6cd176ce1d0bff4f528159

5 years agoPrevent direct and indirect recursive content= options in fts3/4 and fts5.
dan [Thu, 21 Nov 2019 14:20:59 +0000 (14:20 +0000)] 
Prevent direct and indirect recursive content= options in fts3/4 and fts5.

FossilOrigin-Name: 2eb997327c2c369c10b7835be80112d77cb2a7cfa9fe4d564042984c21d94698

5 years agoFix a use-after-free problem in the test suite. No changes to production code.
dan [Wed, 20 Nov 2019 16:10:40 +0000 (16:10 +0000)] 
Fix a use-after-free problem in the test suite. No changes to production code.

FossilOrigin-Name: 0d1055a5da8274a59f35170b1f9469597ce4c5a4c5e851a1b81d3be2ccd32871

5 years agoFurther improve detection of corrupt records in fts3.
dan [Wed, 20 Nov 2019 13:31:52 +0000 (13:31 +0000)] 
Further improve detection of corrupt records in fts3.

FossilOrigin-Name: a0f6d526baecd061a5e2bec5eb698fb5dfb10122ac79c853d7b3f4a48bc9f49b

5 years agoChanges to extensions and test logic so that the build works with gcc
drh [Wed, 20 Nov 2019 12:07:40 +0000 (12:07 +0000)] 
Changes to extensions and test logic so that the build works with gcc
and with -std=iso9899:1999

FossilOrigin-Name: 2575a68c3965e72f2ab211d933012442755afe6a9b7de9e9e50cdd2155fd1ec8

5 years agoEnhancements to DBSTAT: (1) Make name=? queries efficient. (2) Add the
drh [Tue, 19 Nov 2019 21:22:16 +0000 (21:22 +0000)] 
Enhancements to DBSTAT:  (1) Make name=? queries efficient.  (2) Add the
ability to aggregate results across each individual btree using the
aggregate=TRUE constraint in the WHERE clause.

FossilOrigin-Name: a48f6e17599d7ec794cfcd60858d6a69cf05caaae9321048b111fedd86a3b5b2

5 years agoGet the aggregate=TRUE feature working on the DBSTAT virtual table. dbstat-enhancements
drh [Tue, 19 Nov 2019 18:48:11 +0000 (18:48 +0000)] 
Get the aggregate=TRUE feature working on the DBSTAT virtual  table.

FossilOrigin-Name: 16fef3db063830884de46d53a289f637a7204fe84fcdee7ea81dbb8bca578952

5 years agoBegin an enhancement effort for the built-in DBSTAT virtual table.
drh [Tue, 19 Nov 2019 14:01:51 +0000 (14:01 +0000)] 
Begin an enhancement effort for the built-in DBSTAT virtual table.

FossilOrigin-Name: 9b5722f0fe666b99677e5f333dd8413aefb9ace7a461d74f6558f0ac53768719

5 years agoMake the result of sqlite3_normalized_sql() survive its statement being reprepared.
mistachkin [Tue, 19 Nov 2019 00:13:42 +0000 (00:13 +0000)] 
Make the result of sqlite3_normalized_sql() survive its statement being reprepared.

FossilOrigin-Name: 4330f0795dbc2ab41dddd41d5979331fb9b78c477c66367c4be52f929531a45f