]> git.ipfire.org Git - thirdparty/sqlite.git/log
thirdparty/sqlite.git
3 years agoFix issues in the new ADD COLUMN constraint checking. Add preliminary add-column-constraint-check
drh [Tue, 20 Jul 2021 08:23:54 +0000 (08:23 +0000)] 
Fix issues in the new ADD COLUMN constraint checking.  Add preliminary
test cases.

FossilOrigin-Name: 48434ad3fa9504c063d812d119bc8f622548fd02b3d478ff247b11474c4ce5db

3 years agoDemonstration code to show how NOT NULL and CHECK constraints can be
drh [Tue, 20 Jul 2021 07:35:07 +0000 (07:35 +0000)] 
Demonstration code to show how NOT NULL and CHECK constraints can be
verified after an ALTER TABLE ADD COLUMN.

FossilOrigin-Name: 039f540373b03af9e0c87499e5e0423eb093d1d343829282a5ac1de2d600b881

3 years agoIt does not work to deserialized into TEMP, so do not allow it. The
drh [Tue, 20 Jul 2021 02:02:24 +0000 (02:02 +0000)] 
It does not work to deserialized into TEMP, so do not allow it.  The
sqlite3_deserialize() routine now returns SQLITE_ERROR if you try.

FossilOrigin-Name: 18068cc60698d4944a9d682cdf34b14b4d4b32f043f8d584dbf41c2bb5ac6220

3 years agoFix compilation of 'threadtest3' for some older versions of MSVC.
mistachkin [Tue, 20 Jul 2021 00:18:22 +0000 (00:18 +0000)] 
Fix compilation of 'threadtest3' for some older versions of MSVC.

FossilOrigin-Name: b5ede6a68891820bd5b6d051b1b641bc1cd49104cad2466db184134d14f58f5b

3 years agoMore precision in comparing integers and floating point values while
drh [Mon, 19 Jul 2021 20:52:31 +0000 (20:52 +0000)] 
More precision in comparing integers and floating point values while
processing the integer primary key for OP_SeekGE and similar.
[forum:/forumpost/2bdb86a068|Forum post 2bdb86a068].

FossilOrigin-Name: f9c6426de3b413ff8fcf04a00931ca5f123f996c572b35181af114afa8d811d7

3 years agoUpdates so that "threadtest3[.exe]" can be built for windows with MSVC.
dan [Mon, 19 Jul 2021 16:49:13 +0000 (16:49 +0000)] 
Updates so that "threadtest3[.exe]" can be built for windows with MSVC.

FossilOrigin-Name: 4ce585fb07274284e3add6adcb66ed06e4b109584704d1ec7152bf43ca8d5d85

3 years agoIn defensive mode, allow statements that write to shadow tables to be prepared from...
dan [Mon, 19 Jul 2021 14:00:29 +0000 (14:00 +0000)] 
In defensive mode, allow statements that write to shadow tables to be prepared from with virtual-table xSync() calls.

FossilOrigin-Name: c8601d83fbecf84ca7991d339449b380deb5a7620dc84756a91c2880f030b423

3 years agoFix minor spacing issues in the MSVC makefile.
mistachkin [Mon, 19 Jul 2021 03:38:13 +0000 (03:38 +0000)] 
Fix minor spacing issues in the MSVC makefile.

FossilOrigin-Name: d78c272b3966cc1b12bc7e83fbe909a3c517d553a942d7f1c07bddf69f2e2164

3 years agoTry to omit the ORDER BY clause in subqueries if doing so does not change
drh [Fri, 16 Jul 2021 22:43:00 +0000 (22:43 +0000)] 
Try to omit the ORDER BY clause in subqueries if doing so does not change
the result in any way. See
[forum:/forumpost/2d76f2bcf65d256a|Forum post 2d76f2bcf65d256a] for
details and history.

FossilOrigin-Name: 85ddaf1b59a19cbd9efe7724a163b30c14bafabfaf2cfced07b463e76f73e494

3 years agoMinor comment improvements. omit-subquery-order-by
drh [Fri, 16 Jul 2021 20:16:19 +0000 (20:16 +0000)] 
Minor comment improvements.

FossilOrigin-Name: 6854b5919beefa43da21ba739e82d583183c8cdfe5dd63e27a810ac1ffe2330b

3 years agoDe-typo sqlite3_expanded_sql() doc
larrybr [Fri, 16 Jul 2021 17:11:21 +0000 (17:11 +0000)] 
De-typo sqlite3_expanded_sql() doc

FossilOrigin-Name: 56b0f5418dad34d1e83d53741916e2a38a5448369031d959b8a44867774be657

3 years agoModify the generate_series() table-valued functions so that its first
drh [Fri, 16 Jul 2021 17:04:17 +0000 (17:04 +0000)] 
Modify the generate_series() table-valued functions so that its first
argument (the START value) is required.  Throw an error if that argument
is not supplied.  In this was the series.c loadable extension can be used
as a demonstration of how to code an xBestIndex function to require certain
parameters.  Compile with -DZERO_ARGUMENT_GENERATE_SERIES to obtain the
legacy behavior.

FossilOrigin-Name: 459d85a2898d6a53f43b4ad48d2f39edd1bbe37a4f97426a5d666c39c52576a4

3 years agoFix the "main.mk" makefile so that "series.c" is a dependency of "shell.c".
drh [Fri, 16 Jul 2021 15:30:19 +0000 (15:30 +0000)] 
Fix the "main.mk" makefile so that "series.c" is a dependency of "shell.c".

FossilOrigin-Name: ff959917918495ef352ce48c240b1de6da162f2a5e76e37dcc53fa50bce27642

