]> git.ipfire.org Git - thirdparty/sqlite.git/log
thirdparty/sqlite.git
5 years agoMerge in recent fixes from trunk. nulls-last
drh [Mon, 26 Aug 2019 20:41:33 +0000 (20:41 +0000)] 
Merge in recent fixes from trunk.

FossilOrigin-Name: ad816d01d4bd3908ff2c574d79d1a29b6d732df308f2f1b1cdf7c0bc7c1bd7cf

5 years agoTweak the shell tool ".recover" command so that it can recover rows that consist...
dan [Mon, 26 Aug 2019 14:57:58 +0000 (14:57 +0000)] 
Tweak the shell tool ".recover" command so that it can recover rows that consist of a rowid and no fields.

FossilOrigin-Name: 279ac7fdec0b1409cd400b7b093f89089d93c49f596f378c6a3032434a85bf83

5 years agoImproved detection of number of column mismatch for vector assignment
drh [Mon, 26 Aug 2019 14:18:28 +0000 (14:18 +0000)] 
Improved detection of number of column mismatch for vector assignment
in UPDATE statements.  Ticket [78acc9d40f0786e8]

FossilOrigin-Name: bd4bda73df3794eef424eb13e08fc7cc54347d1ac69febaeec41f6b6cb4a42bc

5 years agoFix typo in a comment. No code changes.
drh [Mon, 26 Aug 2019 13:45:49 +0000 (13:45 +0000)] 
Fix typo in a comment.  No code changes.

FossilOrigin-Name: d0cc06d8a30444125e5655f6587a6355471c3447c08a2e5f7a046a4ed5cc5f09

5 years agoEnforce 80-character line discipline in the CLI. Minor improvements to the
drh [Mon, 26 Aug 2019 12:50:01 +0000 (12:50 +0000)] 
Enforce 80-character line discipline in the CLI.  Minor improvements to the
CLI built-in help.

FossilOrigin-Name: 9690013a00d73a8047b25149ded50d20c74b5c62c0725eec50ed8477688e58a0

5 years agoMinor performance improvement for balance_nonroot().
dan [Sat, 24 Aug 2019 21:02:47 +0000 (21:02 +0000)] 
Minor performance improvement for balance_nonroot().

FossilOrigin-Name: d7434cae3edc321e2f1f8d340a0e656b1613b736f8400fb271a0e80f59401b9e

5 years agoFix a potential buffer overrun in fts5 caused by corrupt database records.
dan [Sat, 24 Aug 2019 17:11:29 +0000 (17:11 +0000)] 
Fix a potential buffer overrun in fts5 caused by corrupt database records.

FossilOrigin-Name: 156d612800a7282fe0ebb20feb31d3fd577f4ab60fab8c00940c87143997aefb

5 years agoFix the built-in edit() SQL function in the CLI so that it works with
drh [Fri, 23 Aug 2019 23:05:32 +0000 (23:05 +0000)] 
Fix the built-in edit() SQL function in the CLI so that it works with
zero-length blobs.

FossilOrigin-Name: e32490128684cfeeb8213baecc78a7942b8fb63d00e375edd965bf236faeed18

5 years agoMove some things in parse.y so that TK_COLUMN and TK_AGG_COLUMN are assigned the...
dan [Fri, 23 Aug 2019 20:33:01 +0000 (20:33 +0000)] 
Move some things in parse.y so that TK_COLUMN and TK_AGG_COLUMN are assigned the same values as they are on trunk for a very small speedup.

FossilOrigin-Name: d26fdfa3bc5f8d9c4a6000462080b0dd508e5cae9a83e0d126be48195224da8c

5 years agoRevise the VDBE comments for NULL-scan so that they also work make
drh [Fri, 23 Aug 2019 17:09:02 +0000 (17:09 +0000)] 
Revise the VDBE comments for NULL-scan so that they also work make
sense when reading a NULLS FIRST plan.

FossilOrigin-Name: bfe793780fa6fc7a1e7d0ee60606dda272985de9573887dca118e9510fc609f2

5 years agoAdditional simplifications of the WHERE loop code generator logic for
drh [Fri, 23 Aug 2019 17:00:22 +0000 (17:00 +0000)] 
Additional simplifications of the WHERE loop code generator logic for
NULLS LAST.

FossilOrigin-Name: 1383680d927d7d703933be7653c0019199845e7f7e82bcc76d9ca3808093e9d8

5 years agoSimplification of the WHERE loop code generator for NULLS LAST saves a
drh [Fri, 23 Aug 2019 16:12:20 +0000 (16:12 +0000)] 
Simplification of the WHERE loop code generator for NULLS LAST saves a
few CPU cycles and about a hundred bytes of code space.

FossilOrigin-Name: e3ed2f496f51234a8f81d90d47ba603b06dbed38b8bd8f1934294379cde74d3a

5 years agoInvert the meaning of the regBignull flag so that it is 1 when doing the
drh [Fri, 23 Aug 2019 13:32:03 +0000 (13:32 +0000)] 
Invert the meaning of the regBignull flag so that it is 1 when doing the
normal scan and 1 when scanning nulls.  This enables the re-do jump at the
bottom of the loop to be coded with a single OP_IfNotZero opcode, rather
than a sequence of OP_If, OP_Integer, OP_Goto.

