]> git.ipfire.org Git - thirdparty/sqlite.git/log
thirdparty/sqlite.git
7 years agoDo not flatten sub-queries that contain window functions.
dan [Fri, 8 Jun 2018 16:11:55 +0000 (16:11 +0000)] 
Do not flatten sub-queries that contain window functions.

FossilOrigin-Name: 236cb75bd1f0d5eb86aa5f52d8d548e7263c34633833dcea9dfc934f142113b8

7 years agoFixes to allow group_concat() to be used as a window function.
dan [Fri, 8 Jun 2018 11:45:28 +0000 (11:45 +0000)] 
Fixes to allow group_concat() to be used as a window function.

FossilOrigin-Name: 89bbc9ba8f66853a7530453f146c9df1baacd8558468016cefa7602911f7578a

7 years agoMerge latest trunk changes with this branch.
dan [Thu, 7 Jun 2018 20:35:28 +0000 (20:35 +0000)] 
Merge latest trunk changes with this branch.

FossilOrigin-Name: 251022034219819a1dc356542770ff46e3147a080f072eb20af6106771dadd92

7 years agoAdd window functions lag() and lead().
dan [Thu, 7 Jun 2018 20:08:59 +0000 (20:08 +0000)] 
Add window functions lag() and lead().

FossilOrigin-Name: ef34207073c21ce8618486777671ae78d23f290acd6d3c37e91a49b69cb506ac

7 years agoThe IN-early-out optimization: When doing a look-up on a multi-column index
drh [Thu, 7 Jun 2018 18:13:49 +0000 (18:13 +0000)] 
The IN-early-out optimization:  When doing a look-up on a multi-column index
and an IN operator is used on a column other than the left-most column, then
if no rows match against the first IN value, check to make sure there exist
rows that match the columns to the right before continuing with the next IN
value.

FossilOrigin-Name: 09fffbdf9f2f6ce31a22d5a6df7a45f19a16628da622f12d6e33171cce09fb21

7 years agoFix the assert()s in the byte-code engine that prove that cursors multikey-opt-idea
drh [Thu, 7 Jun 2018 18:01:21 +0000 (18:01 +0000)] 
Fix the assert()s in the byte-code engine that prove that cursors
are unidirectional.

FossilOrigin-Name: 4b0b4e14039469b656662312a5f80f086ede293e9ad04c7bc99a202b683a1e55

7 years agoAdd support for window function first_value().
dan [Thu, 7 Jun 2018 17:45:22 +0000 (17:45 +0000)] 
Add support for window function first_value().

FossilOrigin-Name: 060b26402880daab085ad01f5f0dbde957c7a22cd219be5b8ec94fba883051a0

7 years agoRemove the NextIfOpen and PrevIfOpen opcodes which are no longer needed
drh [Thu, 7 Jun 2018 17:32:59 +0000 (17:32 +0000)] 
Remove the NextIfOpen and PrevIfOpen opcodes which are no longer needed
when the IN-early-out optimization is working.

FossilOrigin-Name: 439c8162272795b422a0e01b01b832fbc12b39914c9632a674162af8bdecff98

7 years agoTest cases.
drh [Thu, 7 Jun 2018 16:07:00 +0000 (16:07 +0000)] 
Test cases.

FossilOrigin-Name: 085e863713a3f2d420c0076b275a6ac445a59d4d93f9eb0e8503b4e3f5589249

7 years agoFix problems with the nth_value() function.
dan [Thu, 7 Jun 2018 15:54:26 +0000 (15:54 +0000)] 
Fix problems with the nth_value() function.

FossilOrigin-Name: 63002b9a090397668b94fe341a035c42f84e4837af85395bce4cd1c2777c5209

7 years agoMerge the ".stat/.eqp" CLI fix from trunk.
drh [Thu, 7 Jun 2018 15:28:40 +0000 (15:28 +0000)] 
Merge the ".stat/.eqp" CLI fix from trunk.

FossilOrigin-Name: a91cad3381bb843d6f58975251bf99f0fa1a1398fae53d97a98a6c8ee65e718e

7 years agoAvoid using a prepared statement for ".stats on" after it has been closed
drh [Thu, 7 Jun 2018 15:23:43 +0000 (15:23 +0000)] 
Avoid using a prepared statement for ".stats on" after it has been closed
by the ".eqp full" logic.  Fix for ticket [7be932dfa60a8a6b3b26bcf76].

FossilOrigin-Name: bb87c054b1b76959e46258ac66b24027f468b390a4148ac67f208a1fbeda4060

7 years agoAdd the WHERE_IN_EARLYOUT flag and use it to clarify the logic of this
drh [Thu, 7 Jun 2018 14:59:22 +0000 (14:59 +0000)] 
Add the WHERE_IN_EARLYOUT flag and use it to clarify the logic of this
optimization.

FossilOrigin-Name: 522f1eacc20f11002cad58232a7c2610f369568653510e54f46088f579f778dc