3 years agoGet the "omit ORDER BY in FROM-clause subqueries" optimization working for the
drh [Fri, 16 Jul 2021 01:19:19 +0000 (01:19 +0000)] 
Get the "omit ORDER BY in FROM-clause subqueries" optimization working for the
core test cases.

FossilOrigin-Name: e31c5888659ffd4c6d8b68627123df3bbb84bb010b7766b0a74877bf3ba1e52b

3 years agoBy default, do not emit #line directives in the amalgamation.
mistachkin [Thu, 15 Jul 2021 23:34:14 +0000 (23:34 +0000)] 
By default, do not emit #line directives in the amalgamation.

FossilOrigin-Name: bacfa93677fbe014737fab7dbdb4e7a168a310bc5b914b17896ae2a48435c7b1

3 years agoAttempt to omit ORDER BY clauses from FROM-clause subqueries if those ORDER BY
drh [Thu, 15 Jul 2021 19:29:43 +0000 (19:29 +0000)] 
Attempt to omit ORDER BY clauses from FROM-clause subqueries if those ORDER BY
clauses do not affect the output.  See
[forum:/forumpost/2d76f2bcf65d256a|forum thread 2d76f2bcf65d256a] for
discussion.  This can help the query flattener in
some cases, resulting in faster query plans.  The current implemention does
not always work.

FossilOrigin-Name: ef97c3e7c3ea2cf1a4db6591328fe7ce3f1d189afc2d578159135824ec89e620

3 years agoChange references to the schema table in sqlite3_analyzer to the new
drh [Thu, 15 Jul 2021 16:39:42 +0000 (16:39 +0000)] 
Change references to the schema table in sqlite3_analyzer to the new
SQLITE_SCHEMA name.

FossilOrigin-Name: 3beb77d6a792d07ca605ec8e5402b8a305860cba4044fcafeed00b9fa862fa16

3 years agoFix a use-after-free error in ioerr.test caused by an error in test code.
dan [Wed, 14 Jul 2021 21:18:31 +0000 (21:18 +0000)] 
Fix a use-after-free error in ioerr.test caused by an error in test code.

FossilOrigin-Name: 1594056aab068b9fae82f6b885828c7127d9bedcc37c4340486e32791bc87c7a

3 years agoEnhance comments pertaining to the interface linkage / calling convention macros.
mistachkin [Tue, 13 Jul 2021 22:49:02 +0000 (22:49 +0000)] 
Enhance comments pertaining to the interface linkage / calling convention macros.

FossilOrigin-Name: c378e99250fe06fae8ca40c62185b607f004d6806e07dbb9f964dd849b4e55f8

3 years agoFurther revisions to #line handling for amalgamation builds.
mistachkin [Tue, 13 Jul 2021 21:59:22 +0000 (21:59 +0000)] 
Further revisions to #line handling for amalgamation builds.

FossilOrigin-Name: 9a84321229ad499ee0f7c85732c2728afb4476c72073a510401a559dda9be38f

3 years agoGet correct #line tags into amalgamation for other builds too.
larrybr [Tue, 13 Jul 2021 20:55:26 +0000 (20:55 +0000)] 
Get correct #line tags into amalgamation for other builds too.

FossilOrigin-Name: 999eb80018f1bb8a8ad73483610400faf5fb37b1be446ce30edbf7028340f50b

3 years agoGet #line tags into amalgamation, subject to configure.
larrybr [Tue, 13 Jul 2021 11:59:17 +0000 (11:59 +0000)] 
Get #line tags into amalgamation, subject to configure.

FossilOrigin-Name: 5d81b598a7cd2cea2553fdf6ca38d2f65f0f1b2d5a8eea8a01c1800f68aa2422

3 years agoMerge from trunk, rename tool option for its effect line_tags
larrybr [Tue, 13 Jul 2021 11:55:07 +0000 (11:55 +0000)] 
Merge from trunk, rename tool option for its effect

FossilOrigin-Name: 9327f73c1b87fb9ca78e261d16b092763f497bb9c6f9784a33eabdc961b06343

3 years agoDo not attempt to run Tcl sessions tests unless both SQLITE_ENABLE_PREUPDATE_HOOK...
dan [Tue, 13 Jul 2021 11:30:46 +0000 (11:30 +0000)] 
Do not attempt to run Tcl sessions tests unless both SQLITE_ENABLE_PREUPDATE_HOOK and SQLITE_ENABLE_SESSIONS are defined.

FossilOrigin-Name: 385db794477e046b5dde726489375786d7565b113084f6e730efb050b08f9a6e

3 years agoAmalgamation has #line directives by default. Minor mksqlite3c.tcl changes
larrybr [Tue, 13 Jul 2021 01:45:04 +0000 (01:45 +0000)] 
Amalgamation has #line directives by default. Minor mksqlite3c.tcl changes

FossilOrigin-Name: ba3eff71973064cbc0ddf51aa822a246c162bbb65387e9523692c60e5340acda

3 years agoClarify comment on sqlite3.h's interface decaration macros.
larrybr [Fri, 9 Jul 2021 23:12:42 +0000 (23:12 +0000)] 
Clarify comment on sqlite3.h's interface decaration macros.

FossilOrigin-Name: 7cb09aef49c0b98c0c5e332d953a2eeb71ae9e243b1e37ab1c8ed4af15d46f50

3 years agoFix an assert() that might fail if sqlite3_create_function_v2() is invoked with NULL...
dan [Fri, 9 Jul 2021 14:59:12 +0000 (14:59 +0000)] 
Fix an assert() that might fail if sqlite3_create_function_v2() is invoked with NULL xStep and xFinal callbacks and a non-NULL xDestroy.