FossilOrigin-Name: bf875e1a259a4167694e06349458452dc36c1d38aa6843518d9ae46ce74e5559

5 years agoExtra VDBE comments in the NULLS LAST logic provide landmarks to help
drh [Fri, 23 Aug 2019 13:08:49 +0000 (13:08 +0000)] 
Extra VDBE comments in the NULLS LAST logic provide landmarks to help
understand the EXPLAIN output.

FossilOrigin-Name: 649b08ead50f10a9ec0357a5e1ed020195d9f93be61ef703ea036a8e53f07a34

5 years agoAdd additional VDBE coverage marcros.
drh [Thu, 22 Aug 2019 21:13:56 +0000 (21:13 +0000)] 
Add additional VDBE coverage marcros.

FossilOrigin-Name: d3531f5be7d3769689e2cd8bdc9bab5608759de027d44cc123996f32a4a89583

5 years agoMerge fixes from trunk. Also fix a reference to the KeyInfo.aSortOrder field,
drh [Thu, 22 Aug 2019 19:35:24 +0000 (19:35 +0000)] 
Merge fixes from trunk.  Also fix a reference to the KeyInfo.aSortOrder field,
which should now be KeyInfo.aSortFlags

FossilOrigin-Name: 63e625c8eb06720eef30573aa562e38c90d228a9cf493f8bb59f09e50f0e3168

5 years agoFix the likely(), unlikely(), and likelihood() functions so that they have
drh [Thu, 22 Aug 2019 16:38:42 +0000 (16:38 +0000)] 
Fix the likely(), unlikely(), and likelihood() functions so that they have
no affinity, just like any other function.
Ticket [7e07a3dbf5a8cd26]

FossilOrigin-Name: 44578865fa7baf9760e355691ca9ce753295aaba7a4ee0bba29d4f85d9335bab

5 years agoFix a false-positive in sqlite3ExprNeedsNoAffinityChange().
drh [Thu, 22 Aug 2019 11:11:28 +0000 (11:11 +0000)] 
Fix a false-positive in sqlite3ExprNeedsNoAffinityChange().
Ticket [ac184eb571d5e6e0]

FossilOrigin-Name: e62eddbb048cbc2c15cb8eeb5b7a907e7cb08c21a27ebba96a069f62dbcb0f30

5 years agoFix the OP_SeekGE, OP_SeekGT, OP_SeekLE, and OP_SeekLT opcodes so that they
drh [Thu, 22 Aug 2019 00:53:16 +0000 (00:53 +0000)] 
Fix the OP_SeekGE, OP_SeekGT, OP_SeekLE, and OP_SeekLT opcodes so that they
preserve the datatype of the value in the register used as the key.
Ticket [d9f584e936c7a8d0]

FossilOrigin-Name: 81b9f0f55042777b37de78069f7089041a9ee21dd0a0c86b879053fb46e140b4

5 years agoAdd missing VdbeCoverage() macros to new code.
dan [Wed, 21 Aug 2019 19:58:11 +0000 (19:58 +0000)] 
Add missing VdbeCoverage() macros to new code.

FossilOrigin-Name: b1cbcdc6eb42cca0c42a05e0d6ba4c6c7f09adff0c59ecfc5b434a94dec07a41

5 years agoDisable broken test case in expert1.test.
dan [Wed, 21 Aug 2019 17:46:34 +0000 (17:46 +0000)] 
Disable broken test case in expert1.test.

FossilOrigin-Name: 73e30c2e92ccab274ff7cee48511c461de148786bb9d338921c1ecb193822282

5 years agoUpdate this branch with latest trunk changes.
dan [Wed, 21 Aug 2019 15:41:50 +0000 (15:41 +0000)] 
Update this branch with latest trunk changes.

FossilOrigin-Name: 6153bcf41a9aa0497f8210311c99ac23846223068f2b6a3a1c2d9dec7673c7e1

5 years agoAvoid assuming that "column IS ?", where column is declared UNIQUE, matches only...
dan [Wed, 21 Aug 2019 14:54:50 +0000 (14:54 +0000)] 
Avoid assuming that "column IS ?", where column is declared UNIQUE, matches only a single row (as "?" might be NULL). Fix for [b8689402].

FossilOrigin-Name: d02490a2f0cae047087130b4ad8f55f265845c2ffb3bde3b7d507edb54acea6d

5 years agoFix a broken assert() in the fts3 snippet code that was failing for queries containgi...
dan [Wed, 21 Aug 2019 11:31:48 +0000 (11:31 +0000)] 
Fix a broken assert() in the fts3 snippet code that was failing for queries containging more than 64 phrases.

FossilOrigin-Name: 4c01e0170e113ad052b6c3980beb4be9f1dc03fb3cf34132b90e8b82b23f654e

5 years agoFurther tests for the special null-handling on this branch.
dan [Tue, 20 Aug 2019 20:09:51 +0000 (20:09 +0000)] 
Further tests for the special null-handling on this branch.

FossilOrigin-Name: 0dbbb51f4d39cafb01d625d65c12dcb232a9c1da7ed5a9397bf55cfea1b980d2