7 years agoMerge recent trunk enhancements.
drh [Thu, 7 Jun 2018 14:32:16 +0000 (14:32 +0000)] 
Merge recent trunk enhancements.

FossilOrigin-Name: e9d7bf4f7b9d6f8dabc4c95d43ebf12f2149bed1c5e750048b1b684128073c38

7 years agoChange a comma into a logically equivalent but semantically clearer semicolon.
drh [Wed, 6 Jun 2018 23:31:26 +0000 (23:31 +0000)] 
Change a comma into a logically equivalent but semantically clearer semicolon.

FossilOrigin-Name: 71f97f0f82b3abfb07feb78d64a182fc50ff396e85d6f5aac479dbf58ba4d00a

7 years agoMore space and performance enhancements to sqlite3VdbeRecordCompare().
drh [Wed, 6 Jun 2018 20:55:10 +0000 (20:55 +0000)] 
More space and performance enhancements to sqlite3VdbeRecordCompare().

FossilOrigin-Name: 83a60ff056a63f18479030e9dfb10926fbb0d906d51f2cf88233098e15c75534

7 years agoAdd implementation of nth_value() window function.
dan [Wed, 6 Jun 2018 20:51:02 +0000 (20:51 +0000)] 
Add implementation of nth_value() window function.

FossilOrigin-Name: eb1fb420ac70857e7ca4cbad78be15a27bee8f915ba2da080c7efa1879c06c31

7 years agoSmall performance optimization in sqlite3VdbeRecordCompareWithSkip() for
drh [Wed, 6 Jun 2018 20:29:19 +0000 (20:29 +0000)] 
Small performance optimization in sqlite3VdbeRecordCompareWithSkip() for
the common case where the comparison is equal.

FossilOrigin-Name: 1e616e256a4fb1b64271706fdfa77dc5790eba0a2f0e619544e169bc61d7c805

7 years agoRearrange the order of some checks in the integrity_check pragma for a very
drh [Wed, 6 Jun 2018 19:48:19 +0000 (19:48 +0000)] 
Rearrange the order of some checks in the integrity_check pragma for a very
slight performance gain.

FossilOrigin-Name: 4b853f020570bf4af1b14e03f35764c7d7a03a40af58efc783e06f2b883cef78

7 years agoFix the sqlite3BeginTrans() calls within the snapshot extension.
drh [Wed, 6 Jun 2018 18:50:50 +0000 (18:50 +0000)] 
Fix the sqlite3BeginTrans() calls within the snapshot extension.

FossilOrigin-Name: 1fef7ad25b6a8e59163ac57f5cf0412bfc5b0e9446fd782f5f0a7d7ee11741fc

7 years agoAnother minor optimization to OP_Transaction.
drh [Wed, 6 Jun 2018 17:45:51 +0000 (17:45 +0000)] 
Another minor optimization to OP_Transaction.

FossilOrigin-Name: d80077aee3904e5d93164b342cae14d813de8e84e567462412751e06c7487d41

7 years agoChange sqlite3BtreeBeginTrans() to return the BTREE_SCHEMA_COOKIE, for a
drh [Wed, 6 Jun 2018 16:28:40 +0000 (16:28 +0000)] 
Change sqlite3BtreeBeginTrans() to return the BTREE_SCHEMA_COOKIE, for a
small speed improvement when starting new transactions.

FossilOrigin-Name: a10662aa915ae2b5a78b3e10920350d32255b2d6b1a8aac0aba1ad173b07ed2b