FossilOrigin-Name: ab1550a608684b6b9104b555a975482cfabca5053b7d7dcc60d63a0e3a8d707d

3 years agoEnhance the sqlite3_create_function() interfaces to assume a value of
drh [Fri, 9 Jul 2021 13:52:01 +0000 (13:52 +0000)] 
Enhance the sqlite3_create_function() interfaces to assume a value of
SQLITE_UTF8 is presented with a nonsense value for the preferred encoding.
This is undocumented behavior added for robustness.

FossilOrigin-Name: c1bb5cff527af6a97b025d646581c68ac9b56924ae199f86964026a7bc9724fd

3 years agoAdd the usual "#ifdef __cplusplus" magic to header file ext/misc/carray.h. Also updat...
dan [Fri, 9 Jul 2021 11:52:53 +0000 (11:52 +0000)] 
Add the usual "#ifdef __cplusplus" magic to header file ext/misc/carray.h. Also update carray.h/carray.c to use SQLITE_API in the usual way.

FossilOrigin-Name: 0f97c2a459bfadc2fe19e710e8845039b4434010656d311074b9594b02d0826a

3 years agoAllow CLI shell build to #include same user-specified header as library build.
larrybr [Fri, 9 Jul 2021 00:12:05 +0000 (00:12 +0000)] 
Allow CLI shell build to #include same user-specified header as library build.

FossilOrigin-Name: eb8af9a494fb68c0a1c600b3ac71467645b51b296fc6e2116d7d855319d59a59

3 years agoRename optional SQLITE_CUSTOM_INC define to SQLITE_CUSTOM_INCLUDE.
mistachkin [Thu, 8 Jul 2021 23:35:20 +0000 (23:35 +0000)] 
Rename optional SQLITE_CUSTOM_INC define to SQLITE_CUSTOM_INCLUDE.

FossilOrigin-Name: 060aec37accae858ced5b081a2ff76dccdd8f8bcefc63d1fe2e7478257c69e76

3 years agoAllow library build to #include a user-specified header.
larrybr [Thu, 8 Jul 2021 22:12:27 +0000 (22:12 +0000)] 
Allow library build to #include a user-specified header.

FossilOrigin-Name: 71e6490bbe59939cd15f0094e507dd8a2e167fdd8de675c3ebfeaf528a01f87a