5 years agoFix a problem with fts5 "ORDER BY rank" queries when the fts5 table name requires...
dan [Tue, 20 Aug 2019 19:11:29 +0000 (19:11 +0000)] 
Fix a problem with fts5 "ORDER BY rank" queries when the fts5 table name requires quoting.

FossilOrigin-Name: 00e9a8f2730eb7239bf7fd107c97c409e4f9fbd968510766373440a9079898eb

5 years agoAdd tests for sort-by-index cases that use IN() and non-default NULL handling.
dan [Tue, 20 Aug 2019 17:51:13 +0000 (17:51 +0000)] 
Add tests for sort-by-index cases that use IN() and non-default NULL handling.

FossilOrigin-Name: 09d660ecde723fb30f3bb3684bbb7f95825d78da6a6f33ddf57846054cd563e0

5 years agoDo not pass ORDER BY clauses with non-standard NULL handling to virtual table impleme...
dan [Tue, 20 Aug 2019 15:47:28 +0000 (15:47 +0000)] 
Do not pass ORDER BY clauses with non-standard NULL handling to virtual table implementations.

FossilOrigin-Name: a9a82ee88d2d12209a674bd19167277aa91a6912e7a8bbf3714f90d559307fee

5 years agoFix a segfault that could occur following an OOM while processing a SELECT statement...
dan [Tue, 20 Aug 2019 14:43:01 +0000 (14:43 +0000)] 
Fix a segfault that could occur following an OOM while processing a SELECT statement for which one or more of the expressions in the window frame declaration are themselves sub-selects that use window functions.

FossilOrigin-Name: 75aec4fc886c04fe098828cc03bc72c197cbf40f0a1890fe5bbb98d4fd5c3c7e

5 years agoAdd the new sqlite3_drop_modules() interface to the loadable extension
drh [Tue, 20 Aug 2019 13:49:12 +0000 (13:49 +0000)] 
Add the new sqlite3_drop_modules() interface to the loadable extension
mechanism.

FossilOrigin-Name: 658bd51623787be4ca87b066a051d119f39056286e223afef3691629cf1ab0e1

5 years agoRetain the affinity of an expression in a WHERE clause when it is transformed to...
dan [Tue, 20 Aug 2019 11:43:44 +0000 (11:43 +0000)] 
Retain the affinity of an expression in a WHERE clause when it is transformed to a reference to an index column on the same expression. Fix for [f043b113].

FossilOrigin-Name: 511da0815673ca4a176aa61dc23a8231b2ab77e8363fc184a78b6e17dba64d49

5 years agoFix a typo and a harmless compiler warning.
mistachkin [Tue, 20 Aug 2019 02:19:26 +0000 (02:19 +0000)] 
Fix a typo and a harmless compiler warning.

FossilOrigin-Name: ec4c63e00c957f98d61ddc1b9d20406c7e1072d6ab0c12ac6939db6c63d90cb8

5 years agoAdd the sqlite3_drop_modules() interface.
drh [Mon, 19 Aug 2019 20:44:07 +0000 (20:44 +0000)] 
Add the sqlite3_drop_modules() interface.

FossilOrigin-Name: e2c6fed8f84929ed51a4e876bb09c85ac4b86a2e4cf0832a7da724bb9f4df5bf

5 years agoOmit the "_except" term from the name of the new interface. sqlite3_drop_modules_except
drh [Mon, 19 Aug 2019 20:35:30 +0000 (20:35 +0000)] 
Omit the "_except" term from the name of the new interface.

FossilOrigin-Name: e5ba47c2d8eb9f48a0e0d325e57d0092d536f85983819634c871ebd51829f1d1

5 years agoFix problems with window frames that use ORDER BY ... NULLS LAST etc.
dan [Mon, 19 Aug 2019 19:59:50 +0000 (19:59 +0000)] 
Fix problems with window frames that use ORDER BY ... NULLS LAST etc.

FossilOrigin-Name: 75d665a494dd7d6e77d5a80af386ee5accc0a53416d5493424dc0fef6c7b01a0

5 years agoPrevent NULLS FIRST/LAST from being used in CREATE INDEX and other statements.
dan [Mon, 19 Aug 2019 17:26:32 +0000 (17:26 +0000)] 
Prevent NULLS FIRST/LAST from being used in CREATE INDEX and other statements.

FossilOrigin-Name: bb9767a287097a615aeb4abdba689b10e1a1c36c016c8e55905b508075e62c86

5 years agoAdd some extra tests for the lsm virtual table module.
dan [Sat, 17 Aug 2019 19:58:26 +0000 (19:58 +0000)] 
Add some extra tests for the lsm virtual table module.

FossilOrigin-Name: 4cb009b0f724f72eaea90e45488122f7c2a7d0caf31a8422da4060469507e921

5 years agoFix to the query planner for the LSM1 extension.
drh [Sat, 17 Aug 2019 19:55:26 +0000 (19:55 +0000)] 
Fix to the query planner for the LSM1 extension.

FossilOrigin-Name: 7496e872a1a50ac65ad04709365a43038fb015ac9c690196de3cb02ce54c2e57

5 years agoThe experimental sqlite3_drop_modules_except() interface.
drh [Sat, 17 Aug 2019 19:45:25 +0000 (19:45 +0000)] 
The experimental sqlite3_drop_modules_except() interface.