7 years agoFix the ".archive" command in the CLI (and the corresponding -A command-line
drh [Wed, 6 Jun 2018 01:18:01 +0000 (01:18 +0000)] 
Fix the ".archive" command in the CLI (and the corresponding -A command-line
option) so that it silently ignores filenames that contain "../" in their
names.  This prevents the "Zip Slip" attack.

FossilOrigin-Name: 27291f2d7fd4dadf2ee9b9a7d1373158cadfbaf83c3654b00d7030dc921770c6

7 years agoUpdate the version number to 3.25.0 for the next development cycle.
drh [Tue, 5 Jun 2018 23:51:52 +0000 (23:51 +0000)] 
Update the version number to 3.25.0 for the next development cycle.

FossilOrigin-Name: 7598236c356cdb548c6188d69dfef99f7a08b89e512a3addfe1433ccd85e7b68

7 years agoAvoid unnecessary loads of columns in an aggregate query that are not
drh [Tue, 5 Jun 2018 23:21:11 +0000 (23:21 +0000)] 
Avoid unnecessary loads of columns in an aggregate query that are not
within an aggregate function and that are not part of the GROUP BY clause.

FossilOrigin-Name: e15e100660d290249ef235e7a8927b88296e56ec0f80ec626eecbd542adc7633

7 years agoAdd the OP_IfNoHope and OP_SeekHit opcodes used to reduce the number of
drh [Tue, 5 Jun 2018 20:45:20 +0000 (20:45 +0000)] 
Add the OP_IfNoHope and OP_SeekHit opcodes used to reduce the number of
unnecessary sqlite3BtreeMovetoUnpacked() calls when checking for an early
exit on IN-operator loops.  Futher optimizations are likely possible here.

FossilOrigin-Name: 6bf251af4347165a470d39457d61ab6d2a06c206db8f30bd8be5dbb388ae8a5b

7 years agoCalculate non-aggregate expressions in the SELECT list of an aggregate query exp-agg-opt
dan [Tue, 5 Jun 2018 20:04:28 +0000 (20:04 +0000)] 
Calculate non-aggregate expressions in the SELECT list of an aggregate query
that does not use min() or max() once per group, instead of once per row
visited.

FossilOrigin-Name: dce2dfbe1590deb3ef5661230ae2d232bd492441195defbf698ac56f9629211c

7 years agoAdd implementation of last_value() window function.
dan [Tue, 5 Jun 2018 16:16:17 +0000 (16:16 +0000)] 
Add implementation of last_value() window function.

FossilOrigin-Name: 2493ce1a402888f6a8f25e03052c25a4e9bca740639e98cb614f5e5160ac25d3

7 years agoUse an OP_NotFound opcode to cancel futile IN operators early. The current
drh [Tue, 5 Jun 2018 15:16:25 +0000 (15:16 +0000)] 
Use an OP_NotFound opcode to cancel futile IN operators early.  The current
implementation is suboptimal because it always runs teh OP_NotFound.  This
still needs to be enhanced to only do the OP_NotFound if no results have been
seen on the current loop.

FossilOrigin-Name: 87a9fc504f9a78caf7a7949cc7ada0a19d61bfab51bb49a00a1607194c116212

7 years agoMerge trunk changes.
drh [Tue, 5 Jun 2018 13:54:06 +0000 (13:54 +0000)] 
Merge trunk changes.

FossilOrigin-Name: 047295c588e9fdf2ffa4e69e166f177fd193309531dc6a9ac755fb7a763adb72

7 years agoUpdate and correct the documentation on the OP_OpenRead, OP_OpenWrite,
drh [Tue, 5 Jun 2018 13:43:02 +0000 (13:43 +0000)] 
Update and correct the documentation on the OP_OpenRead, OP_OpenWrite,
and OP_ReopenIdx opcodes.  No code changes other than the addition of
an assert().

FossilOrigin-Name: 8a0b730d0ea640d5cf75febe39b2162411a12eb5275765a85882158b5a085681

7 years agoVersion 3.24.0 version-3.24.0
drh [Mon, 4 Jun 2018 19:24:41 +0000 (19:24 +0000)] 
Version 3.24.0

FossilOrigin-Name: c7ee0833225bfd8c5ec2f9bf62b97c4e04d03bd9566366d5221ac8fb199a87ca

7 years agoAdd implementation of window function ntile().
dan [Mon, 4 Jun 2018 18:55:11 +0000 (18:55 +0000)] 
Add implementation of window function ntile().

FossilOrigin-Name: 3f093f608c6cc193aac77e7eafa8006c27a7776682d9d7b6e743710dff41ae42

7 years agoMerge recent changes from trunk.
drh [Mon, 4 Jun 2018 13:27:39 +0000 (13:27 +0000)] 
Merge recent changes from trunk.

FossilOrigin-Name: f8df2a8e28acdd9573a9ffc18027553f35f769a989f5dfbf81f31b0656ee6065

7 years agoMerge latest trunk changes into this branch.
dan [Mon, 4 Jun 2018 08:28:18 +0000 (08:28 +0000)] 
Merge latest trunk changes into this branch.

FossilOrigin-Name: 83d6416a868fac81a78c9507185a48d00920e4322276245e285946f760915f4a

7 years agoAdd support for window function cume_dist(). Improve tests for percent_rank().
dan [Mon, 4 Jun 2018 08:22:09 +0000 (08:22 +0000)] 
Add support for window function cume_dist(). Improve tests for percent_rank().

FossilOrigin-Name: 76543f7dd3a2310f6e81a1bae17db9bb5d2cf10c1b87ed3f8394b3e75576078b

7 years agoAdd support for window functions row_number(), rank(), dense_rank() and
dan [Sat, 2 Jun 2018 21:04:28 +0000 (21:04 +0000)] 
Add support for window functions row_number(), rank(), dense_rank() and
percent_rank().

FossilOrigin-Name: 91c1cb7a217d0991a08256269f6c55ef185c25362d57b36bfbd2d85dab38e58f

7 years agoAvoid using a misaligned pointer.
drh [Sat, 2 Jun 2018 19:14:58 +0000 (19:14 +0000)] 
Avoid using a misaligned pointer.

FossilOrigin-Name: 1ecb3aa13de5c8dc611b814ff34010de0bd90aae73d88aa37a59c4627be4cc2d

7 years agoFix the usage of posix_fallocate() so that it correctly responds to
drh [Sat, 2 Jun 2018 19:01:54 +0000 (19:01 +0000)] 
Fix the usage of posix_fallocate() so that it correctly responds to
EINVAL returns.

FossilOrigin-Name: ce2c3e7a875ede4366c48660ae8239d2b74e5f690ad5059844a45f1164f41e61

7 years agoUpdate a test case in malloc5.test to take into account that malloc()
dan [Sat, 2 Jun 2018 17:00:57 +0000 (17:00 +0000)] 
Update a test case in malloc5.test to take into account that malloc()
sometimes returns slightly more space than requested.

FossilOrigin-Name: 3d5eae1c26353cdee89f31f1293b05c0edb494c775ba0912d9b4fda9ab0ef304

7 years agoWork around a sanitizer warning about a pointer being only 4-byte aligned align8-fix
drh [Sat, 2 Jun 2018 16:32:04 +0000 (16:32 +0000)] 
Work around a sanitizer warning about a pointer being only 4-byte aligned
instead of 8-byte aligned.

FossilOrigin-Name: 1b807b51cdf455b4f54216b73fd22bbc90f94e24222401e045f88cfd27f487e3

7 years agoProposed fix for the use of posix_fallocate() so that it handles EINVAL einval-from-fallocate
drh [Sat, 2 Jun 2018 14:37:39 +0000 (14:37 +0000)] 
Proposed fix for the use of posix_fallocate() so that it handles EINVAL
returns correctly.

FossilOrigin-Name: ab3a5539db82814cafb832cdaebd1e14566139306453ef9cdba6b244a994fe0b

7 years agoFix the CSV extension so that it works with single-column CSV files.
drh [Sat, 2 Jun 2018 12:05:18 +0000 (12:05 +0000)] 
Fix the CSV extension so that it works with single-column CSV files.

FossilOrigin-Name: e336cf00486bdc0ec04ecded2b7c874d73a87e6aba3544e3678bedfb9a4af3b6

7 years agoEnsure that sqlite3AuthRead() is only call for TK_COLUMN and TK_TRIGGER
drh [Sat, 2 Jun 2018 11:31:15 +0000 (11:31 +0000)] 
Ensure that sqlite3AuthRead() is only call for TK_COLUMN and TK_TRIGGER
expression nodes.  This fixes a harmless assert() identified by OSSFuzz.
Move the assert() into a position where it is tested even if the authorizer
is disabled.

FossilOrigin-Name: d0c3beef7cdc680c0768ddd18f766a4ca7be822c1eb1776b2f73b7433d9962dc

7 years agoAllow an entire partition to be cached in a temp table for all types of window
dan [Fri, 1 Jun 2018 21:00:08 +0000 (21:00 +0000)] 
Allow an entire partition to be cached in a temp table for all types of window
frames. This is required by nth_value() and others.

FossilOrigin-Name: b5b18f661341d8d450147e62d321791c706f16c0550bcd98eec3e0220c039189

7 years agoFix a bug in the SQLITE_ENABLE_SORTER_REFERENCES code causing an out-of-bounds
dan [Fri, 1 Jun 2018 13:30:45 +0000 (13:30 +0000)] 
Fix a bug in the SQLITE_ENABLE_SORTER_REFERENCES code causing an out-of-bounds
array reference.

FossilOrigin-Name: 8cadaf587dc96370f9c8a1dccc366b93021e8cfe4526da9368a088828fd14faf

7 years agoMore documentation typo fixes. No code changes.
drh [Thu, 31 May 2018 19:14:52 +0000 (19:14 +0000)] 
More documentation typo fixes.  No code changes.

FossilOrigin-Name: 66c24513c2f6de98bd888c3e4c07bbb39fabf30ea9dd01eb255460054055347d

7 years agoFix a harmless typo in a comment used to generate documentation.
drh [Thu, 31 May 2018 19:00:20 +0000 (19:00 +0000)] 
Fix a harmless typo in a comment used to generate documentation.

FossilOrigin-Name: 5a2a88cb01ef4b299f9a5b2963f392a3bae90e8a7f84b190e67f86090f891e23

7 years agoAllow min() and max() to be used as window functions.
dan [Wed, 30 May 2018 20:44:58 +0000 (20:44 +0000)] 
Allow min() and max() to be used as window functions.

FossilOrigin-Name: c16125a884a9131b707ac20033968c4c3177ea79625a15efb64d754568c6c7a0

7 years agoAdd the Makefile.fallback makefile to the amalgamation tarball.
drh [Wed, 30 May 2018 14:17:09 +0000 (14:17 +0000)] 
Add the Makefile.fallback makefile to the amalgamation tarball.

FossilOrigin-Name: ce3d04563337c9556d66e55acfb454789b0baa49a1be8fcc349251ce88236d62

7 years agoDo not use the codec on the resetdb.test script.
drh [Wed, 30 May 2018 07:36:55 +0000 (07:36 +0000)] 
Do not use the codec on the resetdb.test script.

FossilOrigin-Name: fe55cea0c80ab29120574c5c4a8473b83fc80f79d7e11bc7c326bfdb32aa3902

7 years agoFix a typo in an error message in the CLI.
drh [Wed, 30 May 2018 07:24:41 +0000 (07:24 +0000)] 
Fix a typo in an error message in the CLI.

FossilOrigin-Name: 808839808141493c1e5122f40b2cdff725be0cd1212e03d609345dbff7af03e4

7 years agoFix the parser so that it builds with -DSQLITE_OMIT_CTE.
drh [Wed, 30 May 2018 01:14:20 +0000 (01:14 +0000)] 
Fix the parser so that it builds with -DSQLITE_OMIT_CTE.

FossilOrigin-Name: 86ee267ee86f5264774a9f215b1158aeaa2d605e77c205731b5ee3945d7de4c2

7 years agoFix a harmless compiler warning.
drh [Wed, 30 May 2018 00:59:09 +0000 (00:59 +0000)] 
Fix a harmless compiler warning.

FossilOrigin-Name: 8d02c7a6a09f7520ad180b0d943db475894cd39b0ccdb2ad2c44009d5f25c8a6

7 years agoDemonstration code on a possible technique for optimizing the use of IN
drh [Wed, 30 May 2018 00:54:23 +0000 (00:54 +0000)] 
Demonstration code on a possible technique for optimizing the use of IN
operator on columns to the right of multicolumn indexes.  If the OP_Noop
generated where were really a new opcode that checked to see if there existed
any entries in the index with a matching prefix, it might prevent unnecessary
iterations of the IN operator.

FossilOrigin-Name: 92f0fe155d5546fc7f4a443d0630613dabe149061966308e5420fad652278f16

7 years agoIncrease the number of database handles opened by test script oserror.test to
dan [Tue, 29 May 2018 19:12:58 +0000 (19:12 +0000)] 
Increase the number of database handles opened by test script oserror.test to
provoke an "out of file-descriptors" error to 20000 (from 2000).

FossilOrigin-Name: 3b00f73456c65dfc1827fdada9afb49245f9addfa684d5ae35e69a07f39164bf

7 years agoFix autoinc.test and resetdb.test so that they work with all permutations.
dan [Tue, 29 May 2018 16:37:12 +0000 (16:37 +0000)] 
Fix autoinc.test and resetdb.test so that they work with all permutations.

FossilOrigin-Name: 89f56d6b0a6847b042a1556cdf79c598c9bfdbdd5f9529d508ca7b4d26a6ed38

7 years agoAdd a comment to justify a goto statement. No code changes.
drh [Tue, 29 May 2018 15:18:31 +0000 (15:18 +0000)] 
Add a comment to justify a goto statement.  No code changes.

FossilOrigin-Name: f141d806476aabe592a15d83b72c9409d2cd6bd7f9cced1ea2513c134191430a

7 years agoMore minor changes to test scripts.
dan [Tue, 29 May 2018 14:29:28 +0000 (14:29 +0000)] 
More minor changes to test scripts.

FossilOrigin-Name: ce9b756f09df4feb485bbf9695f8c6774906eb1b2fb45a340b74ffd21c9adfd8

7 years agoFix some test script issues caused by recent EXPLAIN QUERY PLAN enhancements.
dan [Tue, 29 May 2018 14:06:55 +0000 (14:06 +0000)] 
Fix some test script issues caused by recent EXPLAIN QUERY PLAN enhancements.

FossilOrigin-Name: f808e22831c33bfe3d0dd44e209f64d527c23ca7c72be7c694736535afee1317

7 years agoDo not run test file "resetdb.test" as part of permutation "inmemory_journal".
dan [Tue, 29 May 2018 13:25:14 +0000 (13:25 +0000)] 
Do not run test file "resetdb.test" as part of permutation "inmemory_journal".

FossilOrigin-Name: 4921e5bae4c12c3413cc0b2e58766cf2ac117ad95f92fcd1c2457db6cfabb054

7 years agoFurther window frame tests and fixes.
dan [Mon, 28 May 2018 18:30:45 +0000 (18:30 +0000)] 
Further window frame tests and fixes.

FossilOrigin-Name: e74c6e91859ec395c12ba2742542ff176a1d8364dcfb66b862240746bef54efc

7 years agoDo not require a statement journal in cases where REPLACE conflict handling is
dan [Mon, 28 May 2018 18:29:46 +0000 (18:29 +0000)] 
Do not require a statement journal in cases where REPLACE conflict handling is
used to insert a single row, so long as the REPLACE operation cannot fire any
triggers or foreign key actions.

FossilOrigin-Name: 469a62ca33081854e54f3af6d93ab5a350484b149c8c8c4ee8be0ae5418382d9

7 years agoWhen compiling with SQLITE_DEBUG, add run-time checks to ensure that no statement...
drh [Mon, 28 May 2018 18:25:19 +0000 (18:25 +0000)] 
When compiling with SQLITE_DEBUG, add run-time checks to ensure that no statement aborts unless either there have been no writes or else there is a statement journal.

FossilOrigin-Name: ce99c7724460b9cf4ccaf7f6bc1a522b5c34d5ad0683d465f7926b10f31f7d05

7 years agoFix the build so that it works with -DSQLITE_TEST_REALLOC_STRESS stmt-journal-testing
drh [Mon, 28 May 2018 17:43:28 +0000 (17:43 +0000)] 
Fix the build so that it works with -DSQLITE_TEST_REALLOC_STRESS

FossilOrigin-Name: 90ba2b2e5ce2619e68879eb325b43639159f27eb462b9fb6795534c91200a3d2

7 years agoWhen compiling with SQLITE_DEBUG, add run-time checks to ensure that no
drh [Mon, 28 May 2018 17:31:20 +0000 (17:31 +0000)] 
When compiling with SQLITE_DEBUG, add run-time checks to ensure that no
statement aborts unless either there have been no writes or else there is
a statement journal.

FossilOrigin-Name: 5a4542dbcf17a9f7fed600897555c271e1651fd50eb41d0b126725b486e1d14c

7 years agoMore fixes for different window frame types.
dan [Sat, 26 May 2018 21:17:29 +0000 (21:17 +0000)] 
More fixes for different window frame types.

FossilOrigin-Name: 2c85668a0f86bcfd3de4c65847ac252e136ce97409a2249c5f4f58e3756e9a69

7 years agoStore application-defined function names as lower-case to avoid the need
drh [Sat, 26 May 2018 16:00:26 +0000 (16:00 +0000)] 
Store application-defined function names as lower-case to avoid the need
for case conversions before calling xFindFunction on virtual tables.
Avoid using lookaside to store the destructors for application defined
functions, as lookaside should be reserved for transient allocations.

FossilOrigin-Name: 777189ce88799f93f393fd14fd716111c85bcdcb23690fd561f78ea2bd2ce5da

7 years agoAdd a single sentence of documentation about the virtual table
drh [Sat, 26 May 2018 13:55:04 +0000 (13:55 +0000)] 
Add a single sentence of documentation about the virtual table
scan flags.  No changes to code.

FossilOrigin-Name: 27b4fa5dd0defc6ddaf5d8cde6a1e1162b70d99bfdc69c1d2290621a6d23ed91

7 years agoFix "RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING" window frame
dan [Fri, 25 May 2018 20:30:17 +0000 (20:30 +0000)] 
Fix "RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING" window frame
processing.

FossilOrigin-Name: b4e9c686697a5211a3bfa47e63f0684e3d4241d8c292cffe1a967bc39ad7cd8f

7 years agoMerge latest trunk changes into this branch.
dan [Fri, 25 May 2018 09:36:27 +0000 (09:36 +0000)] 
Merge latest trunk changes into this branch.

FossilOrigin-Name: 6232519899efc568465d8fcc9fcd79d46a2ce4ec05109d26d5eb1ebd239cd596

7 years agoFixes for "ROWS BETWEEN <expr> FOLLOWING AND <expr> FOLLOWING" and "ROWS
dan [Fri, 25 May 2018 09:29:11 +0000 (09:29 +0000)] 
Fixes for "ROWS BETWEEN <expr> FOLLOWING AND <expr> FOLLOWING" and "ROWS
BETWEEN <expr> FOLLOWING AND UNBOUNDED FOLLOWING"

FossilOrigin-Name: 5ac44872fd5c4f92851e7bf57d7207bb4d67de88ea2b5c746ff97f20bd6352e1

7 years agoWhen doing a one-pass UPDATE or DELETE on virtual tables, close the cursor
drh [Thu, 24 May 2018 23:51:57 +0000 (23:51 +0000)] 
When doing a one-pass UPDATE or DELETE on virtual tables, close the cursor
prior to running VUpdate.  This allows one-pass to work on virtual tables
that do not allow concurrent reads and writes.  Enhance rtree to take
advantage of this new capability.

FossilOrigin-Name: b816023ce07d01024d5769e16db924374a49bf909edd12dc1344a0a1ef693db5

7 years agoNew test case for reading and writing the same rtree concurrently.
drh [Thu, 24 May 2018 22:42:27 +0000 (22:42 +0000)] 
New test case for reading and writing the same rtree concurrently.

FossilOrigin-Name: 3ba08e53d54165f5541756ad13a4c2f0b18516cb612a256e056ed1ff76c1fa83

7 years agoDo not allow RTree writes when a read cursor is active on the same virtual
drh [Thu, 24 May 2018 22:31:01 +0000 (22:31 +0000)] 
Do not allow RTree writes when a read cursor is active on the same virtual
table, as the writes might rebalance and disrupt the read cursors.  Return
the new SQLITE_LOCKED_VTAB error code if this happens.

FossilOrigin-Name: d4ce66610851c825cb712f985216b63e015c753fdd5521f929c67ad18bfd7664

7 years agoAllow "<expr> PRECEDING" to be used to specify the end of a window frame.
dan [Thu, 24 May 2018 21:10:57 +0000 (21:10 +0000)] 
Allow "<expr> PRECEDING" to be used to specify the end of a window frame.

FossilOrigin-Name: 7b709a989c188dbcf429989a0785294b36c8a7e89b5de8cefc25decf1f5b7f5a

7 years agoSupport other frame types that use "<expr> PRECEDING" or "<expr> FOLLOWING" as
dan [Thu, 24 May 2018 17:49:14 +0000 (17:49 +0000)] 
Support other frame types that use "<expr> PRECEDING" or "<expr> FOLLOWING" as
start or end conditions.

FossilOrigin-Name: ec7b648c7f0ee266653561bbb9daa45b9be0d8a1a14f11dc93bce467c35154e6

7 years agoIn the OOM testing logic, add the sqlite3FirstFault() routine as a place to
drh [Thu, 24 May 2018 17:38:00 +0000 (17:38 +0000)] 
In the OOM testing logic, add the sqlite3FirstFault() routine as a place to
set a breakpoint the first time any simulated OOM fault occurs for a single
test case.

FossilOrigin-Name: b4d80bd287ca7f3a6d182ba2435273266035b94fdf6a44047a64a4eff931c571

7 years agoFix a typo in a comment used to generate VDBE opcode documentation. No
drh [Thu, 24 May 2018 17:25:35 +0000 (17:25 +0000)] 
Fix a typo in a comment used to generate VDBE opcode documentation.  No
code changes.

FossilOrigin-Name: 36cdfbf2ce1811691c790fde3eaeed0238c03b4dc97dc3a20d1e0397520145d1

7 years agoAddition cases for rtree preformance testing in speedtest1.c. Add the
drh [Thu, 24 May 2018 16:18:35 +0000 (16:18 +0000)] 
Addition cases for rtree preformance testing in speedtest1.c.  Add the
--nodiff option to the speed-check.sh script.

FossilOrigin-Name: 95f2d62cf3cf8dbe0f12b652b47fe1f8e0f52bc269e269955fafdf802afc47c1

7 years agoUpdates to the sqlite3_vtab_nochange() documentation. No changes to code.
drh [Thu, 24 May 2018 13:59:45 +0000 (13:59 +0000)] 
Updates to the sqlite3_vtab_nochange() documentation.  No changes to code.

FossilOrigin-Name: 5bd99abc10b8153aadff5f815ae15fbe375f34f043c65def4be03014d2efdb50

7 years agoAdd support for "ROWS BETWEEN <expr> PRECEDING AND <expr> FOLLOWING" window
dan [Wed, 23 May 2018 20:55:37 +0000 (20:55 +0000)] 
Add support for "ROWS BETWEEN <expr> PRECEDING AND <expr> FOLLOWING" window
frames.

FossilOrigin-Name: 3a203660f1e4da3b8d2d605c494f4843f6e00752f28042b49e11d7d6550dd406

7 years agoRemove a branch that is no longer used due to the fix to the
drh [Wed, 23 May 2018 17:53:07 +0000 (17:53 +0000)] 
Remove a branch that is no longer used due to the fix to the
sqlite_sequence schema problem, ticket
[d8dc2b3a58cd5dc2918a1d4acbba4676a23ada4c]

FossilOrigin-Name: 066742692a9e8735b814c6a145545f97a7fb10b29cead78e68e25324e79aabaa

7 years agoVerify that the sqlite_sequence table exists and is in approximately the
drh [Wed, 23 May 2018 16:50:21 +0000 (16:50 +0000)] 
Verify that the sqlite_sequence table exists and is in approximately the
correct format prior to using it to process an autoincrement table.
Fix for ticket [d8dc2b3a58cd5dc2918a1d4a].

FossilOrigin-Name: e199e859ace4f8381c6380175206e7a276e3f2228fadbbca9341bca8d2fc445d

7 years agoMerge latest trunk changes into this branch.
dan [Tue, 22 May 2018 20:36:12 +0000 (20:36 +0000)] 
Merge latest trunk changes into this branch.

FossilOrigin-Name: cdb68d2c64e453fdcd29437d5915c5c5ab6fbc7b5ffac52f4cb393f35b4a0124

7 years agoAdd comments to window.c describing how other window frames will be implemented.
dan [Tue, 22 May 2018 20:35:37 +0000 (20:35 +0000)] 
Add comments to window.c describing how other window frames will be implemented.

FossilOrigin-Name: 16168146b202915252f9375aef38e65ca20c5d4aa906e851d4d3a484db57562d

7 years agoBegin adding support for more esoteric window frames.
dan [Mon, 21 May 2018 19:45:11 +0000 (19:45 +0000)] 
Begin adding support for more esoteric window frames.

FossilOrigin-Name: bc4b81d60d40583de0f929730159011c1a7696802532ebd02220de3ace94a60d

7 years agoFix minor problems on this branch.
dan [Sat, 19 May 2018 14:15:29 +0000 (14:15 +0000)] 
Fix minor problems on this branch.

FossilOrigin-Name: 19c2e4b2f164521eab84cb0a0e12984be9431eaedd001dd3671e9ea1a6212353

7 years agoAdd support for auxiliary columns to the rtree extension.
drh [Fri, 18 May 2018 17:58:33 +0000 (17:58 +0000)] 
Add support for auxiliary columns to the rtree extension.

FossilOrigin-Name: c6071ac99cfa4b6272ac4d739fc61a85acb544f6c1c2ae67b31e92aadcc995bd

7 years agoMerge enhancements from trunk, especially the CLI fixes. aux-data-in-rtree
drh [Fri, 18 May 2018 17:17:36 +0000 (17:17 +0000)] 
Merge enhancements from trunk, especially the CLI fixes.

FossilOrigin-Name: a350040a3bb962823f92908fb31cade52baf13eab90ef608ca3a8349e4c28c9d

7 years agoIn the CLI, detect and report errors on sqlite3_close(). Clear global
drh [Fri, 18 May 2018 17:11:50 +0000 (17:11 +0000)] 
In the CLI, detect and report errors on sqlite3_close().  Clear global
variables prior to exit to so that valgrind can better detect resource
leaks.

FossilOrigin-Name: e3b2e0a078b82ac6cd3c3312e8ac0983c1375e1052f1e324476d2f8d1b227c30

7 years agoAvoid unnecessary sqlite3_finalize() operations.
drh [Fri, 18 May 2018 16:53:07 +0000 (16:53 +0000)] 
Avoid unnecessary sqlite3_finalize() operations.

FossilOrigin-Name: 16f71032a3a2919cb226b25b5256a370adb5c55fa506d4774b7f83dc8868e793

7 years agoFix a prepare-statement leak.
drh [Fri, 18 May 2018 16:46:09 +0000 (16:46 +0000)] 
Fix a prepare-statement leak.

FossilOrigin-Name: 95fd296ffc8130526a1453cbdca6ce47f22fc5b5c474aa31d66b627d0c7393a1

7 years agoImproved error messages. Limit the number of auxiliary columns to 100.
drh [Fri, 18 May 2018 15:21:43 +0000 (15:21 +0000)] 
Improved error messages.  Limit the number of auxiliary columns to 100.

FossilOrigin-Name: 059d20abd57727e6d312f15b640359ef778786f577d9b50b17b57195db2d0aef

7 years agoImprovements to integer/float comparisons on architectures that lack a
drh [Fri, 18 May 2018 14:24:23 +0000 (14:24 +0000)] 
Improvements to integer/float comparisons on architectures that lack a
"long double" type.

FossilOrigin-Name: 5139ea62a8a6c6dc6558c337de39bcbadd26f6515742263387be03c862c78cf0

7 years agoRemove incorrect NEVER() macro added by the previous check-in. int-float-compare
drh [Fri, 18 May 2018 14:19:35 +0000 (14:19 +0000)] 
Remove incorrect NEVER() macro added by the previous check-in.

FossilOrigin-Name: 3d6625111319c0356c57aaf7b7460fd882c3f00ca668dc43c0abe3403c7c2ba3

7 years agoImprovements to the sqlite3IntFloatCompare() routine for systems that
drh [Fri, 18 May 2018 13:39:00 +0000 (13:39 +0000)] 
Improvements to the sqlite3IntFloatCompare() routine for systems that
lack the long double type.

FossilOrigin-Name: ea6a03a89dc23e860e53e79ec3fddf0ae7072a23b73aef3d2d181b426566b677

7 years agoIn the CLI with the -A command, if the file does not previously exist and
drh [Thu, 17 May 2018 20:04:24 +0000 (20:04 +0000)] 
In the CLI with the -A command, if the file does not previously exist and
its name looks like a ZIP archive name, then create it as a ZIP archive.

FossilOrigin-Name: 33dc8fad7f2b467f259eb78eb7342a760f01d54d95da7fe4cace10e558788a58

7 years agoEvaluate multiple window functions in a single pass if they use the same
dan [Thu, 17 May 2018 19:24:08 +0000 (19:24 +0000)] 
Evaluate multiple window functions in a single pass if they use the same
window definition. Add xValue callbacks for other built-in aggregate
functions.

FossilOrigin-Name: c9f0f140941660ff368e5bb5752d54feb1964b7a9eac986d4bfb8f24a1c20d86

7 years agoHandle multiple window-functions in a single query.
dan [Thu, 17 May 2018 14:26:27 +0000 (14:26 +0000)] 
Handle multiple window-functions in a single query.

FossilOrigin-Name: 35af0b750e70dcf0f343b115f4bbd0860a7e8064be204d4dfba1a43c22ff07b1