3 years agoPreserve and return to the user any error message returned by a failed xConnect(...
dan [Thu, 8 Jul 2021 18:29:25 +0000 (18:29 +0000)] 
Preserve and return to the user any error message returned by a failed xConnect() call on an eponymous virtual table that prevents a query from being compiled.

FossilOrigin-Name: bbbbeb59a6a14b94dcbaf218cbcfbd39feba4a1df5b37c0e1a955391393eeec4

3 years agoFix an issue with the SQLite Expert extension when a column has no
drh [Thu, 8 Jul 2021 12:12:39 +0000 (12:12 +0000)] 
Fix an issue with the SQLite Expert extension when a column has no
collating sequence.
[forum:/forumpost/78165fa250|Forum post 78165fa250].

FossilOrigin-Name: b1e0c22ec981cf5f8a6597abc6711b1a25019dd51de31129fbc504d3dc743bb4

3 years agoFix a harmless compiler warning in the "fuzzcheck" test program.
drh [Wed, 7 Jul 2021 19:44:32 +0000 (19:44 +0000)] 
Fix a harmless compiler warning in the "fuzzcheck" test program.

FossilOrigin-Name: 8c432642572c8c4b7251f413def0725b3b8e9e7fe10230aa0aabe86b58e5902d

3 years agoFix a harmless compiler warning - duplicate local variable named "pRHS".
drh [Wed, 7 Jul 2021 19:40:18 +0000 (19:40 +0000)] 
Fix a harmless compiler warning - duplicate local variable named "pRHS".

FossilOrigin-Name: 5bc05faf279e0c98be83cb6d56f669a60ff515c8244fca6280991ed0dc5e7ae7

3 years agoFollow-up to [68db1ff9c44fa9c3]: The number of registers needed by
drh [Wed, 7 Jul 2021 16:48:24 +0000 (16:48 +0000)] 
Follow-up to [68db1ff9c44fa9c3]:  The number of registers needed by
PRAGMA foreign_key_check was increased too late for an assert() deep
down inside of sqlite3ExprCode().  So move the size increase a little
earlier.
[forum:/forumpost/79c9e4797d|Forum post 79c9e4797d].

FossilOrigin-Name: 7072404ad0267b8ee774b2804ea59ea28e29316521d76d76a701595e51d1be97

3 years agoFix a recently introduced segfault that might occur if a sub-select were used as...
dan [Wed, 7 Jul 2021 15:52:44 +0000 (15:52 +0000)] 
Fix a recently introduced segfault that might occur if a sub-select were used as a term on the RHS of an IN(...) operator for which the LHS is a row-value.

FossilOrigin-Name: f586c06a5d03943db32add4d3d058a5aa09c819870b29cd8b54cf69433a8cdb1

3 years agoImprove the error message in cases where there is a row-value on the LHS of an IN...
dan [Wed, 7 Jul 2021 13:53:55 +0000 (13:53 +0000)] 
Improve the error message in cases where there is a row-value on the LHS of an IN() operator, the RHS is a list (not a sub-select) and at least one element of the list is not a row-value with the correct number of elements.

FossilOrigin-Name: 6b22f4e71dbc14c887ebbda67095b5faaa8079cac87cd4ab5a2ae90c71cd9633

3 years agoInstead of disallowing writes to fts5 tables if there are fts5vocab cursors open...
dan [Wed, 7 Jul 2021 11:51:03 +0000 (11:51 +0000)] 
Instead of disallowing writes to fts5 tables if there are fts5vocab cursors open on them (commit [c49a6ed7]), abort any fts5vocab queries if the on-disk structure of the fts5 table changes.

FossilOrigin-Name: 9dbdc9001e3258e71ca995fbcdebf66ab95890ded87fa7125c6cb4bd43010aaf

4 years agoHandle "<vector> IN (<vector>, <vector> ...)" in the same way as "<vector> IN (VALUES...
dan [Tue, 6 Jul 2021 20:44:32 +0000 (20:44 +0000)] 
Handle "<vector> IN (<vector>, <vector> ...)" in the same way as "<vector> IN (VALUES(<vector>, <vector>, ...)".

FossilOrigin-Name: 981d230ece98ce89502dab02aa44f73699a9d0e4fce3e9e9dfd47444a5a9990f

4 years agoDo not allow writes to an fts5 table if there are any open fts5vocab cursors.
dan [Mon, 5 Jul 2021 19:01:09 +0000 (19:01 +0000)] 
Do not allow writes to an fts5 table if there are any open fts5vocab cursors.

FossilOrigin-Name: c49a6ed78a917d4972e048e2a9bbe4d400691f97ce7e022f0e4436ceaed7fb73

4 years agoAdd the ATOMIC_INTRINSICS compile-time output output. Move sqlite3Int.h
drh [Mon, 5 Jul 2021 18:37:37 +0000 (18:37 +0000)] 
Add the ATOMIC_INTRINSICS compile-time output output.  Move sqlite3Int.h
in front of ctime.c so that default values that are not overridden are
shown in PRAGMA compile-time option output.

FossilOrigin-Name: e306952690bfb140e2c404a74b05ff2d070c487f7e52c62d62a004505fba0e15

4 years agoRevert [5204c2c4a7b73a64], restoring the old pre-processor logic for determining...
dan [Mon, 5 Jul 2021 17:15:38 +0000 (17:15 +0000)] 
Revert [5204c2c4a7b73a64], restoring the old pre-processor logic for determining the availability of the __atomic_store_n()/__atomic_load_n() primitives.

FossilOrigin-Name: e690abb9e4e189c41182ac813115d55d811135013f5ce94ec0c45a547597f8ad

4 years agoAllow sub-queries in the FROM clause of an UPDATE...FROM statement to access the...
dan [Mon, 5 Jul 2021 11:27:13 +0000 (11:27 +0000)] 
Allow sub-queries in the FROM clause of an UPDATE...FROM statement to access the object being updated without using an alias, as is required in the parent query.

FossilOrigin-Name: 740cb43025449b7d7b47a97ad00885e54b7701cbcb14f4a50c7523022e3936d5

4 years agoImproved rebustness in sqlite3ExprListDup() when it contains a vector assignment
drh [Mon, 5 Jul 2021 02:40:29 +0000 (02:40 +0000)] 
Improved rebustness in sqlite3ExprListDup() when it contains a vector assignment
from an UPDATE where the initial term is omitted.  This can happen during a
UNION ALL query flattening while processing a virtual table update in which
the first term of the vector is repeated.
[forum:/forumpost/16ca0e9f32|Forum post 16ca0e9f32].

FossilOrigin-Name: 2547cfe38f8fb35109b3fc5bdfada387fe4b2b8a304156b704ab7f03f1f71198

4 years agoEnsure that TK_SELECT_COLUMN Expr nodes always have their iTable field set to
drh [Mon, 5 Jul 2021 01:11:26 +0000 (01:11 +0000)] 
Ensure that TK_SELECT_COLUMN Expr nodes always have their iTable field set to
to the number of columns in the vector. This is not strictly necessary. It
just simplifies the state description and make the code easier to reason about.

FossilOrigin-Name: 026f08d4cff19a95e0f38f2ef431cacd65c7c77ed92e30d7f2ded84651f47150

4 years agoFix an incorrect comment on testcase misc1-27.0. No changes to code.
drh [Mon, 5 Jul 2021 00:07:39 +0000 (00:07 +0000)] 
Fix an incorrect comment on testcase misc1-27.0.  No changes to code.

FossilOrigin-Name: 49829ae3229b7c7c7adeaa970a84aebd5157bc93b38fd6d80d86cc03f5fdde6f

4 years agoEnhance the treeview debugging mechanism so that it correctly deals with
drh [Sun, 4 Jul 2021 22:33:08 +0000 (22:33 +0000)] 
Enhance the treeview debugging mechanism so that it correctly deals with
TK_ROW expression nodes.

FossilOrigin-Name: e87fdb6514b6f6775a5a36ca0ec5c920eeaba9e3b842dffa327e970b27cd036d

4 years agoFix a (harmless) typo in a comment. No code changes.
drh [Sat, 3 Jul 2021 18:57:40 +0000 (18:57 +0000)] 
Fix a (harmless) typo in a comment.  No code changes.

FossilOrigin-Name: d2b9b8daa3b87c3dba1329e2f2f44b60d6b5bb9a49d741045aa20cc7813446b2

4 years agoIn the PRAGMA foreign_key_check, ensure that sufficient registers are
drh [Sat, 3 Jul 2021 02:55:47 +0000 (02:55 +0000)] 
In the PRAGMA foreign_key_check, ensure that sufficient registers are
allocated for the virtual machine, even if one or more foreign keys reuses
the same column multiple times and has more columns than the table it is part
of.  [forum:/forumpost/a6b0c05277|Forum post a6b0c05277].

FossilOrigin-Name: 68db1ff9c44fa9c37690ce55ad304d4263ba6fac490063d9e08470de6c17cfe6

4 years agoPut ALWAYS() on a branch that is always true due to [d4097364c511709b].
drh [Fri, 2 Jul 2021 12:25:30 +0000 (12:25 +0000)] 
Put ALWAYS() on a branch that is always true due to [d4097364c511709b].
Fix a testcase precondition associated with the same check-in.

FossilOrigin-Name: 55e2fbebb0a2c9991feef46f31e79b82a24de272aae836bf4d3c06ee06ef1a70

4 years agoFix a harmless assertion fault discovered by
drh [Fri, 2 Jul 2021 12:08:12 +0000 (12:08 +0000)] 
Fix a harmless assertion fault discovered by
[https://oss-fuzz.com/testcase-detail/5517690440646656|OSSFuzz].  The
assertion fault is harmless because the assert() checks a condition that
that is harmless if false and the assert() is disabled in production
builds.

FossilOrigin-Name: 79443aabe1db8cc2ff9537fde0dac0e858eae3f3848ee9cc1b8fba47b824bf08

4 years agoAllow unqualified "rowid" references to be used in join queries, provided that only...
dan [Thu, 1 Jul 2021 18:19:17 +0000 (18:19 +0000)] 
Allow unqualified "rowid" references to be used in join queries, provided that only one of the source objects has a rowid.

FossilOrigin-Name: d4097364c511709b1874881a0c036640777d1f724165416adf6f53a41f8c6e40

4 years agoImport the updated nmakehlp.c file used by the TCL Extension Architecture (TEA)
drh [Thu, 1 Jul 2021 16:57:48 +0000 (16:57 +0000)] 
Import the updated nmakehlp.c file used by the TCL Extension Architecture (TEA)
builds in the amalgamation tarballs.
[forum:/forumpost/5a5001f20a|Forum post 5a5001f20a].

FossilOrigin-Name: 595bf95bf8884c545e85e3feee6f43503b59d3c6d69073f0aaba4473c7c61cac

4 years agoFix a memory leak in fts5 that could occur when processing a query containing multipl...
dan [Wed, 30 Jun 2021 14:04:25 +0000 (14:04 +0000)] 
Fix a memory leak in fts5 that could occur when processing a query containing multiple classes of error.

FossilOrigin-Name: 7c279670f544a5bb9733a88862d9e490062b07415cd790e0d6d1e2cb584d2007

4 years agoFix an assert() in fts5 that might fail when dealing with corrupt records.
dan [Wed, 30 Jun 2021 12:11:19 +0000 (12:11 +0000)] 
Fix an assert() in fts5 that might fail when dealing with corrupt records.

FossilOrigin-Name: 9e760e256089c0ebbf816a8de8b186f62e1ffcd6b8b0e76dab8387798cd4d0e1

4 years agoDo not enforce the SQLITE_LIMIT_FUNCTION_ARG limit for internally generated
drh [Wed, 30 Jun 2021 11:53:21 +0000 (11:53 +0000)] 
Do not enforce the SQLITE_LIMIT_FUNCTION_ARG limit for internally generated
SQL.  This prevents problems with statements like ALTER TABLE if the
function argument limit is set too low.
[forum:/forumpost/17735aa21f3ddab2|Forum post 17735aa21f3ddab2].

FossilOrigin-Name: 763fdec5b3151eeab001c50e78f654cd9b4b4c10e81e50a663046a70e64d5339

4 years agoWhen generating data for a RETURNING clause, avoid assuming cursor number 0 is availa...
dan [Mon, 28 Jun 2021 15:25:17 +0000 (15:25 +0000)] 
When generating data for a RETURNING clause, avoid assuming cursor number 0 is available for use.

FossilOrigin-Name: 4b2c59acce6ff1bb6c9c04c45c80945ae23a26588718cc20635d60f7497adabb

4 years agoThe OP_ReopenIdx opcode should clear the cursor if the cursor is being
drh [Fri, 25 Jun 2021 14:48:24 +0000 (14:48 +0000)] 
The OP_ReopenIdx opcode should clear the cursor if the cursor is being
reused.  This prevents leaving the cursor in an initialized state which
could cause problems for a subsequent OP_SeekScan opcode.
Fix for ticket [6dcbfd11cf666e21] and the OP_SeekScan optimization
of check-in [4a43430fd23f8835].

FossilOrigin-Name: d4bf5243f2bf0a2bc77ad12f3e1e4797cb62f2745f9d54eee5f675c3b5f80880

4 years agoRemove a redundant "ANALYZE" line from the ".fullschema" output.
drh [Fri, 25 Jun 2021 11:21:21 +0000 (11:21 +0000)] 
Remove a redundant "ANALYZE" line from the ".fullschema" output.

FossilOrigin-Name: 7b47f420954000ce46d05adde6e91a2fbdab8dd528ebd8089cca4fcf9d8a3605

4 years agoFix a bug in the ".fullschema" dot-command of the CLI brought to light by
drh [Fri, 25 Jun 2021 11:14:10 +0000 (11:14 +0000)] 
Fix a bug in the ".fullschema" dot-command of the CLI brought to light by
check-in [a2ddb89b206c1387] - raising an error on at attempt to access the
rowid of a subquery or view.

FossilOrigin-Name: 36875827a416067e1b8ffba0ff0ff88313177f8d84dd8e5bc9c23ea3f2d587ba

4 years agoDocument sqlite3_wal_hook() return.
larrybr [Fri, 25 Jun 2021 00:25:38 +0000 (00:25 +0000)] 
Document sqlite3_wal_hook() return.

FossilOrigin-Name: 8acaf7964551b4524fcdbb8d01fae7b0911508ecf6dcf23c3e0f8d8c790b78d8

4 years agoAllow the SQLITE_OPEN_EXCLUSIVE flag in sqlite3_open(). Return the
drh [Thu, 24 Jun 2021 18:23:54 +0000 (18:23 +0000)] 
Allow the SQLITE_OPEN_EXCLUSIVE flag in sqlite3_open().  Return the
SQLITE_CANTOPEN_EXISTS extended code to indicate that the open failed because
the database already exists.

FossilOrigin-Name: d091150ff80709a1e50e0431aa33021f036979e4a88e9769eeec431dfad6d5f5

4 years agoMake conditional nature of sqlite3_normalized_sql() better known.
larrybr [Wed, 23 Jun 2021 17:41:38 +0000 (17:41 +0000)] 
Make conditional nature of sqlite3_normalized_sql() better known.

FossilOrigin-Name: 0e0ece7111945d61278e60385f883303b593ed0d64beeb951b9c49f243531628

4 years agoFully incorporate *_changes64() API improvement.
larrybr [Wed, 23 Jun 2021 16:07:20 +0000 (16:07 +0000)] 
Fully incorporate *_changes64() API improvement.

FossilOrigin-Name: 6699a2f6bec9dfcdc456ff1cd8e652588b144ec28b7eac6e403a63eab61b416e

4 years agoShow CROSS JOINs in the TreeView debuggingn output.
drh [Wed, 23 Jun 2021 11:39:00 +0000 (11:39 +0000)] 
Show CROSS JOINs in the TreeView debuggingn output.

FossilOrigin-Name: 72e09b6c9b74c8226b231fec021228af6bc191fc1b5798d0ff2e893f4ba203bf

4 years agoFix a problem handling ORDER BY terms of the form "ORDER BY likely(<integer>)" within...
dan [Wed, 23 Jun 2021 11:12:48 +0000 (11:12 +0000)] 
Fix a problem handling ORDER BY terms of the form "ORDER BY likely(<integer>)" within window frames.

FossilOrigin-Name: 710f75b98bb4ac5bfdfa745c1de832dd1e4d9fb387da52b2f0d1353613f5cdc3

4 years agoWhen an index is used by all branches of the WHERE_MULTI_OR optimization and
drh [Tue, 22 Jun 2021 23:24:58 +0000 (23:24 +0000)] 
When an index is used by all branches of the WHERE_MULTI_OR optimization and
becomes a covering index, make sure the index has been created prior to
NULLing it in the OP_NullRow opcode of a LEFT JOIN.  See
[forum:/forumpost/0575376e07|forum post 0575376e07]. The covering-index for
WHERE_MULTI_OR optimization was added by [62678be3df35cdcb].  Test cases are
in the orindex01.test module of TH3.

FossilOrigin-Name: 787c76a865dc51dbca4f30432d64783199c2efb1df4619e4bbaf32182977321e

4 years agoAdd the sqlite3_changes64() and sqlite3_total_changes64() API functions.
dan [Tue, 22 Jun 2021 18:32:05 +0000 (18:32 +0000)] 
Add the sqlite3_changes64() and sqlite3_total_changes64() API functions.

FossilOrigin-Name: 48fdec22c966003f5577e0bf52906ef90df11e4e395723a646304e67ed976f37

4 years agoFix a problem causing sqlite3_changes() to return an incorrect value following a...
dan [Tue, 22 Jun 2021 18:06:23 +0000 (18:06 +0000)] 
Fix a problem causing sqlite3_changes() to return an incorrect value following a "DELETE FROM tbl" command on an intkey table (because internal b+tree cells were being included in the count).

FossilOrigin-Name: f662ff4746aaa43e63e20710b8cbfeeceab3183e953ac1685c41846d2e9d124c

4 years agoEnsure that the cell array used in balance_nonroot() is always large enough, even...
dan [Tue, 22 Jun 2021 14:59:34 +0000 (14:59 +0000)] 
Ensure that the cell array used in balance_nonroot() is always large enough, even if the pages being balanced are corrupt.

FossilOrigin-Name: 53f64e83b39cb56ac7211ffc80d06da13318e1da9dbca7b9123954f5be229a0d

4 years agoLoad recent dbsqlfuzz cases into test/fuzzdata8.db.
drh [Sun, 20 Jun 2021 22:52:51 +0000 (22:52 +0000)] 
Load recent dbsqlfuzz cases into test/fuzzdata8.db.

FossilOrigin-Name: a766bba0eead47e9ff24b6afd152a7fbd331261e04dd76feb9510585a08c5786

4 years agoRemove a NEVER() that is reachable by a corrupt database.
drh [Sun, 20 Jun 2021 22:49:26 +0000 (22:49 +0000)] 
Remove a NEVER() that is reachable by a corrupt database.
dbsqlfuzz 8456a0f88e39a49fb675d8f77394979ebb2a03c1.  Test case in TH3.

FossilOrigin-Name: 1c41e86fa102ec2b73fb7a55357ba6328fda37af316215e8808be88e2d1fd75f

4 years agoDo not allow an SQLITE_CORRUPT error to mask a prior SQLITE_IOERR in
drh [Sun, 20 Jun 2021 22:17:49 +0000 (22:17 +0000)] 
Do not allow an SQLITE_CORRUPT error to mask a prior SQLITE_IOERR in
balance_nonroot().  dbsqlfuzz 5e1c86e7f18023f2b9abe3429977d7ea726f50d8

FossilOrigin-Name: 50e818767e423991b99b3155cb15a0d1c1b744ab6139a8273f9348aab9a53d9c

4 years agoRemove unnecessary (redundant) variable initialization from
drh [Sat, 19 Jun 2021 20:20:23 +0000 (20:20 +0000)] 
Remove unnecessary (redundant) variable initialization from
sqlite3BtreeInsert() for a small size reduction and performance increase.

FossilOrigin-Name: 70d1836474207fa045ff7aa513839c9df26ea6e180eb898b30d89bd5b3833f58

4 years agoThe previous check-in is a significant change to btree, so go ahead and
drh [Sat, 19 Jun 2021 18:35:20 +0000 (18:35 +0000)] 
The previous check-in is a significant change to btree, so go ahead and
increment the version number for the next development cycle.

FossilOrigin-Name: 2eb6697051c13bf0cc3772fd6c16bfdea0be3b01c0d985e05004c04eaf7a4a48

4 years agoSplit the sqlite3BtreeMovetoUnpacked() routine into two separate routines
drh [Sat, 19 Jun 2021 18:32:20 +0000 (18:32 +0000)] 
Split the sqlite3BtreeMovetoUnpacked() routine into two separate routines
sqlite3BtreeTableMoveto() and sqlite3BtreeIndexMoveto(), since we usually
know the type of btree in advance.  This results in less branching and
better performance.

FossilOrigin-Name: 3b0d34e5e5f9a16c3397e4551f3b534729b1b375770f05f6ed5847818b1f4c0b

4 years agoVersion 3.36.0 version-3.36.0
drh [Fri, 18 Jun 2021 18:36:39 +0000 (18:36 +0000)] 
Version 3.36.0

FossilOrigin-Name: 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5

4 years agoAdd an ALWAYS on a branch in STAT4-only logic that is now always
drh [Wed, 16 Jun 2021 19:23:24 +0000 (19:23 +0000)] 
Add an ALWAYS on a branch in STAT4-only logic that is now always
true due to check-in [c21bc5a2353e660f].

FossilOrigin-Name: 7bd55eee1ac63cf6d5699ce85bc5a29bf51afdf7a80bce44937fa833947a40f4

4 years agoOmit a handful of tests from pager1.test when testing SQLITE_ENABLE_ZIPVFS builds.
dan [Wed, 16 Jun 2021 18:58:01 +0000 (18:58 +0000)] 
Omit a handful of tests from pager1.test when testing SQLITE_ENABLE_ZIPVFS builds.

FossilOrigin-Name: c3036c28259c1375cd2c480c9ca0ce7f9aa1e952be4f110dde49b2b7d72a43b7

4 years agoDo not run test file sessionbig.test on 32-bit platforms. It uses too much memory.
dan [Wed, 16 Jun 2021 16:56:56 +0000 (16:56 +0000)] 
Do not run test file sessionbig.test on 32-bit platforms. It uses too much memory.

FossilOrigin-Name: 75e53215fe436999cdc70434c6ae96d3ce6642c71528cce9f5715fe1b1b81876

4 years agoAdjust the mkshellc.tcl script so that the generated code always uses
drh [Wed, 16 Jun 2021 15:56:09 +0000 (15:56 +0000)] 
Adjust the mkshellc.tcl script so that the generated code always uses
unix-style line endings.

FossilOrigin-Name: 9f69af4dbcb273519fa87b7868f3792560fb71b192f4ffe53b8b465334da5ae4

4 years agoAvoid ominous warning in showdb.c
larrybr [Wed, 16 Jun 2021 13:26:40 +0000 (13:26 +0000)] 
Avoid ominous warning in showdb.c

FossilOrigin-Name: f8d7ac0104b76555142ce0d32714594f42d19b311dce2f77f42f92756b5e0c93

4 years agoAdjustments to requirement markings in comments. No changes to code.
drh [Wed, 16 Jun 2021 12:26:01 +0000 (12:26 +0000)] 
Adjustments to requirement markings in comments.  No changes to code.

FossilOrigin-Name: be00e45b723adf64bc78927dc12de3116fd04912a52e5c105a52f235c57698f5

4 years agoEnhanced defense against integer overflow in ALTER TABLE.
drh [Wed, 16 Jun 2021 11:32:54 +0000 (11:32 +0000)] 
Enhanced defense against integer overflow in ALTER TABLE.

FossilOrigin-Name: fb7f094e4e0f03622c2e7fa02483c17671a8899c7ad8aba8659177180f406704

4 years agoFix some #ifdefs so that builds work for all supported compile-time options.
drh [Tue, 15 Jun 2021 20:10:25 +0000 (20:10 +0000)] 
Fix some #ifdefs so that builds work for all supported compile-time options.

FossilOrigin-Name: ca7d78f7818b4754fd04ea2b618dee1f01e11c6a5acb54951217c0d03df8e187

4 years agoFix an incorrect ifdef in the previous check-in. ifdef-update
drh [Tue, 15 Jun 2021 20:07:16 +0000 (20:07 +0000)] 
Fix an incorrect ifdef in the previous check-in.

FossilOrigin-Name: 4b2bb46730393292364b2be7db4e73fc8f93cd5a141aaf04f20fe0119deb5ab3

4 years agoFix some minor #ifdef issues so that all of the supported compile-time
drh [Tue, 15 Jun 2021 18:46:06 +0000 (18:46 +0000)] 
Fix some minor #ifdef issues so that all of the supported compile-time
options continue to build.

FossilOrigin-Name: d8cf407046f20b0398f19acd0dab6acb6c742911e21e1003cb5b194dd668d98e

4 years agoUpdate the "nmakehlp.c" utility program sources associated with the TCL
drh [Tue, 15 Jun 2021 15:36:05 +0000 (15:36 +0000)] 
Update the "nmakehlp.c" utility program sources associated with the TCL
Extension Architecture, obtained from
[https://core.tcl-lang.org/sampleextension/file].  Perhaps this new
version will sit better with salmonx's static analyzer
[forum:/forumpost/7f0beca9797ee23a|(ref1)],
[forum:/forumpost/7d5c8b19231ad57f|(ref2)].

FossilOrigin-Name: 603b851d7d923d71543760b09a55d72dbbc185ac9c353c954c331c0454992c80

4 years agoAdd NULL checks on all sqlite3_vfs_find(0) calls. This is not strictly
drh [Tue, 15 Jun 2021 15:15:40 +0000 (15:15 +0000)] 
Add NULL checks on all sqlite3_vfs_find(0) calls.  This is not strictly
necessary.  There are no vulnerabilities here.  However, adding these
checks avoids unnecessary static analyzer complaints.
[forum:/forumpost/ce1193be15|Forum post ce1193be15].

FossilOrigin-Name: 272a15b9f418fb0b31a9808f7c42c20cf52318035ff98935d8e8519634357e8d

4 years agoPrevent an infinite loop in the trim() SQL function if the second argument
drh [Tue, 15 Jun 2021 14:34:21 +0000 (14:34 +0000)] 
Prevent an infinite loop in the trim() SQL function if the second argument
is a carefully malformed UTF8 string.

FossilOrigin-Name: 829343c26ed7b87fafc70de3369625209bad91e79bb7ca2946d5c8d61cc1c3c4

4 years agoFix typos in testcase() macros from check-in [c09d90eec2a49b94].
drh [Mon, 14 Jun 2021 20:49:33 +0000 (20:49 +0000)] 
Fix typos in testcase() macros from check-in [c09d90eec2a49b94].

FossilOrigin-Name: d4d9869c30710914b7ba51221b2c2223a9cf16b913bd6f3866ae747494a116af

4 years agoIn the authorizer, use SQLITE_DROP_INDEX, not SQLITE_DROP_TEMP_INDEX
drh [Mon, 14 Jun 2021 20:41:20 +0000 (20:41 +0000)] 
In the authorizer, use SQLITE_DROP_INDEX, not SQLITE_DROP_TEMP_INDEX
when dropping an index in an attached database.

FossilOrigin-Name: e5a5acd6006133c5da4a7dd79726dbaa41c0d60ebeda890f848a6aafe5f9ef70

4 years agoFix an ALTER TABLE problem with handling infinite loops of CTEs in the database schema.
dan [Mon, 14 Jun 2021 20:08:48 +0000 (20:08 +0000)] 
Fix an ALTER TABLE problem with handling infinite loops of CTEs in the database schema.

FossilOrigin-Name: c09d90eec2a49b948c60971294d146db5c82438855cd3fa48ddc3d2e6b44c26c

4 years agoFix a test script problem in corruptN.test.
dan [Mon, 14 Jun 2021 14:52:27 +0000 (14:52 +0000)] 
Fix a test script problem in corruptN.test.

FossilOrigin-Name: 3ddfe9ae55e6d0d922fbc209768b2ac4a4792f0f63af9a8fb53d66a4b8f1d94b

4 years agoAn index on the expression "likely(X)" should store the true value of X,
drh [Mon, 14 Jun 2021 14:00:09 +0000 (14:00 +0000)] 
An index on the expression "likely(X)" should store the true value of X,
even if X is a real number with no fractional part.  The optimization of
storing some REAL indexed values as INT (see [10d851353c2abead]) should
be omitted for index columns that are expressions.
[forum:/forumpost/3b940c437a|Forum post 3b940c437a].

FossilOrigin-Name: 791473bc6677c2ae76f558082a4b43ca1eaf9895b76624d5b55d58f2af898ff3

4 years agoAvoid allocating oversized column names in the sqllimit1.test module.
drh [Mon, 14 Jun 2021 11:20:30 +0000 (11:20 +0000)] 
Avoid allocating oversized column names in the sqllimit1.test module.

FossilOrigin-Name: 7068f1f69b4feef49260e80902e6bdae47c21a0daa16c96ed1a0984dd1f14cdc

4 years agoThe opcode that preceeds OP_SeekScan is usually OP_IdxGT but can sometimes
drh [Sun, 13 Jun 2021 19:14:14 +0000 (19:14 +0000)] 
The opcode that preceeds OP_SeekScan is usually OP_IdxGT but can sometimes
be OP_IdxGE.  Adjust asserts accordingly.  Follow-up to
[9a2ab6092d644fc3].  dbsqlfuzz e41762333a4d6e90a49e628f488d0873b2dba4c5

FossilOrigin-Name: d6803ed8dc4b1eb4d4dc100728acb4a4aa1479732f0fcb94eb23b7f7702ef65c

4 years agoImproved defense against OOM errors in sqliteInitOne().
drh [Sun, 13 Jun 2021 17:55:58 +0000 (17:55 +0000)] 
Improved defense against OOM errors in sqliteInitOne().
dbsqlfuzz 429db39cd5777c46479641e8637c48c62890042d

FossilOrigin-Name: b6c57e0e2a9658417a0a5548e73007faa59c837b9ad87293bc216feef980717a