FossilOrigin-Name: 0851db4d337a87f8b2d3ce2ae9f9c928b9483591ca41a9e39cc01548059b1888

5 years agoFix the new ability to unregister virtual table modules so that it works
drh [Sat, 17 Aug 2019 19:31:09 +0000 (19:31 +0000)] 
Fix the new ability to unregister virtual table modules so that it works
for the automatic PRAGMA virtual tables.

FossilOrigin-Name: 5d6f4dfeea75c7dcd8c511545accb9eb4b405a02db034332249ba54794e313d2

5 years agoWhen populating an ephemeral b-tree for the RHS of an IN(...) clause, avoid applying...
dan [Sat, 17 Aug 2019 19:13:49 +0000 (19:13 +0000)] 
When populating an ephemeral b-tree for the RHS of an IN(...) clause, avoid applying an affinity to a value that may be used later on for some other purpose. Fix for [c7a117190].

FossilOrigin-Name: 43e8b14314d876178d487c3b519296ac1de065fdcaa70768e40d684015bceb9d

5 years agoAdd tests to ensure that this branch really does fix ticket [f8a7060ece].
dan [Sat, 17 Aug 2019 18:16:59 +0000 (18:16 +0000)] 
Add tests to ensure that this branch really does fix ticket [f8a7060ece].

FossilOrigin-Name: f892066425671a8a0ac923e3ad4744677f6434a66f97b91afa8141f11f179975

5 years agoFix problem with DESC indexes on this branch.
dan [Sat, 17 Aug 2019 17:55:54 +0000 (17:55 +0000)] 
Fix problem with DESC indexes on this branch.

FossilOrigin-Name: b49df1fe9b7174ebc60023179e8da628c926e59df3dc01b15d4a28e17807bb97

5 years agoEnsure the functions that appear to be constant are not factored out of
drh [Sat, 17 Aug 2019 17:07:15 +0000 (17:07 +0000)] 
Ensure the functions that appear to be constant are not factored out of
expression that originate on the right-hand side of a LEFT JOIN.
Ticket [6710d2f7a13a2997]

FossilOrigin-Name: 500c9152daaf11cf69d778aa8592175f6088337c6667c59af6df3a24cd81eb0e

5 years agoMerge trunk changes into this branch.
dan [Sat, 17 Aug 2019 15:47:32 +0000 (15:47 +0000)] 
Merge trunk changes into this branch.

FossilOrigin-Name: db1e60800bc260cdcd604739daaba72c6b486158123fc62a3898aca4ead33cd3

5 years agoActivate introspection pragmas by default. The new option
drh [Sat, 17 Aug 2019 15:27:58 +0000 (15:27 +0000)] 
Activate introspection pragmas by default.  The new option
SQLITE_OMIT_INTROSPECTION_PRAGMAS must be provided to keep them out.

FossilOrigin-Name: 9c4bca64fb5f635296a8d7d7c1bf2808e02ca734a9983e5cee9132f5352a9a6d

5 years agoThe SQLITE_DIRECTONLY flag, when added to sqlite3_create_function() prevents
drh [Sat, 17 Aug 2019 00:53:29 +0000 (00:53 +0000)] 
The SQLITE_DIRECTONLY flag, when added to sqlite3_create_function() prevents
the function from being used inside a trigger or view.

FossilOrigin-Name: de767376987f7668b0770c4920f1532e341b5a27f797d69c0f5e92b87d036170

5 years agoAdd the ability to unregister a virtual table module by invoking
drh [Fri, 16 Aug 2019 22:58:29 +0000 (22:58 +0000)] 
Add the ability to unregister a virtual table module by invoking
sqlite3_create_module() with a NULL sqlite3_module pointer.

FossilOrigin-Name: 31e34fa3390196cdc3178bf120224b08df5ec58fa2c77079ede6e9461a430dad

5 years agoAdd support for using indexes for some ORDER BY clauses that use non-default NULL...
dan [Fri, 16 Aug 2019 21:07:19 +0000 (21:07 +0000)] 
Add support for using indexes for some ORDER BY clauses that use non-default NULL handling. Still some problems on this branch.

FossilOrigin-Name: 81069d7196857e909c94195d67388f71bc9f832eafd9156d8c5cdddb63513b4a

5 years agoFix harmless compiler warnings in the TCL interface.
drh [Thu, 15 Aug 2019 23:11:42 +0000 (23:11 +0000)] 
Fix harmless compiler warnings in the TCL interface.

FossilOrigin-Name: f17e72291f197a92b3e15e054271b997d45211a5a31ca4ea6c7fbb33026d5f1f

5 years agoAdd the SQLITE_DBCONFIG_ENABLE_VIEW option, together with a "db config"
drh [Thu, 15 Aug 2019 21:27:20 +0000 (21:27 +0000)] 
Add the SQLITE_DBCONFIG_ENABLE_VIEW option, together with a "db config"
command in the TCL interface that can access that option as well as all the
other sqlite3_db_config() boolean options.

FossilOrigin-Name: 61b4bccd2984f4c2cf50f58ef08677588e57aa7e079af07473b2e188d9ce4f52

5 years agoProvide the SQLITE_DIRECTONLY flag for app-defined functions that prohibits directonly
drh [Thu, 15 Aug 2019 20:04:09 +0000 (20:04 +0000)] 
Provide the SQLITE_DIRECTONLY flag for app-defined functions that prohibits
the use of those functions within triggers or views.

FossilOrigin-Name: fc745845d8d76adc165575e2192f4176e3c28e614c72571d56f4011560499fe1

5 years agoEnsure that the optional "sz=N" parameter that can be manually added to the
drh [Thu, 15 Aug 2019 14:35:45 +0000 (14:35 +0000)] 
Ensure that the optional "sz=N" parameter that can be manually added to the
end of an sqlite_stat1 entry does not have an N value that is too small.
Ticket [e4598ecbdd18bd82]

FossilOrigin-Name: 98357d8c1263920b33a3648ef9214a63c99728bafa7a8d3dd6a1241b2303fd42

5 years agoEnsure that SQLite does not attempt to process incompatible window functions in a...
dan [Thu, 15 Aug 2019 13:53:22 +0000 (13:53 +0000)] 
Ensure that SQLite does not attempt to process incompatible window functions in a single scan. Fix for [256741a1].

FossilOrigin-Name: 4f5b2d938194fab7627486e2ced633def2c90d9d3328e3700612feb9dbfa3d9a

5 years agoAvoid downgrading SQLITE_CORRUPT errors detected by the schema parser into
drh [Thu, 15 Aug 2019 13:46:39 +0000 (13:46 +0000)] 
Avoid downgrading SQLITE_CORRUPT errors detected by the schema parser into
SQLITE_NOMEM or SQLITE_ERROR errors.

FossilOrigin-Name: b2e79f8ff0836fcc98a2df9377aad9137307c34058030ecd1b5d4ec3277ed36a

5 years agoEnsure that the cell overwrite optimization does not overwrite the header
drh [Thu, 15 Aug 2019 13:17:49 +0000 (13:17 +0000)] 
Ensure that the cell overwrite optimization does not overwrite the header
of the b-tree page.

FossilOrigin-Name: 4cc5694cbd69749c146679c367860952fdf3f5356426ddfd1dce470569702bc1

5 years agoEarly detection out-of-bounds page numbers on the direct-overflow-read
drh [Thu, 15 Aug 2019 00:04:44 +0000 (00:04 +0000)] 
Early detection out-of-bounds page numbers on the direct-overflow-read
optimization gives consistent error messages regardless of whether or not
the optimization is enabled.

FossilOrigin-Name: b517a52fa36df0a0854a75858b5e81861771d2e9032a5a0ad79aa76ae64130a2

5 years agoAlways check for reads past the end of the file on the in-memory journal
drh [Wed, 14 Aug 2019 15:17:21 +0000 (15:17 +0000)] 
Always check for reads past the end of the file on the in-memory journal
driver.  This used to be an assert().

FossilOrigin-Name: 4d41ca7d6efbdac70890a8d4159488fc7f59bf78a550b00597b4df990c4fcaef

5 years agoAdd some static to the 'regexp' extension.
mistachkin [Tue, 13 Aug 2019 20:34:35 +0000 (20:34 +0000)] 
Add some static to the 'regexp' extension.

FossilOrigin-Name: a21d1dde73f811244b5b43f9fed5877263a9c5061470221f417e501f5530edfa

5 years agoUpdate test cases so that they work with ICU enabled.
dan [Tue, 13 Aug 2019 17:56:56 +0000 (17:56 +0000)] 
Update test cases so that they work with ICU enabled.

FossilOrigin-Name: 408144a1832569ced8e04840f0dd36a3867405f36b13631b0f13c0f7b8a0fb01

5 years agoUpdate some corruption test cases to take [724f4df9c] into account.
dan [Tue, 13 Aug 2019 17:27:43 +0000 (17:27 +0000)] 
Update some corruption test cases to take [724f4df9c] into account.

FossilOrigin-Name: 927cd7b4c52fae665e57fb6039c6829e339cff5ad5c405800cac3ee149ef5be1

5 years agoFix a problem with RBU function sqlite3rbu_bp_progress() when used during an RBU...
dan [Tue, 13 Aug 2019 15:11:25 +0000 (15:11 +0000)] 
Fix a problem with RBU function sqlite3rbu_bp_progress() when used during an RBU vacuum.

FossilOrigin-Name: 8c44b02f1479cec61554800702a3c1d806e4ee64b41ba2af17320f62794a02fe

5 years agoMake sure the btree cursor overflow cache is cleared when overwriting
drh [Mon, 12 Aug 2019 18:26:46 +0000 (18:26 +0000)] 
Make sure the btree cursor overflow cache is cleared when overwriting
a cell in sqlite3BtreeInsert().  Ticket [3cf9bb227e9a5d32]

FossilOrigin-Name: 7dae7b969ed314605a3a2da2cfdce4d81152740f5d3bfbc2a6e311b13ee325a7

5 years agoExperimental implementation of NULLS FIRST/LAST. This branch still has problems ...
dan [Mon, 12 Aug 2019 16:36:38 +0000 (16:36 +0000)] 
Experimental implementation of NULLS FIRST/LAST. This branch still has problems - the most significant of which is that ORDER BY clauses with a non-default NULLS FIRST/LAST qualifier can never use an index.

FossilOrigin-Name: 07babb0f897fc8c9cb5b30481899c32fdd743f3f3ca508d8d957826252107dd5

5 years agoFor the ".testctrl prng_seed" command in the CLI, if the argument is "random"
drh [Mon, 12 Aug 2019 16:25:11 +0000 (16:25 +0000)] 
For the ".testctrl prng_seed" command in the CLI, if the argument is "random"
then select a random integer seed and print the seed value on stdout.

FossilOrigin-Name: 636ca4472c9f41eb3989f28854d4968867837399a2092f389d1b814d98cccbae

5 years agoAdd a TESTCTRL that disables the verification of type, name, and tbl_name
drh [Mon, 12 Aug 2019 14:17:43 +0000 (14:17 +0000)] 
Add a TESTCTRL that disables the verification of type, name, and tbl_name
in the sqlite_master table.

FossilOrigin-Name: 48d9b48ab4ace234eb1a055cf33cb533a1c3aa82d0a6e086d96226bd9474ceca

5 years agoValidate the type, name, and tbl_name fields of the sqlite_master table when
drh [Mon, 12 Aug 2019 00:08:07 +0000 (00:08 +0000)] 
Validate the type, name, and tbl_name fields of the sqlite_master table when
loading the schema, unless writable_schema is engaged.

FossilOrigin-Name: 724f4df9ccc2b683f7091a3f7a8c20ee210f44d7a610cd1b4c49da1c274add08

5 years agoFix the sqliteExprImpliesExpr() routine so that it recognizes that
drh [Sat, 10 Aug 2019 15:06:03 +0000 (15:06 +0000)] 
Fix the sqliteExprImpliesExpr() routine so that it recognizes that
"(NULL IS FALSE) IS FALSE" doe not implie "NULL NOT NULL".
Ticket [9080b6227fabb466]

FossilOrigin-Name: da01ba4fa47c6508b31533ccd769e637af04bd37f51463372fbc6c848d892a4d

5 years agoAdd extra test cases related to the previous commit.
dan [Sat, 10 Aug 2019 14:35:06 +0000 (14:35 +0000)] 
Add extra test cases related to the previous commit.

FossilOrigin-Name: 3c690b2b05b7338f3325c50a0750c6023e1173afa4388e836ecb2cc49f19a0ac

5 years agoRemove two incorrect assert() statements from the logic used to derive
drh [Sat, 10 Aug 2019 14:16:17 +0000 (14:16 +0000)] 
Remove two incorrect assert() statements from the logic used to derive
column names and types from subqueries.

FossilOrigin-Name: 712e47714863a8ed7ff73324d9fec569633e8b901c436c633b0220d16a7a9302

5 years agoAllow the RHS of a row-value IN operator to use a compound query with
drh [Fri, 9 Aug 2019 20:26:01 +0000 (20:26 +0000)] 
Allow the RHS of a row-value IN operator to use a compound query with
an ORDER BY clause.

FossilOrigin-Name: eaf15d9bae6773058341d6219241f44ce728ad1cb9cf649f2efd4dddd81ec461

5 years agoModify signature of sqlite3VdbeChangeOpcode() to accept int instead of u32.
mistachkin [Fri, 9 Aug 2019 01:59:14 +0000 (01:59 +0000)] 
Modify signature of sqlite3VdbeChangeOpcode() to accept int instead of u32.

FossilOrigin-Name: 68b7f2acf4d228f32250e37cbc0eb5d275b512d49071bbb38e1f5634b705f7d3

5 years agoFix more compiler warnings.
drh [Fri, 9 Aug 2019 01:11:32 +0000 (01:11 +0000)] 
Fix more compiler warnings.

FossilOrigin-Name: 1b85442b614df0808c10c34ec281282e5dfd93d6d5f9737b51263ffaa4da5c72

5 years agoFix harmless compiler warnings.
drh [Thu, 8 Aug 2019 19:40:29 +0000 (19:40 +0000)] 
Fix harmless compiler warnings.

FossilOrigin-Name: 1eef4ddea9a2a8c97b97183402c774caa40ef906ea9cccade307381b29a9785d

5 years agoRemove support for SQLITE_ENABLE_STAT3. The sqlite_stat3 table is now ignored,
drh [Thu, 8 Aug 2019 19:19:42 +0000 (19:19 +0000)] 
Remove support for SQLITE_ENABLE_STAT3.  The sqlite_stat3 table is now ignored,
if it exists.  Run ANALYZE using STAT4 to get the equivalent functionality,
which presumably everybody has been doing for a long time now.

FossilOrigin-Name: f1cd234c9888142e0ac542d866d7fb55a81fb7edd0a5cd810191b4e0395ffc7d

5 years agoFix a case of the Expr.affinity to Expr.affExpr refactor that was missed
drh [Thu, 8 Aug 2019 18:49:16 +0000 (18:49 +0000)] 
Fix a case of the Expr.affinity to Expr.affExpr refactor that was missed
in the [a29f2a7d07beff64] check-in.

FossilOrigin-Name: 83450d10707e2c7c075f3930a8c231c49c593b9cdf0e6097b0187eb877755d2d

5 years agoMore legacy STAT3 code removed. omit-stat3
drh [Thu, 8 Aug 2019 16:23:12 +0000 (16:23 +0000)] 
More legacy STAT3 code removed.

FossilOrigin-Name: 845d2f17de5b4740f95884307d9efec3223737bb0f2c4a74693666caf5f61c21

5 years agoRemove support for STAT3. The sqlite_stat3 tables are ignored, if they
drh [Thu, 8 Aug 2019 15:24:17 +0000 (15:24 +0000)] 
Remove support for STAT3.  The sqlite_stat3 tables are ignored, if they
exist.  STAT4 continues to work as it always has, and as it is a superset of
STAT3 is the recommended replacement.

FossilOrigin-Name: 1e17ea2fd1df4ad49138c787c8fe3207dd0c25c93f9001d52a9b69f8c12e841c

5 years agoRemove a NEVER() that is reachable from a corrupt database.
drh [Thu, 8 Aug 2019 01:39:07 +0000 (01:39 +0000)] 
Remove a NEVER() that is reachable from a corrupt database.

FossilOrigin-Name: 30e6ee27a9fb78291c324ac9b80db4579280140430804ecd4692e312f9938525

5 years agoRemove use of the affinity() function from view.test, as it is only available in...
dan [Wed, 7 Aug 2019 19:57:21 +0000 (19:57 +0000)] 
Remove use of the affinity() function from view.test, as it is only available in SQLITE_DEBUG builds.

FossilOrigin-Name: 7f2246a17be9915b3492624a3d8deff56694bdc372f7627e3f16c1869415b1a3

5 years agoAdd "set TMP=%CD%" to the start of each msvc script output by releasetest_data.tcl...
dan [Wed, 7 Aug 2019 18:34:21 +0000 (18:34 +0000)] 
Add "set TMP=%CD%" to the start of each msvc script output by releasetest_data.tcl. Otherwise, since binaries compiled with SQLITE_TEST all choose the same sequence of pseudo-random numbers, collisions between temp file names cause errors when running multiple tests in parallel.

FossilOrigin-Name: f5d0436d8dc650cadb61a5fe76fd1a0d68dabba54ff0c2a8c138f9dfbdab1c3f

5 years agoEliminate some more cases of redundant sorting in window-function queries.
dan [Wed, 7 Aug 2019 17:45:37 +0000 (17:45 +0000)] 
Eliminate some more cases of redundant sorting in window-function queries.

FossilOrigin-Name: 8158d2aca68c5a253054376fdf1b8eaab2db874f4b93524742be7340e9c50dd5

5 years agoDo not make SQLITE_READ authorizer calls for tables without names, as all
drh [Wed, 7 Aug 2019 13:25:21 +0000 (13:25 +0000)] 
Do not make SQLITE_READ authorizer calls for tables without names, as all
such tables will be internal-use-only tables for subqueries and whatnot.

FossilOrigin-Name: 193c87fc96f964984a144c1a4506ef9db033ab2b80e64dd4d09d820fef466407

5 years agoEnsure that when the col in an operator like "val IN(col)" is a column of a view...
dan [Tue, 6 Aug 2019 21:16:28 +0000 (21:16 +0000)] 
Ensure that when the col in an operator like "val IN(col)" is a column of a view, its affinity is not used to coerce val. Fix for [0a5e2c1d].

FossilOrigin-Name: 17b3d2218c02a4005d4c96471c452105b54abb25901ae62990b01f0c955135fe

5 years agoImproved reuse of file descriptors for which close() is delayed to prevent
drh [Tue, 6 Aug 2019 20:55:06 +0000 (20:55 +0000)] 
Improved reuse of file descriptors for which close() is delayed to prevent
clearly of posix advisory locks.

FossilOrigin-Name: 509c1ba26a4c12c63ecf04ddfa2f175eaf4dd9b96ab7be15faebd36deb0a0a31

5 years agoEnhance the ".recover" output in the shell to use double-quotes around table
drh [Tue, 6 Aug 2019 20:26:17 +0000 (20:26 +0000)] 
Enhance the ".recover" output in the shell to use double-quotes around table
and column identifiers.

FossilOrigin-Name: 846d2d2d2f7fd2e4178c70bc2b92f18941a7972fe88c0129035b7a253ed21785

5 years agoAdd "PRAGMA foreign_keys=OFF;" to the start of the script output by ".recover", just...
dan [Tue, 6 Aug 2019 18:40:36 +0000 (18:40 +0000)] 
Add "PRAGMA foreign_keys=OFF;" to the start of the script output by ".recover", just as is done for ".dump".

FossilOrigin-Name: bfc29e62eff0ed00c153e18a27815f7e3ba316f46871e9645b84ab1e6709a392

5 years agoEnsure that columns of views and sub-queries that are expressions with
drh [Tue, 6 Aug 2019 15:32:42 +0000 (15:32 +0000)] 
Ensure that columns of views and sub-queries that are expressions with
no affinity are comparied without any type conversions, as required in the
documentation.  Tickets [61c853857f40da49] and [d52a29a9e6bc55c5].

FossilOrigin-Name: 9c8c1092a8ce80e114fcfe8ce780332a6f269b8c87df226242b582d2d825c393

5 years agoPerformance optimization to the new affinity handling logic. pending
drh [Tue, 6 Aug 2019 15:18:15 +0000 (15:18 +0000)] 
Performance optimization to the new affinity handling logic.

FossilOrigin-Name: c9724e761bce7a4ae63ce3c1408795915865e8d3024dcb90690456f724f0df53

5 years agoUse 0x40 (ASCII '@') instead of 0x00 to mean "no affinity" so that columns
drh [Tue, 6 Aug 2019 14:37:24 +0000 (14:37 +0000)] 
Use 0x40 (ASCII '@') instead of 0x00 to mean "no affinity" so that columns
with no affinity can appear in a zero-terminated string.  Use the new
SQLITE_AFF_NONE macro for this new magic number.

FossilOrigin-Name: e8234f6939ccff4c10f741cf66d1c537cfebcbd0d1d79a618a64c755a7f087b5

5 years agoEnsure that columns of views and sub-queries that are expressions with no affinity...
dan [Mon, 5 Aug 2019 20:53:19 +0000 (20:53 +0000)] 
Ensure that columns of views and sub-queries that are expressions with no affinity are not assigned BLOB affinity. This matches the documentation. Fix for [61c853857f40da49].

FossilOrigin-Name: e15a0977ddfad3d0f4c7654c5665ff10830c25b20ecf6ef500b1ba23fb89e31f

5 years agoAdd test cases to this branch. tkt-61c853-A
dan [Mon, 5 Aug 2019 20:45:53 +0000 (20:45 +0000)] 
Add test cases to this branch.

FossilOrigin-Name: f37317d81cc2864ed57c76a7347351310d61c8056a2a0179218530ba60a44986

5 years agoFix the patch on this branch so that it works with sub-queries, as well as views.
dan [Mon, 5 Aug 2019 19:44:47 +0000 (19:44 +0000)] 
Fix the patch on this branch so that it works with sub-queries, as well as views.

FossilOrigin-Name: 7480db307c39b86bce269583e5917f5e1a3990500552fd98400ef3e7088c0b2a

5 years agoOne of two options on how to address ticket [61c853857f40da49]. In this
drh [Mon, 5 Aug 2019 19:32:06 +0000 (19:32 +0000)] 
One of two options on how to address ticket [61c853857f40da49].  In this
mode, we back out the documentation change of
[https://www.sqlite.org/docsrc/info/07b7749da88d54e5|[07b7749da88d54e5]]
and change the core to work as it has been documented to work since 2017,
rather than how it has actually worked since 2009.

FossilOrigin-Name: 09cd0c0c6e6c963e0039a733876e5149adb3cd10e9b92699fa1dcb0633e997a4

5 years agoRefactor field Expr.affinity into Expr.affExpr to avoid confusion with other
drh [Mon, 5 Aug 2019 18:01:42 +0000 (18:01 +0000)] 
Refactor field Expr.affinity into Expr.affExpr to avoid confusion with other
fields and variables named "affinity" and display affExpr it in
sqlite3TreeViewExpr() output.

FossilOrigin-Name: a29f2a7d07beff64e489e8f824babc6228c4a499fadc0ee701caa60a63baadcd

5 years agoImproved detection of corruption on the freeblock list of a btree page.
drh [Mon, 5 Aug 2019 16:22:20 +0000 (16:22 +0000)] 
Improved detection of corruption on the freeblock list of a btree page.

FossilOrigin-Name: 4b00799bdf107fce8a9dd84fd5bf6597e4f3373659b89aae4a1242be5964726f

5 years agoFix a problem with renaming a table when a view or trigger within the schema uses...
dan [Mon, 5 Aug 2019 13:19:25 +0000 (13:19 +0000)] 
Fix a problem with renaming a table when a view or trigger within the schema uses a FILTER with an aggregate function that is not currently registered with the database.

FossilOrigin-Name: 2ac0e42f8ab7a9184c2a2efd13bd50ab51bc01f9f34e9e63591fd18db02dff54

5 years agoPrevent an fts5 table from being its own content table, or part of a view that is...
dan [Mon, 5 Aug 2019 12:55:56 +0000 (12:55 +0000)] 
Prevent an fts5 table from being its own content table, or part of a view that is the content table.

FossilOrigin-Name: b6d52c9364767ff4ab7279ae981afb97799299dcfaf38a0110c40ca82c72a825

5 years agoStregthen an assert() in the WHERE clause code generator for the min/max
drh [Sat, 3 Aug 2019 19:06:18 +0000 (19:06 +0000)] 
Stregthen an assert() in the WHERE clause code generator for the min/max
optimization.

FossilOrigin-Name: 1bd4b97d6405c9b093f3bfed914c56088ee13e4a2242be62b74a86660f74f533

5 years agoFix a problem with queries of the form "SELECT min(<expr>) ... WHERE <expr>=?" where...
dan [Sat, 3 Aug 2019 16:37:40 +0000 (16:37 +0000)] 
Fix a problem with queries of the form "SELECT min(<expr>) ... WHERE <expr>=?" where there is an index on <expr>. Fix for [71e183ca].

FossilOrigin-Name: d465c3eef458c851d97eea6e4117247d9c69386b276168080dbff7bb64070c93