Commit Graph

21177 Commits

Author SHA1 Message Date
dan
5b32bdff80 Merge trunk changes into this branch.
FossilOrigin-Name: db1e60800bc260cdcd604739daaba72c6b486158123fc62a3898aca4ead33cd3
2019-08-17 15:47:32 +00:00
drh
cc3f3d1f05 Activate introspection pragmas by default. The new option
SQLITE_OMIT_INTROSPECTION_PRAGMAS must be provided to keep them out.

FossilOrigin-Name: 9c4bca64fb5f635296a8d7d7c1bf2808e02ca734a9983e5cee9132f5352a9a6d
2019-08-17 15:27:58 +00:00
drh
217ca657d8 The SQLITE_DIRECTONLY flag, when added to sqlite3_create_function() prevents
the function from being used inside a trigger or view.

FossilOrigin-Name: de767376987f7668b0770c4920f1532e341b5a27f797d69c0f5e92b87d036170
2019-08-17 00:53:29 +00:00
drh
cc5979dbd3 Add the ability to unregister a virtual table module by invoking
sqlite3_create_module() with a NULL sqlite3_module pointer.

FossilOrigin-Name: 31e34fa3390196cdc3178bf120224b08df5ec58fa2c77079ede6e9461a430dad
2019-08-16 22:58:29 +00:00
dan
15750a26fa 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
2019-08-16 21:07:19 +00:00
drh
4043cfef75 Fix harmless compiler warnings in the TCL interface.
FossilOrigin-Name: f17e72291f197a92b3e15e054271b997d45211a5a31ca4ea6c7fbb33026d5f1f
2019-08-15 23:11:42 +00:00
drh
11d88e68ab 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
2019-08-15 21:27:20 +00:00
drh
42d2fce7f5 Provide the SQLITE_DIRECTONLY flag for app-defined functions that prohibits
the use of those functions within triggers or views.

FossilOrigin-Name: fc745845d8d76adc165575e2192f4176e3c28e614c72571d56f4011560499fe1
2019-08-15 20:04:09 +00:00
drh
725dd72400 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
2019-08-15 14:35:45 +00:00
dan
a3fcc000cb Ensure that SQLite does not attempt to process incompatible window functions in a single scan. Fix for [256741a1].
FossilOrigin-Name: 4f5b2d938194fab7627486e2ced633def2c90d9d3328e3700612feb9dbfa3d9a
2019-08-15 13:53:22 +00:00
drh
d4da4936cd Avoid downgrading SQLITE_CORRUPT errors detected by the schema parser into
SQLITE_NOMEM or SQLITE_ERROR errors.

FossilOrigin-Name: b2e79f8ff0836fcc98a2df9377aad9137307c34058030ecd1b5d4ec3277ed36a
2019-08-15 13:46:39 +00:00
drh
27e80a3b68 Ensure that the cell overwrite optimization does not overwrite the header
of the b-tree page.

FossilOrigin-Name: 4cc5694cbd69749c146679c367860952fdf3f5356426ddfd1dce470569702bc1
2019-08-15 13:17:49 +00:00
drh
b9fc45534d 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
2019-08-15 00:04:44 +00:00
drh
908e7c43a7 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
2019-08-14 15:17:21 +00:00
mistachkin
87ae34ba1a Add some static to the 'regexp' extension.
FossilOrigin-Name: a21d1dde73f811244b5b43f9fed5877263a9c5061470221f417e501f5530edfa
2019-08-13 20:34:35 +00:00
dan
7c2321fdf3 Update test cases so that they work with ICU enabled.
FossilOrigin-Name: 408144a1832569ced8e04840f0dd36a3867405f36b13631b0f13c0f7b8a0fb01
2019-08-13 17:56:56 +00:00
dan
3c1970fcee Update some corruption test cases to take [724f4df9c] into account.
FossilOrigin-Name: 927cd7b4c52fae665e57fb6039c6829e339cff5ad5c405800cac3ee149ef5be1
2019-08-13 17:27:43 +00:00
dan
b8a8d523cb Fix a problem with RBU function sqlite3rbu_bp_progress() when used during an RBU vacuum.
FossilOrigin-Name: 8c44b02f1479cec61554800702a3c1d806e4ee64b41ba2af17320f62794a02fe
2019-08-13 15:11:25 +00:00
drh
554a19dbee Make sure the btree cursor overflow cache is cleared when overwriting
a cell in sqlite3BtreeInsert().  Ticket [3cf9bb227e9a5d32]

FossilOrigin-Name: 7dae7b969ed314605a3a2da2cfdce4d81152740f5d3bfbc2a6e311b13ee325a7
2019-08-12 18:26:46 +00:00
dan
6e11892db8 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
2019-08-12 16:36:38 +00:00
drh
41428a97b8 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
2019-08-12 16:25:11 +00:00
drh
30842990b2 Add a TESTCTRL that disables the verification of type, name, and tbl_name
in the sqlite_master table.

FossilOrigin-Name: 48d9b48ab4ace234eb1a055cf33cb533a1c3aa82d0a6e086d96226bd9474ceca
2019-08-12 14:17:43 +00:00
drh
c5a93d4c85 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
2019-08-12 00:08:07 +00:00
drh
14c865e859 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
2019-08-10 15:06:03 +00:00
dan
b6299681c6 Add extra test cases related to the previous commit.
FossilOrigin-Name: 3c690b2b05b7338f3325c50a0750c6023e1173afa4388e836ecb2cc49f19a0ac
2019-08-10 14:35:06 +00:00
drh
3251a2031b Remove two incorrect assert() statements from the logic used to derive
column names and types from subqueries.

FossilOrigin-Name: 712e47714863a8ed7ff73324d9fec569633e8b901c436c633b0220d16a7a9302
2019-08-10 14:16:17 +00:00
drh
cb99c57a66 Allow the RHS of a row-value IN operator to use a compound query with
an ORDER BY clause.

FossilOrigin-Name: eaf15d9bae6773058341d6219241f44ce728ad1cb9cf649f2efd4dddd81ec461
2019-08-09 20:26:01 +00:00
mistachkin
044388cf98 Modify signature of sqlite3VdbeChangeOpcode() to accept int instead of u32.
FossilOrigin-Name: 68b7f2acf4d228f32250e37cbc0eb5d275b512d49071bbb38e1f5634b705f7d3
2019-08-09 01:59:14 +00:00
drh
3728b84c03 Fix more compiler warnings.
FossilOrigin-Name: 1b85442b614df0808c10c34ec281282e5dfd93d6d5f9737b51263ffaa4da5c72
2019-08-09 01:11:32 +00:00
drh
51755a78a9 Fix harmless compiler warnings.
FossilOrigin-Name: 1eef4ddea9a2a8c97b97183402c774caa40ef906ea9cccade307381b29a9785d
2019-08-08 19:40:29 +00:00
drh
690f04a0d7 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
2019-08-08 19:19:42 +00:00
drh
af97c3f35a Fix a case of the Expr.affinity to Expr.affExpr refactor that was missed
in the [a29f2a7d07beff64] check-in.

FossilOrigin-Name: 83450d10707e2c7c075f3930a8c231c49c593b9cdf0e6097b0187eb877755d2d
2019-08-08 18:49:16 +00:00
drh
5eae1d1b33 More legacy STAT3 code removed.
FossilOrigin-Name: 845d2f17de5b4740f95884307d9efec3223737bb0f2c4a74693666caf5f61c21
2019-08-08 16:23:12 +00:00
drh
175b8f06f7 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
2019-08-08 15:24:17 +00:00
drh
1c269a9ff8 Remove a NEVER() that is reachable from a corrupt database.
FossilOrigin-Name: 30e6ee27a9fb78291c324ac9b80db4579280140430804ecd4692e312f9938525
2019-08-08 01:39:07 +00:00
dan
679c9613f6 Remove use of the affinity() function from view.test, as it is only available in SQLITE_DEBUG builds.
FossilOrigin-Name: 7f2246a17be9915b3492624a3d8deff56694bdc372f7627e3f16c1869415b1a3
2019-08-07 19:57:21 +00:00
dan
e7e48dc629 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
2019-08-07 18:34:21 +00:00
dan
0e3c50c5dc Eliminate some more cases of redundant sorting in window-function queries.
FossilOrigin-Name: 8158d2aca68c5a253054376fdf1b8eaab2db874f4b93524742be7340e9c50dd5
2019-08-07 17:45:37 +00:00
drh
74c490e045 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
2019-08-07 13:25:21 +00:00
dan
2712b022ab 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
2019-08-06 21:16:28 +00:00
drh
55220a6c70 Improved reuse of file descriptors for which close() is delayed to prevent
clearly of posix advisory locks.

FossilOrigin-Name: 509c1ba26a4c12c63ecf04ddfa2f175eaf4dd9b96ab7be15faebd36deb0a0a31
2019-08-06 20:55:06 +00:00
drh
a2de66c6b4 Enhance the ".recover" output in the shell to use double-quotes around table
and column identifiers.

FossilOrigin-Name: 846d2d2d2f7fd2e4178c70bc2b92f18941a7972fe88c0129035b7a253ed21785
2019-08-06 20:26:17 +00:00
dan
f32105708e Add "PRAGMA foreign_keys=OFF;" to the start of the script output by ".recover", just as is done for ".dump".
FossilOrigin-Name: bfc29e62eff0ed00c153e18a27815f7e3ba316f46871e9645b84ab1e6709a392
2019-08-06 18:40:36 +00:00
drh
9ce3c8ac26 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
2019-08-06 15:32:42 +00:00
drh
915e434c35 Performance optimization to the new affinity handling logic.
FossilOrigin-Name: c9724e761bce7a4ae63ce3c1408795915865e8d3024dcb90690456f724f0df53
2019-08-06 15:18:15 +00:00
drh
96fb16eecd 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
2019-08-06 14:37:24 +00:00
dan
5978a7a525 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
2019-08-05 20:53:19 +00:00
dan
0a8d06a93f Add test cases to this branch.
FossilOrigin-Name: f37317d81cc2864ed57c76a7347351310d61c8056a2a0179218530ba60a44986
2019-08-05 20:45:53 +00:00
dan
2046a77365 Fix the patch on this branch so that it works with sub-queries, as well as views.
FossilOrigin-Name: 7480db307c39b86bce269583e5917f5e1a3990500552fd98400ef3e7088c0b2a
2019-08-05 19:44:47 +00:00
drh
81506b88b8 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
2019-08-05 19:32:06 +00:00
drh
1194904b81 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
2019-08-05 18:01:42 +00:00
drh
2b96b6969a Improved detection of corruption on the freeblock list of a btree page.
FossilOrigin-Name: 4b00799bdf107fce8a9dd84fd5bf6597e4f3373659b89aae4a1242be5964726f
2019-08-05 16:22:20 +00:00
dan
72d1eac673 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
2019-08-05 13:19:25 +00:00
dan
3cbbd195ca Prevent an fts5 table from being its own content table, or part of a view that is the content table.
FossilOrigin-Name: b6d52c9364767ff4ab7279ae981afb97799299dcfaf38a0110c40ca82c72a825
2019-08-05 12:55:56 +00:00
drh
45f3b3cf1d Stregthen an assert() in the WHERE clause code generator for the min/max
optimization.

FossilOrigin-Name: 1bd4b97d6405c9b093f3bfed914c56088ee13e4a2242be62b74a86660f74f533
2019-08-03 19:06:18 +00:00
dan
192418bd49 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
2019-08-03 16:37:40 +00:00
drh
55b4c827fa In the ".wheretrace 0x100" debugging mode, show the structure of the
main parameters to sqlite3WhereBegin() calls.

FossilOrigin-Name: fd598e475d353363e19adc27a671170f11ae9f6d8cad58cb2303fb2ad8ac6bec
2019-08-03 16:17:46 +00:00
drh
9f8c028221 Add the SQLITE_TESTCTRL_PRNG_SEED which can control the PRNG seed either
directly or through the schema cookie of a supplied database connection.

FossilOrigin-Name: 2660e9292ae2c229eb7c57a6a79bb19f0c970072f86750fbe9cca3113d44ffe4
2019-08-03 01:40:17 +00:00
drh
2e6d83bc49 Give the SQLITE_TESTCTRL_PRNG_SEED two arguments. The second argument if not
NULL is a pointer to a database connection which seeds the connection from
its schema cookie.  In this way, fuzzers can control the PRNG seed.

FossilOrigin-Name: 49aa34480622cce4d7a72c59d9cfa8336886387acec8ee15b72f295ea1a52d8c
2019-08-03 01:39:20 +00:00
drh
e6e96b1b45 Fixes to the PRNG_SEED pragma idea.
FossilOrigin-Name: c71098409c98af8360f8f28b9238a12ec764018a5782e8ff03fdf5db54031d6e
2019-08-02 21:03:24 +00:00
drh
ade54d68ee Add the SQLITE_TESTCTRL_PRNG_SEED test control.
FossilOrigin-Name: 3ac5723164ae801e209ce525a5d94692767136f9d06be2a84883dcea677d02da
2019-08-02 20:45:04 +00:00
dan
0bf6549cd1 If a query like "SELECT min(a), b FROM t1" visits no rows where "a" is not null, extract a value for "b" from one of the rows where "a" is null. Fix for ticket [41866dc37].
FossilOrigin-Name: faaaae4940b5f4f70e4988ad5b45582410b381ace0031e6abcde0b9217c06796
2019-08-02 19:40:01 +00:00
dan
ddd7421c91 If a query like "SELECT min(a), b FROM t1" visits no rows where "a" is not null, extract a value for "b" from one of the rows where "a" is null. Possible fix for ticket [41866dc37].
FossilOrigin-Name: a7277ed0623dccdbf775ae6127611d6bc6e150f6942a048ab4281e5136c0e98d
2019-08-02 18:43:59 +00:00
drh
d744ee0b50 The sqlite3_set_authorizer() interface should only expire prepared statements
when it is setting a new authorizer, not when clearing the authorizer.  And
statements that are running when sqlite3_set_authorizer() is invoked should be
allowed to continue running to completion.

FossilOrigin-Name: 961e2f08c35238bcb1d32430d16451a96807b2c4bbb194ee621128dd09cd3981
2019-08-01 22:48:45 +00:00
dan
401593e348 Add new release tests for windows to releasetest_data.tcl.
FossilOrigin-Name: 1b330ec24c350c59f6d3779f6c0819fe95b89f4dfca5a1f2c22f22b5fe9cd087
2019-08-01 15:18:51 +00:00
dan
71f059c880 Fix a problem in ALTER TABLE triggered by views or triggers that include the construction "ORDER BY true" or "ORDER BY false".
FossilOrigin-Name: 8168021f9ab5fb8b4888257963c9ec68fd1dfeedaf6bba4b8e07438001d0be0f
2019-08-01 10:58:46 +00:00
dan
45cb2aa98c Update "releasetest_data.tcl" so that it is a standalone script that generates sh or batch scripts to run each tcl test run at release time. Update wapptest.tcl to use it.
FossilOrigin-Name: 559c2dd6724b2fc238760863d4be7132b591457e72ca5758fdd4002fbf7df4bc
2019-07-31 21:08:55 +00:00
drh
9252df4969 New test cases in test/fuzzdata8.db.
FossilOrigin-Name: 6e92d71c24c6039e7116f02fc5f39b2b87efcd3674ea828077c03d760bf49c45
2019-07-31 15:16:14 +00:00
drh
7e35e81dcb Do not allow the json_set() function to overwrite the same element more than
once.

FossilOrigin-Name: f237f60e4fa9171dfe9a77c8637595c2701e971034d41bd6018944e8b2b27a6f
2019-07-31 12:13:58 +00:00
drh
9c3bb59f76 Fix the build for when -DSQLITE_SMALL_STACK is used.
FossilOrigin-Name: b9eda2249ab5cf523093e4849c317d9a4b1743f7e15d96bdd6bb6cc423302914
2019-07-30 21:00:13 +00:00
drh
2ad07d96b6 Improved fix for ticket [ced41c7c7d6b4d36] that keeps skip-scan enabled,
but avoids identifying a skip-scan as order-distinct (because it is not)
and thus forces a separate b-tree to implement the DISTINCT clause of a
query.  This undoes check-in [a871d69c6de65038] and substitutes a new fix.

FossilOrigin-Name: 89bf0399e87be76e7b264e0a35e8a6d3af0f9e71123a929c20754882b636ca70
2019-07-30 14:22:10 +00:00
drh
822bc969f6 Disable the skip-scan optimization for DISTINCT queries.
Fix for ticket [ced41c7c7d6b4d36]

FossilOrigin-Name: a871d69c6de65038360aa6142fbad22689fb347e526cca56bb83e695c1441fbe
2019-07-30 01:17:03 +00:00
drh
8fbcb04811 Convert an assert() in R-Tree into a database corruption detection case.
FossilOrigin-Name: 48b518eb6f76fb0beb161d1ebcf3b793efc36262d6d77a1ad5906b6501138e28
2019-07-29 17:18:45 +00:00
dan
8279fe8a4b Fix a crash in fts3 caused by corrupt database records.
FossilOrigin-Name: 11f7f94f1c5d761e7f381e277658b7e857cc369283996c509061de55fd6aad52
2019-07-29 16:53:30 +00:00
dan
ed9d12dbc2 When using an index for both DISTINCT and ORDER BY, do not confuse the number of columns required for distinctness with the number required to get the correct sort order. Fix for [6749cb3c].
FossilOrigin-Name: 6ac0f822450b26c7d67c33cdb2a90189cd3cf65a052af8497b795c3f71a23813
2019-07-29 15:32:01 +00:00
dan
a79a0e733f When using an index for both DISTINCT and ORDER BY, do not confuse the number of columns required for distinctness with the number required to get the correct sort order. Fix for [6749cb3c].
FossilOrigin-Name: b47169319ad88e8ffdbe8fbb91f4cced81ebd5c0ee1b018be2d0256c9a1c5159
2019-07-29 14:42:56 +00:00
drh
337cc3992a Fix the OP_Affinity operator so that when applying REAL affinity, it
only sets MEM_IntReal if the integer value will fit in 6 bytes or less.
Fix for ticket [ba2f4585cf495231]

FossilOrigin-Name: 2b221bb15fd2b9f6a426e5eb439f7dbabbe3c4cab010c49b87dae3bb1f16c081
2019-07-29 06:06:53 +00:00
drh
122c514271 Fix a minor typo in a comment.
FossilOrigin-Name: cea8a892f76bddc63b921ffc11ea8dce8f8cf649a2c77aa908c7c5c91eed7f4c
2019-07-29 05:23:01 +00:00
mistachkin
f71a243a60 Sync up warning related compiler options in the Makefiles for MSVC.
FossilOrigin-Name: e77d48d1dd140967b18106044dd45e2ba6cd77b6aa5afa8bf3f0a9c16a50eec4
2019-07-29 02:52:11 +00:00
mistachkin
ac713403fd Fix harmless compiler warning seen with MSVC for x64.
FossilOrigin-Name: 857b2ba6d05d6f5a8cfdf269bae9005b25e1903ab9dc6b70546979d8c633f03b
2019-07-29 02:49:14 +00:00
dan
b8293a5bee Update RBU so that it supports indexes on expressions.
FossilOrigin-Name: 6bfa44da226fd758a2ee924d1e8e3a742b0635b6d3f922a4a7919cb14b2418e6
2019-07-26 20:33:23 +00:00
dan
dff1d5b61b Fix RBU handling of partial indexes with comments embedded in their CREATE INDEX statements.
FossilOrigin-Name: e1ccf211aa975a6688a27f7dc4cea80784ed8dcfe1950b2fa6eb0a3cb938838a
2019-07-26 16:16:31 +00:00
dan
bfe33f80dd Fix a potential buffer overread in fts5 triggered by a corrupt database record.
FossilOrigin-Name: 16472112b6886ada18d45cfb409cca2e83dde5a8ba8a36d481e87b61100b0186
2019-07-25 19:29:24 +00:00
drh
00c12a51e3 Fix faulty asserts in the code generator.
Ticket [c52b09c7f38903b1]

FossilOrigin-Name: 01cdc590f7894ea23ee0d674747d7ebf8196efbef3c87d47e72dbc1ab6ae2883
2019-07-24 23:15:19 +00:00
dan
9443dbc493 Improve the ".recover" command so that it handles intkey pages linked into non-intkey b-trees, and vice-versa, better.
FossilOrigin-Name: 9c458acba5a100a76148a3efb78ea9f57b85751e80788e4532694bd8976608a0
2019-07-24 20:10:27 +00:00
dan
01c08bcacd Improve the ".recover" command's handling of corrupt database schemas.
FossilOrigin-Name: becaaa4d29d17ad613f2a120f0b173e53403b3de26f22beaf83f66ebf369bf60
2019-07-24 19:20:30 +00:00
dan
95063c2867 Improve the ".recover" command in the shell tool so that it is not confused by auto-vacuum databases. And so that it can recover tables for which one or more of the column names are SQL keywords.
FossilOrigin-Name: 87d76047d6a3df31bc9b7c0cffa7b758236c124f87263a520850b019cbbc4c6e
2019-07-24 08:15:09 +00:00
dan
1c70f71e12 Avoid redefining types u32 and u16 when fossildelta.c is compiled as part of the amalgamation.
FossilOrigin-Name: d8e88248e3204b5f2b95b9b8921ee7ee2f7574ae81e6abd5b4f2ddf187f7d71b
2019-07-23 13:26:43 +00:00
drh
9378818d89 Do not use the insert-overwrite optimization if the cell might overwrite the
page header.

FossilOrigin-Name: f60a83069168899dcfd706b4d0901084c7ce92d85277950317e962a8a98ec668
2019-07-22 23:24:01 +00:00
drh
e209457295 Consolidate the removal of Window objects from the Select.pWin list into
a single subroutine.

FossilOrigin-Name: e46b2afc99329c43de08d4a2e6ade4d2239d7409c5d5626bf272a3e0dd24d1b4
2019-07-22 19:01:38 +00:00
dan
e0ae3f69eb Fix a bug in the linked-list handling code added by commit [fd7316cd].
FossilOrigin-Name: 05080344dceafcfb670fbf01f7d69a1d713a54b6845f968a9cfe941fb53b13af
2019-07-22 17:28:43 +00:00
drh
cda50737f4 New test cases added to test/fuzzdata8.db
FossilOrigin-Name: 25fec62ac5a23382a54eee78d3705885eb4065826d7e8da098816d03ae9dc639
2019-07-22 16:57:13 +00:00
dan
7f6f12bdd3 Remove Window objects from the corresponding Select.pWin list when they are deleted, as they are, for example, when the ORDER BY clause is optimized out.
FossilOrigin-Name: fd7316cda0fdfe86985f41a97dff3beba188606ec9bc6fef38a686a6976a6e01
2019-07-22 16:33:02 +00:00
dan
75b0821e99 Remove Window objects from the corresponding Select.pWin list when they are deleted.
FossilOrigin-Name: d23f33168222dfa40a67dc7de58057418151989e81429e4af47617e86db04667
2019-07-22 16:20:03 +00:00
dan
1e60261cfb Fix a problem with renaming tables when the schema contains an invocation of a currently unregistered aggregate with a FILTER clause.
FossilOrigin-Name: bd37ce3fb8dee8d538f6afc0bfc13cdc3ebdd504e6461f0130c6ecc8af585f68
2019-07-22 11:38:43 +00:00
drh
fd15e18d7f Make sure any window definitions in an ORDER BY clause are removed from
the SELECT statement if the ORDER BY clause gets optimized out.

FossilOrigin-Name: 23b119671f0be3c6b72cf2dc5f7707a0626766db7aa56529ab00d33d1a0a1bee
2019-07-20 21:12:31 +00:00
drh
7fc296aa66 Early detection of a corrupt R-Tree in the R-Tree search algorithm.
FossilOrigin-Name: 2bf5a4c16457562dc942bcc6ec06d9b4e795ef3ea8e31550e18857bbebd08a76
2019-07-20 18:00:46 +00:00
drh
bcb0e64c82 Performance optimizations in the rtreeStepToLeaf() routine of RTree.
FossilOrigin-Name: 4e34e3615ff31f4a6432033797b2e1a6604007ea0e501d714ecb362632776150
2019-07-20 17:43:28 +00:00
drh
e04c1ec52a New test cases added to test/fuzzdata8.db.
FossilOrigin-Name: 39be3c61bd809cc89bdfdba90afc391ac9c2f81dfd8bb68a9b085b0ca8cd1fba
2019-07-19 15:03:54 +00:00
drh
c5cc870ef8 Refinement to check-in [348e7f193a963390] that avoids unreachable branches.
FossilOrigin-Name: bbfb2908ecd113c88e69a0984cbe2550463cdd3a67648b0e4e3578e80630136e
2019-07-19 15:00:32 +00:00
dan
9bf022d57c Fix a problem with renaming a table when the schema contains an invocation of a window function that is not currently registered.
FossilOrigin-Name: ff290feb97f689cf6ce4162d6aa36f9f9dcf1bff3096847d53a85f39f728d2de
2019-07-19 14:32:42 +00:00
dan
750c6ba5e5 Fix a problem with renaming tables when the schema contains WINDOW definitions with (illegal) non-numeric expressions as part of a PRECEDING or FOLLOWING clause.
FossilOrigin-Name: 348e7f193a963390a0595183d603541f85c5d1a911c98ed2e06599691ffe98f5
2019-07-19 11:20:42 +00:00
dan
a1ac03590b Fix a faulty assert() in walker.c that could fail when processing an ALTER TABLE statement on a schema containing invalid table references that are part of a WINDOW definition.
FossilOrigin-Name: ee076c28d8ee0f5b099cdef83ae6cea6ef5aa209ab528d7c49949dd653ce019c
2019-07-19 10:31:29 +00:00
drh
b555b0806e Fix a new problem in the BETWEEN operator when applied to a window function.
The problem was introduced yesterday by check-in [7ef7b23cbb1b9ace].

FossilOrigin-Name: 47e23064ba0205148f89e12803a62d5a4d6d2054f593f60c031e815112170b9b
2019-07-19 01:11:27 +00:00
drh
4509ffa362 Always use the stdlib.h intptr_t type for pointer-integer conversions, when
it is available.

FossilOrigin-Name: c0d932449db3deed42a99bd948aab61e56b2d8441d7de5243688695ff04e8177
2019-07-17 19:57:55 +00:00
drh
996f5ccb33 Fix an incorrect assert() in balance_nonroot().
FossilOrigin-Name: 59c9e73f86b89ee17b0bce47bcb93f5b5ace5b7985678287195002afb9d40cd8
2019-07-17 16:18:01 +00:00
drh
09ea1256ec Improvement to the hexdb interpreter built into the CLI and into the
TCL test harness: Round the "size" up to the next multiple of the "pagesize".

FossilOrigin-Name: 9ec92939cb2d2c96ae15bc496feed233ce31424c25a6bf86ace7e0ef3eedec5b
2019-07-17 15:05:16 +00:00
dan
8b65e5919d When processing a BETWEEN or CASE expression, avoid transforming a node of the original expression into a TK_REGISTER node. Instead, take a copy and use it instead. Fix for [1be72aab9].
FossilOrigin-Name: 7ef7b23cbb1b9ace9f853238d9133320c153e6c3417e6823ab6394ee1fe56358
2019-07-17 14:34:17 +00:00
drh
3db3d12cd1 Fix the WITHOUT ROWID table logic so that it generates a correct KeyInfo
object for tables that have a PRIMARY KEY containing the same column used
more than once with different collating sequences.  Enhance the index_xinfo
pragma to assist in testing the above. Fix for ticket [fd3aec0c7e3e2998].

FossilOrigin-Name: 84a51a755c18ac8253080db6eec505df894ee3b1e97cfa8e61039ac38001e270
2019-07-17 12:49:16 +00:00
drh
19d9a3ca6c New test cases for PRAGMA index_xinfo on a WITHOUT ROWID table. And new
testcases using index_xinfo to verify that WITHOUT ROWID tables are
constructed correctly.

FossilOrigin-Name: 340378c1e60da80263523776f4b6366a9d332a7ee25986637e8b157f4e8e4bd3
2019-07-17 12:42:15 +00:00
drh
7b1904e35d Enhance the "PRAGMA index_info()" and "PRAGMA index_xinfo()" statements so that
they allow a WITHOUT ROWID table as their argument, and in that case show
the structure of the underlying index used to implement the WITHOUT ROWID
table.

FossilOrigin-Name: 62274ff683ba077d8b0fa34ad653ce235a8c5cbfdb7ab8558469af7333d03698
2019-07-17 11:01:11 +00:00
dan
1ff9407198 Fix problems with duplicate fields in the PRIMARY KEYs of WITHOUT ROWID tables.
FossilOrigin-Name: bd9a47a3a2997bfbf9c8a11c5b7196e362974054e58a2fe701778b1580264de8
2019-07-17 09:18:06 +00:00
dan
4d02b5f7d0 Add casts to shell.c.in to avoid warnings on systems where size_t is 32 bits.
FossilOrigin-Name: fe014288ac03cdf0dc5410b7d45cad4768759b52746c0a22bce2fc03779c5d5a
2019-07-17 07:23:06 +00:00
drh
55f66b341a Add new assert() statements in an attempt to help static analyzers avoid
false-positives.

FossilOrigin-Name: 9e66458592d40fbd96ea5f21339573110ca1cfe328238a020c9420a87d35dd72
2019-07-16 19:44:32 +00:00
drh
2cd02a5d2a Add assert()s in os_win.c in an effort to silence false-positives from
static analyzers.

FossilOrigin-Name: 22a7c15b262376fb0ce4dd3d044373380d86c5ccd96e2f24576cf04318597c33
2019-07-16 18:27:07 +00:00
dan
993b48e2b7 Call ioctl() with the correct signature on both Android and stock Linux.
FossilOrigin-Name: 2422534908a85a4cd11784e4c23a74ad121404f73dade587bf27efde1e2b982b
2019-07-16 05:11:16 +00:00
dan
e464802d49 Fix a problem that could cause a crash if a blob handle were closed after the associated database handle was closed using sqlite3_close_v2().
FossilOrigin-Name: 52f463d29407fad691c42b13462880e7605603c9be9f480d18e953a0ef78149a
2019-07-15 13:58:28 +00:00
dan
ec9b2a132b Call ioctl() with the correct signature on both Android and stock Linux.
FossilOrigin-Name: 68e12e063fe41bcd65cf8a120f838b9b1723ed803ea85240fe0f2145b78df2d7
2019-07-15 07:58:28 +00:00
drh
08e2e8e680 Mark an unreachable branch using ALWAYS().
FossilOrigin-Name: 0fff105a3e501fd91877d67761459eb0323e6cf79916242027cce0d05697f554
2019-07-14 00:15:07 +00:00
dan
0088574271 Fix a memory leak that could follow an OOM in the new FILTER code.
FossilOrigin-Name: 85fd70fead834aed16cffbea892b2255b4e10dd677f4dbbb96062d5ff42efdeb
2019-07-13 18:27:54 +00:00
dan
8f245174a3 Fix a typo in test file window1.test.
FossilOrigin-Name: 8c80e81d01abde9a5032cdc1a492d0fccd8db139f78d2db9413a60cfdc8e0f64
2019-07-13 17:54:24 +00:00
dan
5e61c1b741 Fix error handling for the case where a window function is passed the wrong number of arguments.
FossilOrigin-Name: 871796bb19e61c1282d8ac97a82d8b57bde50f2a2a08004ab53136d77c138df4
2019-07-13 17:45:25 +00:00
drh
ea38f4f4cc Fix a double-quoted string literal used in the ".schema" command of the CLI.
FossilOrigin-Name: fcd937d9786a82ef4147e657d54ea0beb6ac87e2eb1677186b318493d473077b
2019-07-13 17:21:47 +00:00
dan
df9d32441a Add support for attaching a FILTER clause to an aggregate function.
FossilOrigin-Name: ee293e5aeac0b05a8b809095610fd8b4fdaf8e68cd368de90ec0d45e3582ffe5
2019-07-13 16:39:38 +00:00
dan
4f9adee289 Rework the FILTER clause implementation to share more code with window functions.
FossilOrigin-Name: 5dac8c38dfc3f41c5c8fb49ca35de7fd1b21f269d72e8ba6ba59ed0a4030a54d
2019-07-13 16:22:50 +00:00
drh
8616cff6c8 Remove unreachable "break" statements to silence harmless compiler warnings
from ICC.

FossilOrigin-Name: 0d7287e1bfdd5a392bf2fb17699e7cfd0b08bf61fab6cbf4b4bb347b3c4b4610
2019-07-13 16:15:23 +00:00
dan
648d629953 Merge latest trunk changes into this branch.
FossilOrigin-Name: 86ab963cc5743867e0535b78a5776e18c13835aa44bf2009f77642df8407cb3f
2019-07-13 09:56:56 +00:00
dan
01fd42beef Trivial performance improvement for balance().
FossilOrigin-Name: c7920f5569022f645ec4dbfce8c228880263785c708c2c0ac065e770c438b1d9
2019-07-13 09:55:33 +00:00
dan
52d9a3c213 Minor performance improvement in vdbeRecordCompareString().
FossilOrigin-Name: 777fec84a5db968e033883920586ec0afef65578be0c1eb3021fce525111edde
2019-07-12 15:15:43 +00:00
drh
76fd7be3a3 Improved comments and extra testcase() macros on the serial-type computation
logic in the OP_MakeRecord opcode.

FossilOrigin-Name: 18bfb2179ce2c60cec8f5859a84b737731a5e53b28e35072cbb249f18b94262b
2019-07-11 19:50:18 +00:00
drh
7f88a24dc6 Increase the version number to 3.30.0 for the next release cycle.
FossilOrigin-Name: 2578e3c64b0a92ab92143f18d107a1a180bd6fa87243661930771c4c080f8098
2019-07-11 19:27:02 +00:00
drh
c1da4397d6 Move the sqlite3VdbeSerialType() routine in-line in the OP_MakeRecord opcode.
Optimizing compilers were doing this already.  By doing it manually, we can
omit some redundant tests and make the whole thing run a million cycles faster
and use about 80 bytes less code space.

FossilOrigin-Name: d837ab0da52632699abc09320980606aef020df5020c253f99c97e24bf3c6d00
2019-07-11 19:22:36 +00:00
dan
6488271f05 Change the parser on this branch to more closely match trunk. This saves a few more cycles.
FossilOrigin-Name: be01b801fbc258f0ab9542130cec12a5ea5e2d0bf087684a9eda909ad459c211
2019-07-11 18:43:33 +00:00
dan
8117f113bc Minor performance improvement in sqlite3ExprDeleteNN().
FossilOrigin-Name: bcc8b38ac75b731a4cd2873ab83f423be036467a511b617c779869de9bbb5383
2019-07-10 20:16:53 +00:00
drh
ea7e83b780 Version 3.29.0
FossilOrigin-Name: fc82b73eaac8b36950e527f12c4b5dc1e147e6f4ad2217ae43ad82882a88bfa6
2019-07-10 17:32:03 +00:00
drh
ea9b564d78 Add the "LL" suffix on a pair of larger integer literals, for compatibility
with older C compilers.

FossilOrigin-Name: 6f328c35947d6b3a0741514757b8944692203e89bdb2e7f9bbce8ad9288be344
2019-07-09 23:35:50 +00:00
dan
f446a7a8cd Update rtree.c so that SQLITE_DEBUG is required to turn on assert() statements, even if it is compiled separately from the amalgamation.
FossilOrigin-Name: b6e17f0139482a22c2fc84552767bc9a293b282499e3a790de069e0e84455fb2
2019-07-09 17:36:26 +00:00
dan
e0155b7af9 Fix a test script problem in windowfault.test.
FossilOrigin-Name: 47010bf17cb080cc1c693c84d16b986ea4addf9c54bd7e22de1e0f6b555ea9d1
2019-07-09 12:03:21 +00:00
drh
0ba323476a Fix dbfuzz2 so that it will compile on systems that do not support getrlimit().
FossilOrigin-Name: 36295dcebcb5487f2a462eabb41900ac28b8e839898ef0fae0aa4730bf9b0671
2019-07-08 18:35:51 +00:00
dan
bedf84c17b Fix an assert() that [28196d89] caused to fail.
FossilOrigin-Name: 8fb0c6d5a38e77aa4c5f394fb8af1b0c7c6a4790e932aabc213a3078ee9acaf6
2019-07-08 13:45:02 +00:00
dan
62742fd264 Ensure collation sequences and affinities work in window function queries. Fix for [9ece23d2].
FossilOrigin-Name: 28196d894ac9fad9d8f877c7bf17ec9d299d12acdcc942f9ea0783777b14fdc5
2019-07-08 12:01:39 +00:00
dan
1efcc9dd96 Another very small performance improvement.
FossilOrigin-Name: 7a1e30a17f57ca006dd84b6f97b0c7811bf4c6da4b02903452ffc4bc363cab9b
2019-07-05 19:10:41 +00:00
dan
b28c4e564a Minor tweak to patch on this branch to reclaim some cycles.
FossilOrigin-Name: 81eed055de856068109a7e332cca0c3ff1120ebe2bfa5ed6383b165c726e0a7c
2019-07-05 17:38:55 +00:00
dan
7d840e530f Fix a valgrind problem in fts3corrupt4.test.
FossilOrigin-Name: cb3dec427e399064eeec31c15565346f045bd7c46d2f7860b1cd346bbcccb124
2019-07-05 15:16:22 +00:00
dan
e88c0cde6c As it requires wal mode support, do not run test file chunksize.test as part of the "journaltest" permutation.
FossilOrigin-Name: acd2df36c2876ff3cc477889fc99f493cdf53a656bdb84bde6121676c9eeed1f
2019-07-04 19:19:08 +00:00
dan
79d8aa24f1 Fix a typo in the wapptest.tcl script.
FossilOrigin-Name: 971b4422ae7a8eed67f5db62c0e1cc061faac9404ff5f7051d7e07decf2207a4
2019-07-04 16:30:41 +00:00
dan
40d6c827e9 Have wapptest.tcl run at least one threadtest with an SQLITE_ENABLE_MEMORY_MANAGEMENT build.
FossilOrigin-Name: d6131caf6471ad41fa5a28b0067d759ac1cc9dba1170678534488b416f9a1157
2019-07-04 16:06:59 +00:00
dan
a082cd75a1 Fix a race condition that could occur in SQLITE_ENABLE_MEMORY_MANAGEMENT builds when two threads simultaneously open the first two database connections in the process.
FossilOrigin-Name: 5ea3f6fc88cf66824128aa64f777a7abb4f6ed55f214d7a135f36e306a32487c
2019-07-04 16:05:26 +00:00
dan
16e12c573d Add tests for the FILTER clause. And a bugfix.
FossilOrigin-Name: 28aa1702f7f0334abd1b30e7aa48ea3679539b11bfbba32bc9f0d6049cf18a7b
2019-07-03 18:31:20 +00:00
drh
4b50da9c95 Restore the legacy behavior of enabling double-quoted string literals in
all contexts.  But also provide a new compile-time option (SQLITE_DQS) to 
change the default to something more restrictive.

FossilOrigin-Name: 97a94446f3941c313c4c3a19d9f89f24d7ef06e842f79d66f0ad88810b872084
2019-07-02 12:23:09 +00:00
dan
6ba7ab0d25 Experimental implementation of FILTER clause for aggregate functions.
FossilOrigin-Name: 1f1ae2d6ac8dcbb62e5aa3dc17bc67d559cb565fc0d0a8c00a596075d35f8130
2019-07-02 11:56:47 +00:00
drh
00a6153faf Use the OP_Sequence opcode for generating unique rowid values for an
autoindex on a co-routine implementation of a subquery.

FossilOrigin-Name: eab4297577e4d325fed4757867fc77860de7448998d86f098c8a50272e17d35e
2019-06-28 07:08:13 +00:00
dan
855b5d144a Ensure that when an ephemeral cursor is reopened with a second invocation of to OP_OpenEphemeral, the sequence counter is reset and the cache marked as stale. Fix for [9cdc5c46].
FossilOrigin-Name: 5fd20e09a522b62a529cf4d76fbdf0a09426f67ffa30430cac6b81ebf32ba43e
2019-06-26 21:04:30 +00:00
dan
07312a6b06 Fix a typo in an option name for the .dbconfig command in shell.c.in: s/wriable_schema/writable_schema/
FossilOrigin-Name: 1c58522e49cd91426bca7efccf0d99e0f2803dcd5991ae5d56166fc5510e4c62
2019-06-21 14:05:27 +00:00
dan
fe9a832e80 Fix a problem with handling with handling quoted path elements in extension functions json_set() and json_insert() reported on the mailing list.
FossilOrigin-Name: 45bfcb88e71451a656982e217375e257fc8e68374349c2984be1266bf86fb8cf
2019-06-17 14:50:33 +00:00
drh
d9678890a9 New sqlite3_db_config() options:
SQLITE_DBCONFIG_LEGACY_ALTER_TABLE,
SQLITE_DBCONFIG_DQS_DML, and
SQLITE_DBCONFIG_DQS_DDL.

FossilOrigin-Name: a61db8ff6713d66778a0500ca4049229c081a3ae95991f05eba09729434444b3
2019-06-17 14:13:30 +00:00
drh
d0ff601c62 Improved interface to double-quoted string literal enabling/disabling.
FossilOrigin-Name: 923cfd53fcff2fcb91530bf819d2ecb0eda3f6a27dae29c7460f9ce3a3ffce7b
2019-06-17 13:56:11 +00:00
drh
cf175c193b Avoid transforming TK_COLLATE or TK_UNLIKELY Expr nodes to TK_REFERENCE.
Instead, transform the uppermost Expr node in the expression tree that
is not of this type. Fix for [e1e07ef2].

FossilOrigin-Name: 54110870487f78013ab1b554413c18baa2bdc07d979bc65c110f32d30c3b53fe
2019-06-16 14:56:41 +00:00
dan
069d1b1faf Avoid transforming TK_COLLATE or TK_UNLIKELY Expr nodes to TK_REFERENCE. Instead, transform the uppermost Expr node in the expression tree that is not of this type.
FossilOrigin-Name: ba7870e292919cf6c2f4b65b63fb0420ba2718eb0a797e0ba5302eec551a4238
2019-06-16 08:58:14 +00:00
dan
e3664dcb48 Fix minor problems in the test code in test_demovfs.c.
FossilOrigin-Name: ca4ddfefc1be1afbf366d87c47f0dd1122350d7ab34ba60020c5babb64a654a4
2019-06-15 15:32:37 +00:00
dan
44c99ecf9c Add extra test case for one of the problems fixed by the previous commit.
FossilOrigin-Name: 0bbceebb126c94b5159079a341fa16e8424b7f2f6b9364561516964e871fb6e0
2019-06-15 15:27:37 +00:00
drh
bdf4cf0b90 Ensure that sqlite3RenameExprUnmap() does an unmap of the result set alias
names in subqueries when ALTER TABLE fails because of a syntax error in a
trigger.

FossilOrigin-Name: d3b6f1665f6fb5fc5cf1c0864d779d0b24746ada530f755c7b6ff34766bd2188
2019-06-15 15:21:49 +00:00
drh
0a6873bfd6 Add SQLITE_DBCONFIG options LEGACY_ALTER_TABLE, NO_DQS_SCHEMA, and NO_DQS.
FossilOrigin-Name: 1fad20925efa70d0c242e9cba8fa55456fb07a81229c1068da84c6e27d0c0be8
2019-06-14 21:25:25 +00:00
drh
c164cc992f Deprecate the SQLITE_ALLOW_COVERING_INDEX_SCAN compile-time option when it is
turned off.  This probably will impact no-one.  If it does, they will get an
error message instructing them to contact developers, so that we can get
feedback that somebody is actually using this feature.  Start-time disabling
of covering index scan is not affected.

FossilOrigin-Name: 23e49f9984f74f242602c6e56bfc645585c7c86bcdd585c322ab0d8e20958d86
2019-06-14 17:37:39 +00:00
drh
821afa44c1 Fix the implementation of the built-in RTRIM collating sequence so that
it works for control characters at the end of the string.
Ticket [f1580ba1b574e9e9]

FossilOrigin-Name: 86fa0087cd1f5c79ed51b99a226ec2eef5b0fa0a23981d469bec0e02fadf2a68
2019-06-14 13:24:46 +00:00
drh
060b7fa974 Refactor the LIKE optimization decision logic so that it uses
sqlite3AtoF() on both boundary keys to determine if the optimization can be
used when the LHS is something that might not have TEXT affinity.
Ticket [ce8717f0885af975].  See also [c94369cae9b561b1],
[b043a54c3de54b28], [fd76310a5e843e07], and [158290c0abafde67].

FossilOrigin-Name: b4a9e09e60213ccff925d09f0b6e549e2a3e3862856c710f108779e2867dec76
2019-06-14 12:28:21 +00:00
drh
4eb4e4fe7e Add a new requirement mark on the ctime.c code.
FossilOrigin-Name: c4b405687b010ee20ec02c42913a0540909d0155c88a4a56194fda99c704279e
2019-06-13 16:14:53 +00:00
drh
e25007602b Do not use the %lld printf conversion in the platform printf() as some
legacy platforms do not support it.

FossilOrigin-Name: f8696b60eec0dcacfe92d9a31cbf1436d674140e5447de0cd1c2f52bff6c2be4
2019-06-13 14:07:41 +00:00
drh
4245e0456d Fix a minor error in a test script, and harmless compiler warnings in the CLI code.
FossilOrigin-Name: eaa34626e497d3af132dd8f13eddbbda89365d369ed43212a5f788175b3d6198
2019-06-13 13:52:46 +00:00
drh
0ce974d122 Adjust requirements marks and add new requirements tests.
FossilOrigin-Name: ebb81dad1f43dac4636cd44d4055d1d4b198c675f73e23c5a2d8d992ae27fe1f
2019-06-12 22:46:04 +00:00
drh
13d0402077 As a special case, casting '-0.0' into numeric should yield 0.
Fix for ticket [674385aeba91c774].

FossilOrigin-Name: 491f0f9bbddb6302536d99abd1ea481fd747ddcf6c6eaaacc0338d147b119081
2019-06-12 20:51:38 +00:00
dan
6ece353f2d Handle expressions like "expr IS TRUE COLLATE xyz" in the same way as "expr IS TRUE". Fix for [4d01eda8115b10d1].
FossilOrigin-Name: 5c6146b56a75a94f4baa10e95407c54dd0b9314a57a8702a4b96b15c4d7ac48c
2019-06-12 13:49:32 +00:00
drh
a7d6db6ac0 The affinity of the unlikely() function and its cousins should be "none".
Ticket [0c620df60bffd9ef]

FossilOrigin-Name: 614ecb0af47038848e8ba2aed6b92db6f33ddc4aea6361795dbde440380f5a35
2019-06-11 21:02:15 +00:00
drh
42be2ad30b Make sure the affinity of the RHS of an IN operator does not affect the
outcome even if the RHS expression contains a COLLATE clause.
Ticket [57353f8243c637c0]

FossilOrigin-Name: 0f748fe58bbbb7ce3f30303da25ec811b2bbce249549aa9c7927979ac5b38013
2019-06-11 18:07:53 +00:00
drh
2c3f46500f Mark an unreachable branch with an ALWAYS macro.
FossilOrigin-Name: d4755aca4b435eed62b54af84013f7f176d3fa5b7b1c243555d59de5749fcde5
2019-06-11 16:43:58 +00:00
drh
66cc2ca83a New test case in fuzzdata8.db.
FossilOrigin-Name: e96641f0be7d4454215459b0a95cf1c46ba0133e46d0bae22269741c8f4e5b44
2019-06-11 16:07:39 +00:00
drh
fa685947d8 Off-by-one error in the CAST to NUMERIC logic.
FossilOrigin-Name: 25b89630206fdbb41c756e98f99baa711d35a8c226697a92339d0fe7e8b3652a
2019-06-11 16:06:05 +00:00
dan
0b277a980a Have the ALTER TABLE code handle the case where an entire expression that includes a sub-select is excluded from a view, trigger or index.
FossilOrigin-Name: f2c8179f3c0b77f10da3f9b0771db4dec30d0bbf0b7f4751ce439bfb08da8f6f
2019-06-11 12:03:10 +00:00
drh
8e34e4061b Add the new sqlite3ExprUnmapAndDelete() function and use it in place of
separate calls to sqlite3RenameExprUnmap() and sqlite3ExprDelete().

FossilOrigin-Name: 36ea13e0a851a749c9ef292377ecd82dbd4797d38df907b362487fa234c98ca5
2019-06-11 10:43:56 +00:00
drh
b854b76733 The ALTER TABLE command should not attempt to rename objects that are
contained within an expression tree that has been optimized out because
it is the other branch of an "AND false" expression.
Ticket [533010b8cacebe82]

FossilOrigin-Name: 04bd5cb73287f926f1ecf578998fa6ce1379474e86918c692eae5778d0817cef
2019-06-11 02:43:22 +00:00
drh
a753d40039 Fix repeated test numbers in the altertab2.test file.
FossilOrigin-Name: e82f235e7201a420149847cda630ac6f2fce5e3a4577b0ea4793f430d3dc1611
2019-06-11 01:56:42 +00:00
drh
e53be9f236 Remove a comment made obsolete by check-in [71643deb6bbad4b4]. No changes
to code.

FossilOrigin-Name: 211c8002d5ea4b224125d4ed395fe15767d1dc32a77b40b89fdfc80bdd1c5a48
2019-06-11 01:30:39 +00:00
drh
378a7d356b A string consisting of a single '.' is not a floating point literal with extra
text at the end.  Fix for ticket [412bba9b22c677da]

FossilOrigin-Name: 57050162294efec90caa5cc3c2f8c1a85215526adcf57b284ce2d2e799286b78
2019-06-10 23:45:10 +00:00
dan
e4a9e4d0e5 Have ALTER TABLE commands ignore the lhs of "expr IN ()" and "expr NOT IN ()" expressions, just as other queries do. Fix for [533010b8ca].
FossilOrigin-Name: 71643deb6bbad4b4a511bfd43b32245b50a555b508b90f33adf0656ae53292c6
2019-06-10 19:17:37 +00:00
drh
99778c4b21 Improvements to the documentation for the xAccess method of the VFS.
Ticket [5e0423b058fa5adf]

FossilOrigin-Name: 7078d77effc296c63c91ec032c866e2b320f081d58e57e9e83cc58373169bda3
2019-06-10 19:07:15 +00:00
drh
c285ded26c Make sure a CAST to "NUMERIC" results in an integer if the value can be
losslessly expressed as an integer, as the documentation requires.
Ticket [dd6bffbfb6e61db9].

FossilOrigin-Name: c0c90961b4fa1c1185772d04fe1915bc1a1af27ed8ddb8db1c524bf90d68ccbf
2019-06-10 18:33:16 +00:00
dan
e20a894a34 Handle renaming a column or table when the schema contains a (meaningless) index on the constant expression ('text' IN ()) or ('text' NOT IN()).
FossilOrigin-Name: 567b13093956185b5d5e971b81ba4788fd9d26c03688f643b380f0f1c1a94da0
2019-06-10 15:34:16 +00:00
dan
32d0f64e8d Do not attempt the LIKE optimization on a column with numeric affinity if the rhs of the operator begins with whitespace. Fix for ticket [fd76310a5e].
FossilOrigin-Name: 94b58ab059cba9771e75f16d1460f313104a8fb879f9f8805725d362aa58cbcd
2019-06-10 13:46:42 +00:00
drh
55700bcd72 Remove code in the round() SQL function that became unreachable due to
the optimization of check-in [e95138f5f4febde5]

FossilOrigin-Name: b141bae3f6d16c0ebb59dac9b02086a4370839e71ade34004f647b09b1083d1d
2019-06-07 22:51:13 +00:00
drh
9a2782293c When casting string values into numeric and the string has a prefix that looks
like a number but total string is not a well-formed number, then take extra
care that the result is either integer or real depending on what the prefix
looks like.  Fix for tickets [e8bedb2a184001] and [4c2d7639f076aa].

FossilOrigin-Name: 67a68af5578f08d2be2e48cf4fd12a6cf35a09c47d259deda81950f7ee1f02f7
2019-06-07 22:26:08 +00:00
dan
4eefeb5577 Also upgrade script config.sub to the latest version. This should have been part of the previous commit.
FossilOrigin-Name: efbf31b82e6e16fda88d8cea54202a8593ff52f2267a44dba828704818162e66
2019-06-07 18:56:03 +00:00
dan
9cc867d09c Upgrade the config.guess script to the latest version.
FossilOrigin-Name: be8438133f6cd87e5d51f15cfd1eed83176b3239334875eb0c3dec502cfe39d3
2019-06-07 18:53:51 +00:00
drh
d985f7260b CLI enhancements: Add the ".filectrl" command. Make the ".testctrl" command
visible to ".help".

FossilOrigin-Name: 7b3a99fce8b4a757f2b2ef2f0b02d68566f2528d9ae1e30628522717f872466c
2019-06-05 14:29:53 +00:00
dan
48646e497b Add a test case for the unix SQLITE_FCNTL_CHUNK_SIZE file-control.
FossilOrigin-Name: 3a477fd0c944440be03d23c667053b346c769c6a4f6ba1ef094b7581a08d7bd4
2019-06-05 13:14:19 +00:00
drh
f9c7c4b1f2 In the CLI, add a small delay (0.1 seconds) after launching the output
command for ".once" before deleting the temporary file.

FossilOrigin-Name: 4979f138e8c8bef7dd6b5921fb9ca9fea86bbf7ec1419934bb2d1a0d74e77183
2019-06-04 18:21:59 +00:00
drh
9b2ec0efa1 New dbsqlfuzz test cases add to test/fuzzdata8.db.
FossilOrigin-Name: 873aa46da3d0f97784cad94828fc367bb2ceb13d5ece2e105320f404b3971c85
2019-06-04 15:47:37 +00:00
dan
471e88f732 Fix a segfault in fts3 that could occur when processing corrupt fts records.
FossilOrigin-Name: dff24c6c7a4e7623984b5bb24c2ff14fe079dc49a0ad048cbfc66f84c08875b0
2019-06-04 13:11:37 +00:00
mistachkin
17df761a84 Fix harmless compiler warning in lemon.
FossilOrigin-Name: 2da0eea02d128c37f2fbe764227ac526d3e993284516544adc0a216a035c5676
2019-06-03 15:09:25 +00:00
drh
84422db987 Optimization to the round() SQL function for large input values without a
fractional part.

FossilOrigin-Name: e95138f5f4febde598f39e031d6e4f4d5ad0adbd8dcdd34fd0baaa78ab393417
2019-05-30 13:47:10 +00:00
drh
05921223c2 Smaller and faster sqlite3IsNaN() implementation makes deserialization of
floating point values much faster.

FossilOrigin-Name: ea748edecb261f2b862d542daff6e99a6fd8879a8ace94b440d99e110577d1c1
2019-05-30 00:46:37 +00:00
drh
8a3884efae Much faster implementation of applyNumericAffinity() by avoiding some
unnecessary calls to sqlite3Atoi64().

FossilOrigin-Name: c1d8a3f65490eef2216f360d708b1746cbaa6dadce42c0950dc8e09b9ab28ee2
2019-05-29 21:18:27 +00:00
drh
b0968b6b14 Add an assert() as an additional test for fix in check-in [523b42371122d9e1b3].
FossilOrigin-Name: f9e85e6c79162081f8f512d22951931a89d157a32b24afdc48b7eb865379abe7
2019-05-29 18:33:59 +00:00
drh
7cd5e856e5 Fix the query flattener optimization so that it preserve the "SF_Compound"
bit when flattening a compound subquery into a non-compound outer query.
Failure to preserve that bit could allow subsequent flattenings which are
not valid. Fix for ticket [c41afac34f15781fe09cd].

FossilOrigin-Name: 523b42371122d9e1b3185425745f1490138bff7f7cc941ee26ee81df7ade5bf4
2019-05-29 17:22:38 +00:00
dan
efdb371a1d Fix an assert() in fts3 that could fail when processing corrupt records. Also some minor sanitizer warnings.
FossilOrigin-Name: c736c40aab071a69bd5c5347b7c116d87ea3954019e967ca8ff7bdb4b518e5bf
2019-05-28 14:42:32 +00:00
drh
0a0e89fa21 Fix an error message on the blobread() extension function so that it says
"read" instead of "write".

FossilOrigin-Name: 7cbb9a5fe835d01be158edd1e2f9d553dc257f2d27b53a5d5bf6660d0bd101c4
2019-05-27 11:21:43 +00:00
drh
3517cc7f36 Fix a memory leak in the delta_parse() table-valued function of the
fossildelta.c extension.

FossilOrigin-Name: c86ca3f0220a5f9e7f7f1818f6e1220d851f3ebed6a5f0aae6ac38309bd2930e
2019-05-27 11:09:55 +00:00
drh
ef7d5187a7 Improved rounding even on systems with an 8-byte "long double" type.
FossilOrigin-Name: 15202aee150fa8e15fb90e90e5765c5e19a1eaf4896da2996a747636b76da8e6
2019-05-27 00:29:15 +00:00
drh
c2b893a7e0 Performance enhancement in sqlite3AtoF(). About 8% faster.
FossilOrigin-Name: 81721aa54587e20d031d528fb6b74d91671a6e950fa926dc63f4284466e70f0e
2019-05-25 18:17:53 +00:00
drh
38a59af417 Use "long double" literals to initialize an array of "long double" objects.
FossilOrigin-Name: 2e2ebad3ab636c4c65814ad41d417b105be8e254d609d0e08fbba4c5bd107bf3
2019-05-25 17:41:07 +00:00
drh
4413265d4e Add new cases to speedtest1 for measuring performance of binary to/from decimal
conversions of floating point values.

FossilOrigin-Name: b84e7057c05338347b4267f7ccc1d7b9b6d4e9a941ce8b76bf2c27c26772000c
2019-05-25 13:14:19 +00:00
drh
aa81cae485 Disable the new rounding tests on systems without long double support.
FossilOrigin-Name: ed250b4e18ea042d681bbe8d7ed00895564f4525c22928a003a84585b4756ec3
2019-05-25 00:17:26 +00:00
drh
a0ed86bc37 Improvements to rounding behavior in the round() and printf() functions.
FossilOrigin-Name: 641b2d210541b4d5a1a9e57d7dcf5ce5dfd7ff4d2dc6277ba0582869f48fc946
2019-05-24 22:58:16 +00:00
dan
98d63579be Fix an fts5 segfault that could occur after parsing a corrupt structure record.
FossilOrigin-Name: 600daa9c27206628bf74892376ded35dac11fe0a34894fcd975ad5041a0a0fda
2019-05-24 11:55:01 +00:00
dan
c542fa8573 Add test cases for the fix in the previous commit.
FossilOrigin-Name: c1057b2a60add08e5c80ef2a53932a690b096f2eb03c7de863844deaa8fc9d53
2019-05-23 16:40:45 +00:00
drh
30ad79aeb4 Improvements to the view-self-join optimization so that it works on all
VIEWs, not just on Common Table Expressions.

FossilOrigin-Name: d2fe370cafa9b11f6c3eb4e1c3be48d9d2610b9d2f9d9ebf9e50267f9079dfc0
2019-05-23 16:38:12 +00:00
drh
53e8709b75 New test case for check-in [74ef97bf51dd531a] that takes the fix in the
previous check-in into account.

FossilOrigin-Name: cb1d06521de5918a2324a41e207b48c5e5149c23b927b9e3e1f3c3b38b82658e
2019-05-22 23:12:10 +00:00
drh
59145813d2 Renumber the Select.selId values in the copies of SELECT statements that
implement VIEWs when the VIEW is expanded, so that when the same VIEW is
used twice in the same join, each expansion as a distinct selId.
This fixes ticket [ce823231949d3abf42453c8].

FossilOrigin-Name: 3cacc4b940fd69776d930deec9512df47a2f22cb04fb955e354a0b25bdec287c
2019-05-22 22:49:23 +00:00
drh
90c21df233 New dbsqlfuzz find added to test/fuzzdata8.db.
FossilOrigin-Name: 42af7c819bc52ccb6953a58b1c05d3bd47cc438c5119a9555b1b796764eb9f20
2019-05-22 14:35:10 +00:00
dan
29fa6b6642 Fix a buffer overread that could in fts3 when dealing with corrupt records.
FossilOrigin-Name: 1660d7733eb443ab085ddef7666b998a1c75ac81cc54a9620960a8d3b377e28e
2019-05-22 14:22:44 +00:00
drh
51e441da2b Combine the implementations of the key and hexkey pragmas into a single
case.  Have both pragmas return "ok" if they are implemented.

FossilOrigin-Name: b3692c406f7ba62587c9d3256f888748393519680e9e2db53f59557f1a300e05
2019-05-21 17:04:27 +00:00
dan
7ed6c068f5 Fix a problem in [b5ca442a] causing an assert() to fail in REINDEX commands.
FossilOrigin-Name: a3e77c7776ab01dadb9d30d6067ac97e9d4b09ec54834558a5fa1ffed7b52c72
2019-05-21 16:32:41 +00:00
dan
ef14abbf8d Use a statement journal for all CREATE INDEX statements in case an indexed exprsesion throws an exception when it is evaluated. Fix for [b5ca442a].
FossilOrigin-Name: b8071d10cba8f6c19fb8d5df3877f72567dc6d6a94744a39cbc1f58b2e2f343b
2019-05-21 14:42:24 +00:00
dan
595d9f5f3c Fix a segfault that could occur in sqlite3session_diff() if NULL were passed as the pzErrMsg argument.
FossilOrigin-Name: aee73fd28f031a2568ac723de0826be7f1dca6be3b049e4a04fb47af75dcf4bf
2019-05-20 19:46:30 +00:00
drh
acd6bb5fe4 Improvements to the automatic compile-time selection of byte-order, as
suggested on the mailing list by Seb Kemper.

FossilOrigin-Name: b7aad929619f7043b1685a6477d50f6b4436e85511eb365eceae3dd4dbab571a
2019-05-20 18:43:57 +00:00
drh
3e4f6c43b8 A minor variation on check-in [1685610ef8e0dc] which (hopefully) makes the
logic a little easier to follow.  Also disallows the use of the double-quoted
string hack in the query expression used for VACUUM INTO, which is not
strictly required, but moves us toward the goal of disallowing the double-quoted
string hack everywhere.

FossilOrigin-Name: 3e1b55f3ab85710ed81574904718205c7370b5f0b5a41029e961486d2e3f37c7
2019-05-20 18:35:49 +00:00
dan
0d92571d65 Disallow string constants enclosed in double-quotes within new CREATE TABLE and CREATE INDEX statements. It is still possible to enclose column names in double-quotes, and existing database schemas that use double-quotes for strings can still be loaded. This addresses ticket [9b78184b].
FossilOrigin-Name: 1685610ef8e0dc9218b02461ceab14dc6114f4f5ef7fcda0da395094aff443e1
2019-05-20 17:14:25 +00:00
dan
8ac02a94ab Update the sqlite3ExprCompare() routine so that it does not think "? IS NOT TRUE" is the same as "? IS TRUE". Fix for [d3e7f2ba5b3].
FossilOrigin-Name: 99eba69b3a64741c69d167bf7a05dbe138c9e7faecc54a1b8d8220cb23902830
2019-05-20 10:36:15 +00:00
dan
7ac0e562a3 Fix an assert() failure that could occur in a join query if the RHS of an IN() operator is a list containing correlated expressions. This problem was introduced by checkin [e130319317e7611938] which was part of the fix for ticket [787fa716be3a7f650c] - so this commit is part of that ticket's fix too.
FossilOrigin-Name: 778b1224a318d0137c7dab8361128f593506d3677267898119b934b4d66dfe38
2019-05-18 21:22:25 +00:00
dan
4db4b5b4fe Avoid including the comment in the output of "PRAGMA table_info" in situations where there is a comment following a DEFAULT value within a CREATE TABLE statement.
FossilOrigin-Name: d91095ba7130e974f0c95334760c679a31479b07a3d458e15994a24eee474752
2019-05-18 19:49:08 +00:00
drh
6c35b3065c Disable PRAGMA journal_mode=OFF when SQLITE_DBCONFIG_DEFENSIVE is turned on.
Ticket [f4ec250930342e0c].

FossilOrigin-Name: a0f5eb5c79cc33b7224f3421d2baa02a2a19eb9d6eaa8117dda4a1878b229cb5
2019-05-17 20:37:17 +00:00
dan
be81262400 Always store a REAL value in a column with REAL affinity if the integer equivalent would require 8 bytes of storage. Fix for [3c27b97e3].
FossilOrigin-Name: 14c00b1016ba53ab2dc177c59a27b6b9209202973685f0f274112d296ba7dfcb
2019-05-17 15:59:11 +00:00
drh
829d4253ff Add test cases to test/fuzzdata7.db for (harmless) dbfuzz2 finds.
FossilOrigin-Name: 1eb2a628e4bfae51fea43e8f40fedfe23f2118024d9cce35828c3cbe92a9b392
2019-05-16 20:40:08 +00:00
drh
5c2f2206b6 Initialize the 18-byte overrun area on the buffer used to reconstruct
overflow btree cells during a btree search, to avoid a harmless
jump-depends-on-uninit-values warning.

FossilOrigin-Name: 4b05caeb1b9767ba58cb4261ecc22cdd495216b3258d45f2165cdbd3ea079495
2019-05-16 20:36:07 +00:00
dan
0971ef45ab Fix an assert() in the OP_Delete opcode that could fail with a corrupt database.
FossilOrigin-Name: 915388ab39ba3ca8681cd2613b91314aa965967f23a5bface90f54a3d6423300
2019-05-16 20:13:32 +00:00
dan
36c9301816 Add new test file fts5corrupt4.test.
FossilOrigin-Name: 5dfc4fe98a4821cbdbfd7dfddf221b00251b2a26bf58767a3956b64e9a4e92da
2019-05-16 16:44:47 +00:00
drh
e72d1a8682 Fix a harmless use-of-initialized-value fault in the assert() logic added
by check-in [d612fb7873cf59d]

FossilOrigin-Name: 3dac90728a6a1962da478afe751582ddf8b6d4666548a805564817b21e07a246
2019-05-16 11:47:16 +00:00
mistachkin
3196abb7cb Fix harmless compiler warning in the session extension.
FossilOrigin-Name: dff823ca8b5ca4a5611407b0231f89b2e8c981f50e85e361e76d3e4973cea8ca
2019-05-16 03:47:38 +00:00
drh
df82afc04e Make sure the OP_Concat opcode always correctly zero-terminates a UTF16
string, even if the input strings are ill-formed.  This is a followup to
check-in [3a16ddf91f0c9c516a7] that fixes a case the previous check-in missed.
Also add assert()s to prove correct zero termination.

FossilOrigin-Name: d612fb7873cf59dfda18cabe45f674c37aa78a4587de3378b1840c99465a0269
2019-05-16 01:22:21 +00:00
drh
73c53b39c9 Fix the count-of-view optimization so that it is (correctly) disabled for
a query that includes a WHERE clause or a GROUP BY clause.

FossilOrigin-Name: 05897ca48a40c6771ff83ba8ecc3a5c60dafddf58651c222dd8cf89b9fc7b077
2019-05-15 18:42:15 +00:00
drh
58eaf76355 Simplify the "Verifying Code Authenticity" section of the README.md file.
No code changes.

FossilOrigin-Name: adebffc18e6165672947a6bda5ca23ea7723cca7ab8da4feb81fca8f83e4fcaf
2019-05-15 10:16:34 +00:00
dan
a40cb96a4c Fix a problem with the fix for [9cf6c9bb51] (commit [658b84d7]) that could cause a cursor to be left in an invalid state following a (rowid < text-value) search.
FossilOrigin-Name: bc7d2c1656396bb4f5f1f814e60dbf816cc91c5a521b54ad593cd3da0fe8dcb4
2019-05-14 20:25:22 +00:00
drh
9252966b3c New test cases in test/fuzzdata8.db.
FossilOrigin-Name: 228e1087c0602470e450586499de5a3e87e266c688bc828f20e3bad2fdc65ff1
2019-05-14 19:20:52 +00:00
dan
2a71b17f2f Fix a problem with corrupt db handling in the fts5_vocab module.
FossilOrigin-Name: 456ced57774a92acff23cad975b78ff0e5cbbf5204ea48599fe1761a018a92e4
2019-05-14 18:33:58 +00:00
dan
c12655df87 Fix an assert() and potential buffer overrun in fts5 that could occur if the database was corrupt.
FossilOrigin-Name: 8be8bd0d562e571b73a93f4ed18258ebd114bbab67ee3cdcd66a4c8f2987f8dc
2019-05-14 11:33:09 +00:00
drh
bf9ff256fe Disable index seek optimizations on REINDEX when the order of primary keys
in the index differs from the main table.
Fix for ticket [bba7b69f9849b5bf11b4].

FossilOrigin-Name: f7aadfab3bb8eb8eb2cd62dc8a6823538387b3329f1efc23ef75482488109478
2019-05-14 00:43:13 +00:00
dan
d6712f3638 Fix an assert() failure in fts5 that could occur when processing a corrupt database.
FossilOrigin-Name: f158c048be1dc7c80d38787a20495caa55b86416967efd57f4888548d42b4819
2019-05-13 11:52:19 +00:00
drh
c51cf8642f A new implementation for the sqlite3ExprImpliesExpr() theorem prover that
does a better job of answering TRUE to "(NOT A) OR B" when B is a NOT NULL
expression.

FossilOrigin-Name: b3413197f57711f04102d8cc6ff1e8ddbe0f5f2bcb6e1989cf314fa97f0ff7f1
2019-05-11 19:36:03 +00:00
dan
c6824c8d6c When considering partial indexes, do not assume that a "CASE x ..." expression implies "x IS NOT NULL".
FossilOrigin-Name: 1b24303220b7b4f59520176a0150fc619c668865450b4fdaa9ce4113a56e9687
2019-05-11 16:14:42 +00:00
dan
8f2b1e4c90 Do not assume that "x IS NOT ?" implies "x NOT NULL" when considering partial indexes. Fix for ticket [8025674847].
FossilOrigin-Name: 0ba6d709b50d92db1542f2ff30535a80184b00dadf759d51e5cae7a6e37b1764
2019-05-11 13:04:33 +00:00
dan
90255b8149 Add tests for the RBU module.
FossilOrigin-Name: a194e53670e25a48c2bb51b54755abff88ed6ae2596c5858fb4aac16cb452bdf
2019-05-10 20:44:10 +00:00
drh
2240bb88f8 Fix harmless compiler warnings.
FossilOrigin-Name: 956ca2a452aa3707bca553007a7ef221af3d4f6b0af747d17070926e000f2362
2019-05-10 17:54:58 +00:00
drh
9546c76656 Fix harmless compiler warnings in the CLI.
FossilOrigin-Name: 2846bc0429c0956473bfe99dde135f2c206720f0be4c2800118b280e446ce325
2019-05-10 17:50:33 +00:00
mistachkin
d9bc6e8973 Fix some harmless compiler warnings.
FossilOrigin-Name: ca068d82387fc3cda9d2050cedb4f9c61b6d9dc54f89015b4b2ee492243ed5c9
2019-05-10 16:16:19 +00:00
drh
4142265645 Ensure that the BtShared.nPage value is reset correctly on a SAVEPOINT
ROLLBACK.

FossilOrigin-Name: e6d5fee8cdbdce8515957e8288e4d1e7b06f417fd3f9deeeb636fbf5b995af51
2019-05-10 14:34:18 +00:00
dan
08f6de7f31 Treat integer values in window definition ORDER BY clauses as constants, not as references to another expression.
FossilOrigin-Name: 7e4809eadfe99ebfd797a7c63501421021a720bbeed9fba81bebf630c58bb791
2019-05-10 14:26:32 +00:00
drh
2ce9b6bcd5 Improved comments and extra assert() statements on the OP_Savepoint opcode,
just to make the code a little easier to read and reason about.

FossilOrigin-Name: e80b2d9fcbc82ae5dc8a1fc13196f9a30bdb504eb5a5c131d136a78bbd5bbe7b
2019-05-10 14:03:07 +00:00
drh
7e6dc5d908 Fix the previous check-in [db9acef14d492121] so that the amalgamation build
works for systems for which lack HAVE_ISNAN.

FossilOrigin-Name: 3cc55e09e6c1de2059d97bdddf2fdfbdcc62c584b513f56faf9d3a39ef80cddd
2019-05-10 12:14:51 +00:00
drh
05d7bfd0bb Fix the round() SQL function so that it handles infinities correctly.
FossilOrigin-Name: db9acef14d49212108c8082cc15a9b9b4a56b8afe4fe1104ddf62783739c1fbe
2019-05-10 12:06:47 +00:00
dan
5985dcbf5e Fix another small buffer overread in sqlite_dbdata triggered by a corrupt database page.
FossilOrigin-Name: 1dfc95b8673b0e8c9ef5040c2fa0fbe9846e430d104e9b83f3f1f3ad63446380
2019-05-09 18:37:37 +00:00
dan
39e04f83b9 Fix a problem in the ".recover" command allowing a circular loop of b-tree pages in a database file to cause an infinite loop.
FossilOrigin-Name: 8d2a062eb8a3e6fdc6a61b571c8da0070382bf208c53e797151eac8679c975a1
2019-05-09 18:33:32 +00:00
drh
0a0536ab0f Make the ".schema" command in the CLI resistant to corrupt database files.
FossilOrigin-Name: f22c7e229ea4626c5268d61de3964521cf6a2735290cbd1518d68731ba6cca90
2019-05-09 18:13:30 +00:00
dan
4d2175613f Fix a crash in the sqlite_dbdata module that could occur if a pointer within an overflow chain in a corrupt database pointed past the end of the db.
FossilOrigin-Name: 3eae4e301e3e4bcf14e96066f77be1434c5d4b3daadb10153cd36382589ac128
2019-05-09 17:54:27 +00:00
drh
6bab6f2b4d Disable the optimization where a REAL value with no fractional part
is stored as an INTEGER when the integer uses as much space as the real
value it proposes to stand in for (8 bytes).  This avoids corner cases
of comparing integers against real values that are beyond the resolution
of an IEEE 754 double.  Fix for ticket [6c1d3febc00b22d457c78c2]

FossilOrigin-Name: 9b0915272f4d4052aa31e9297424a7db9a0234b676e8e2a44c3f2dc54236705a
2019-05-09 17:10:30 +00:00
dan
f6099e9b40 Avoid long delays that can occur when ".recover"ing data from a database with a corrupt freelist.
FossilOrigin-Name: 20f06bf2e659212a68dcf138e444da7bd4220548ec15a97cfd7eb82e028b3630
2019-05-09 16:57:39 +00:00
drh
5ad1251a60 Improved debugging output from the OP_MakeRecord opcode.
FossilOrigin-Name: ac790729d9c8f8612936bab56dca6061408007bc2150ac8c7089132403d7f885
2019-05-09 16:22:51 +00:00
dan
9c34bc0ad5 Fix another corruption related buffer overread in the sqlite_dbdata module.
FossilOrigin-Name: 5cd728fb6b3a70f795306d4d6e12151a4de327f801733a8558139e3cd76fe66a
2019-05-09 15:51:27 +00:00
dan
e216ae0a3e Fix further buffer overreads triggered by passing corrupt records to the sqlite_dbdata module.
FossilOrigin-Name: dbc6a9f7f67256dea96d3245e7bec145ba65d64adf322e18f1f3ac9556b4e0b6
2019-05-09 15:07:46 +00:00
dan
9877965f56 Have ".recover" handle cases where the sqlite_master table contains malformed SQL statements.
FossilOrigin-Name: e736da9c18fad138c5502d354c3553373cba15358b69e44b257f60def59422e2
2019-05-09 14:15:19 +00:00
dan
13b876773c Fix a problem with running the ".recover" command on a database that is zero pages in size.
FossilOrigin-Name: 47fa65343e46c7782a173174952c637c5621e16229ece258dc7e7a556683ca0c
2019-05-09 11:45:21 +00:00
dan
b3e3a5bb57 Avoid reading outside a record buffer when extracting an SQL value in the sqlite_dbdata virtual table code.
FossilOrigin-Name: d99bb0c11d62f629bf59da037827af73a9b814e65815006e0cbca1bc41f42e25
2019-05-09 11:34:31 +00:00
dan
eb4a61a30c Merge accidental fork in trunk.
FossilOrigin-Name: ec9373031d76b34163a45d0ed05e43c0c9d585c8d47aa255f670340673bc7875
2019-05-09 11:21:32 +00:00
dan
873b019826 Fix a problem in the new code introduced by [658b84d7] causing corruption and other errors to be ignored.
FossilOrigin-Name: 7ccf2e7d413adb109c61456a5f46e87d38884801dbaab93297a17e3050014b59
2019-05-09 11:19:27 +00:00
drh
68feae52a9 Improved error handling for the ".open --hexdb" command of the CLI.
FossilOrigin-Name: 4fa831d5cd5861f6a0a8f08a738b2d4d371fb2a788178ce86482c5bba761f9de
2019-05-09 11:18:41 +00:00
drh
eb265343a9 Ensure that the sqlite3BtreeLast() interface initializes the *pRes return
to zero if the cursor is already sitting on the last entry of the table.

FossilOrigin-Name: ebe4845cd0ffb96b30be3c69eb399d58e93149886bc2fa60a7ebd7b4fbe447a4
2019-05-08 23:55:04 +00:00
drh
6f7f5d95f8 This is part of the previous check-in that didn't get committed for some
reason - probably because I failed to press the "Save" button on the text
editor.

FossilOrigin-Name: 51d32173ff1f610b5d75a50f20fa1e0e4e22046299869e3b82e0bb446dba890c
2019-05-08 23:53:50 +00:00
dan
ad5536fca1 Add another test case to cover a previously uncovered branch in the RBU module.
FossilOrigin-Name: 30392985612c51d4583a905f8fe766f08cd31b86d0e30a977adc6a6705649e00
2019-05-08 21:14:48 +00:00
drh
97afa309d7 Fix another pattern for which the LIKE optimization does not work for a
non-TEXT affinity.  Case found by Manuel Rigger.

FossilOrigin-Name: 740201107ae802c12b678e388ea524db01ad0eb70601c78490ad63eae0fe6cf1
2019-05-08 19:55:24 +00:00
drh
ea5c040f87 Simplification to the logic underlying PRAGMA case_sensitive_like.
FossilOrigin-Name: ef0015fde4c87e992ffd3d7dea8586951bdd65ff98d30d436b126b85b1cc9c74
2019-05-08 19:32:33 +00:00
drh
9e9374b2e2 Avoid an excess register allocation in UPDATE, when possible. This improves
speed (slightly) and reduces the code footprint.

FossilOrigin-Name: 8658574e3f435f03a87c04f398bd05078ebc53ecb4a477d3b24902d701d935c4
2019-05-08 19:06:59 +00:00
dan
42e84ae1ab Add tests to improve code coverage of the RBU module.
FossilOrigin-Name: ecb56b75a0e66462acdcce285b93f9fc56944c42902d886d6bada419059519a9
2019-05-08 18:49:51 +00:00
drh
08652b5ea0 Provide the SQLITE_OMIT_CASE_SENSITIVE_LIKE_PRAGMA compile-time option to
omit the case_sensitive_like pragma.  This change, in combination with
documentation changes, is the current solution to ticket
[a340eef47b0cad5].

FossilOrigin-Name: eabe7f2d4ff0e0dd868dcab7ec1d4a9168a25f80d3a52f0eeea2f90bd33782f2
2019-05-08 17:27:18 +00:00
dan
a7be6f355c Fix VDBE opcodes OP_SeekLT and OP_SeekLE so that they work on intkey tables with non-numeric text values.
FossilOrigin-Name: 658b84d7f4a0886591c5aab30ed9e31c4a0f56db303eb863f24833ca37085d14
2019-05-08 11:52:13 +00:00
dan
9edd8c11ab Fix VDBE opcodes OP_SeekLT and OP_SeekLE so that they work on intkey tables with non-numeric text values.
FossilOrigin-Name: a870c196d78d8b72c7353fa0015e96b2abd4be154541d76328e3a4f9e5da5d04
2019-05-08 11:42:49 +00:00
drh
291508f62b Remove an ALWAYS() that was previously added by check-in [a0819086] but
which turns out can sometimes be false.

FossilOrigin-Name: ad8fc5d8b440c49df95328df0408be699dde5a1dbd195b3f1f32e5f765578032
2019-05-08 04:33:17 +00:00
drh
d2cfbea2a4 Remove a NEVER() that was added in the previous check-in because it is in fact
reachable.

FossilOrigin-Name: 74eba2558a81f9e790d95a12a0c5379d4f80b43c8698ef9d6a31ff8d160a53d8
2019-05-08 03:34:53 +00:00
drh
dfcecdfea8 Earlier detections of errors in the byte-offset-to-cell-content integer at
offset 5 in the header of a btree page.

FossilOrigin-Name: a0819086a521fb0ca4ffd12f959b168a89ea2e30a2844bbbd39831b2b9ecf29b
2019-05-08 00:17:45 +00:00
drh
2c45b67711 Generate all records for INSERT or UPDATE prior to running foreign key
constraint checks, since the FK checks might modify the datatype of registers
used to generate the records.  Fix for ticket [e63cbcfd3378afe6980d6].

FossilOrigin-Name: 3c75605b4652ae88659465d832953ac9d467369f9cb417f73b3d8599ec60b18b
2019-05-07 20:06:41 +00:00
dan
f116ad8527 Do not commit an "OR FAIL" statement that causes foriegn key constraint violations.
FossilOrigin-Name: 659c551dcc374a0d349ba9419f692e3363839e11d791a17cc35fa1854a674a51
2019-05-07 19:44:11 +00:00
dan
244edd01d3 Add test cases for the fix on this branch.
FossilOrigin-Name: 2e31abe0ae5937a8ce10179e0ae045ee4c5ed8b7e2622ab41243226c6d3f5425
2019-05-07 19:21:58 +00:00
drh
a7c3b93fa6 On an INSERT or UPDATE, generate the new table record prior to running
foreign key checks, in case the foreign key checks changes datatypes on
the registers holding column values.  Proposed fix for ticket
[e63cbcfd3378afe6980d626].

FossilOrigin-Name: 3f1c8051648a341db4dffad66d3b1f9980d8a2b314cb0ce879cb2a10d1779b84
2019-05-07 19:13:42 +00:00
drh
dd2d9a3d5a Strive to prevent harmless compiler warnings in GCC 4.8.5.
FossilOrigin-Name: 8b6691f619ed9a56f6aecbd878ebb447c40984f8767508b248494fd9ec68fbaa
2019-05-07 17:47:43 +00:00
dan
f4f86f3fca Optimize the restarting of an RBU vacuum.
FossilOrigin-Name: 82062351a62f4ccc438a2b47a22ee581bd030dec952fecd610f360a25002a5ea
2019-05-07 16:37:37 +00:00
dan
126537e1dc Remove some redundant code from sqlite3rbu.c. Add test cases for RBU vacuum.
FossilOrigin-Name: 7b051698d8a763d9db190fd662931266d24a4982f34f100a28641934c222e37b
2019-05-07 16:28:50 +00:00
dan
57c4514720 Optimize further cases of restarting an RBU vacuum.
FossilOrigin-Name: 6b3261bfa1d762aa29a57244a30cf5e35655f1fe9c30ee682c186dec29d7a2c2
2019-05-06 20:40:23 +00:00
dan
f9b0c45161 Fix a problem with renaming an INTEGER PRIMARY KEY column of a WITHOUT ROWID table using ALTER TABLE.
FossilOrigin-Name: 91f701d39852ef1ddb29d1527d1520867c5efea110333315c55d8b08084384e7
2019-05-06 16:15:28 +00:00
dan
c245855702 Optimize some cases of restarting an RBU vacuum.
FossilOrigin-Name: cdc09867ed6522026ae7bfac1f59cd79b60fba6d07d49b99b030a501a7059ee4
2019-05-04 20:04:42 +00:00
drh
664d6d139e Fix the NOT NULL logic in the theorem prover that determines when a partial
index can be used.  Ticket [5c6955204c392ae763a95].

FossilOrigin-Name: c2e439bccc40825e211bfa9a88e6a251ff066ca7453d4e7cb5eab56ce7332635
2019-05-04 17:32:07 +00:00
mistachkin
bc8b231098 Fix harmless compiler warning seen with MSVC.
FossilOrigin-Name: 5862b83eb36b93016d37e5b86ebb183d891bb553901facab1e5d83e114a38ec3
2019-05-04 03:56:47 +00:00
drh
b1d93be142 In the sqlite3_value or Mem object, make the MEM_IntReal type completely
independent from MEM_Int and MEM_Real. This helps avoid problems when
inserting non-float values into a "REAL" column.

FossilOrigin-Name: 5a8a23ee5f60a31dbd167a0966d1ab3d0f1c07df2251906cb73f23d1f5466b46
2019-05-04 01:41:18 +00:00
drh
3242c69c91 New testcase macros to ensure that MEM_IntReal is fully tested.
FossilOrigin-Name: 8b8ef445ccccc148af2cda5975986af0d134352fe16283f65d0f8a91c9ffa932
2019-05-04 01:29:13 +00:00
drh
0c8f40389e Add the SQLITE_TESTCTRL_RESULT_INTREAL test-control and use it to create
the intreal() SQL function in testfixture.  Write a few simple tests to
prove this all works.  TH3 will hold most of the INTREAL tests, probably.

FossilOrigin-Name: c9838731325e0ca73bd8784c10c74ae043fed7861e6de269fd90e29fa4a19955
2019-05-03 21:17:28 +00:00
drh
30d3b0ceb5 Ensure that UTF16 strings are properly zero-terminated before returning them
in an sqlite3_value_text16() request, even if the string is invalid UTF16
because it was formed from an arbitrary and/or odd-length BLOB.

FossilOrigin-Name: 3a16ddf91f0c9c516a7fc2a9d4a4f69a8326f9b8ea66421e9ef1a2d663687b70
2019-05-03 19:34:41 +00:00
dan
a51297200f Fix a memory-leak/segfault caused by using OP_OpenDup and OP_OpenEphemeral on the same VM cursor.
FossilOrigin-Name: a9b90aa12eecdd9f2a8b2d23da8b7cac43d8b1789f5cefa3f4e939d9f2b59269
2019-05-03 18:50:24 +00:00
dan
ac4085bc2c Fix a problem where self-joins on views that are aggregate queries may return the wrong result.
FossilOrigin-Name: 74ef97bf51dd531a277cf22fa4d42043d93799d5a5bd550812648834460fe0b7
2019-05-03 17:19:10 +00:00
drh
f2566c4132 Improved comments on the elements of the array constant used to implement
the sqlite3_value_type() interface.

FossilOrigin-Name: f73a7de7a53f6aa6517221550a9c9882893206edfd7433e80e5fc0f441db9fc4
2019-05-03 17:08:16 +00:00
drh
5bf4644f41 Fix the ".open --hexdb" command in the CLI so that it works even with
terminal input.

FossilOrigin-Name: 9b5d943426c9273162ecb4c561eb3b25e843318dd438239c882c9db50f788454
2019-05-03 02:41:36 +00:00
drh
169f077e07 Make MEM_IntReal a completely independent type, meaning a floating point
value stored as an integer.  This fixes a problem with arithmetic within
arguments to string functions on indexes of expressions.  But it is a big
change and needs lots of new testcase() macros for MC/DC and so it is
initially put on this branch.

FossilOrigin-Name: dba836e31cb29d339b4520acb06188a892a52e45c50aba9742966b01108e251a
2019-05-02 21:36:26 +00:00
drh
de7109e61b Ensure that the typeof() function always returns SQLITE_FLOAT for floating
point values even when the value is stored as an integer to save space.

FossilOrigin-Name: 48889530a9de22fee536edfd1627be62396ed18d842d5fd6d91e010b4337be95
2019-05-02 17:45:52 +00:00
dan
ee253f7881 Add options to wapptest.tcl similar to those supported by releasetest.tcl. Also add the -noui switch, for running without wapp altogether.
FossilOrigin-Name: 005a169406ccea6e3cc42271620870d985e8bada1ad49a63656003db4911cb51
2019-05-02 17:06:01 +00:00
drh
e12ca5abf6 Earlier detection of a database corruption case in balance_nonroot(), to
prevent a possible use of an uninitialized variable.

FossilOrigin-Name: c509d8a8aebe0da4847e95cf737c21313a665de9a540da2db57b8ed22f98a402
2019-05-02 15:56:39 +00:00
drh
cf1747b782 The collating sequence of the column must be TEXT if the LIKE or GLOB pattern
starts with a "+" sign.  This is another case of ticket
[c94369cae9b561b1f996d005] that was discovered by Manuel Rigger.

FossilOrigin-Name: b043a54c3de54b286c4eae564eab6b99118a410d99bdb63480faba3123d2ca11
2019-05-02 01:41:53 +00:00
drh
01325a3f75 Fix an issue (discovered by OSSFuzz) in the enhanced OP_Concat operator
from check-in [713caa382cf7dd] earlier today.

FossilOrigin-Name: 3e897702f8f789fe5119b9042fb93eca3fbfcc44564fbfa66c65628725b1157d
2019-05-02 00:52:50 +00:00
drh
7d0a3fd340 Add a test case for ticket [ae0f637bddc5290b44669e066a].
FossilOrigin-Name: ece481695fc3c959c3eba0fb485cdda43a10b06d17259b0121e15bfc5e8e8b9f
2019-05-01 19:01:27 +00:00
drh
83a1dafb03 When values have real affinity and are converted into strings for CHECK
constraints or index expressions, do the conversions into a real-number format
even if the values are stored as integers for efficiency.
This appears to fix ticket [ae0f637bddc5290b446].

FossilOrigin-Name: 5997d075665faca6b70fa647e877ebc84c473b32887b96235865d59ce80247f8
2019-05-01 18:59:33 +00:00
dan
f78408c775 Fix an incompatibility with -DSQLITE_OMIT_LOAD_EXTENSION=1 in dbdata.test.
FossilOrigin-Name: a77cd85b1a8b86e71b511f05f8c67faa046d24a48684139d2f64e51249203411
2019-05-01 17:36:56 +00:00
dan
0de0ab8207 Fix a case in wapptest.tcl where a failed test might report 0 errors.
FossilOrigin-Name: 2be1ed70df605663822d1afdde757f426ccf2ee38add8dc6b6bb4fc4d90a31dc
2019-05-01 17:32:36 +00:00
drh
8a7e11fb78 Avoid unwelcomed side effects on the input operands in the OP_Concat
operator.  Fix for ticket [3be1295b264be2fac49b681]

FossilOrigin-Name: 713caa382cf7ddef872e510a76a5fca40be1a8d8876ce2f91b632bb0810a6630
2019-05-01 15:32:40 +00:00
dan
c97001fd55 Update wapptest.tcl so that it deletes extra files if the "Keep files:" checkbox is clear. Set it by default.
FossilOrigin-Name: 09623cc4cc82e3c123d1fd5d88b2f4b50ec5f2cc7e579a7203258bf0c246a74f
2019-05-01 15:25:38 +00:00
drh
6fcc1ecc99 In "PRAGMA vdbe_trace" output, show the results of OP_Affinity opcodes.
FossilOrigin-Name: 56604bb60a8ebac8d2854628d1b052d594d7effe14be8333977995dc07b65114
2019-05-01 14:41:47 +00:00
dan
a3e086d803 Fix an incompatibility with auto-vacuum mode in new test script recover.test.
FossilOrigin-Name: 36dd5b0804797a35d0dc596b6ca4f71813a155c5a470237ab6e3d1bcd9ccc6be
2019-05-01 08:48:44 +00:00
dan
919458923d Update wapptest.tcl to use a simpler slave script. And to leave scripts wapptest_configure.sh and wapptest_make.sh in each test directory.
FossilOrigin-Name: 07e527d781838412b2a434e64baaa49cbf7410a51c7393f54adc7b8eaffd5229
2019-04-30 20:43:10 +00:00
dan
c589acbc50 Fix a problem allowing a Table object to be deleted from within a call to the xDestroy method of the associated virtual table, causing a use-after-free error.
FossilOrigin-Name: 1dbbb0101e8213b92b9a4c78c0fd2f9d0240a8ea3b40dff1033d1b8d71fb04ef
2019-04-30 15:36:32 +00:00
drh
f135cb7d7f Fix an error message in the Lemon parser generator.
FossilOrigin-Name: b6d7d42b7426622a26b67809cd1f21285fea120aa1897377b9946840463b41f1
2019-04-30 14:26:31 +00:00
drh
cf83323936 Small performance increase and size reduction in the implementation of the
LIKE and GLOB operators.

FossilOrigin-Name: f97626f921dafe596b615a168ef31987f4a1c0b52956443e1a5c1148b49cab74
2019-04-30 11:54:36 +00:00
drh
b70b0df8eb Slightly smaller and faster implementation of the OP_MakeRecord opcode.
FossilOrigin-Name: 3bdce7ef1a6bb03affe978243fec603d5a55c071aa6d87c469a3c199d23f3b5e
2019-04-30 01:08:42 +00:00
drh
3af1b60e3a Changes to oserror.test so that it works even on systems that allow
an unusually large number of file descriptors.

FossilOrigin-Name: a27b0b880d76c6838c0365f66bcd69b1b49b7594470993b608f4e490cbdc4882
2019-04-29 16:44:11 +00:00
drh
4baa75b32f Do not de-duplicate columns index columns associated with a WITHOUT ROWID table
if the columns have different collating sequences.  This is the fix for
ticket [3182d3879020ef3b2].  There is one test case added, but most of the
tests are done in TH3.

FossilOrigin-Name: 1b1dd4d48cd79a585e1fa7ee79128e9f2a9ee9846339dc56bbd67b75112dcad5
2019-04-29 13:48:45 +00:00
drh
c19b63c9a3 Improved header comment and precondition checking for the new isDupColumn()
function.

FossilOrigin-Name: 740d5ff6cc9bf7b151dfb8b27409e5923cfb2789b5398fe13d89563aff8ffc07
2019-04-29 13:30:16 +00:00
dan
51f5ffa1a4 Fix a buffer overwrite in shell.c.in (part of the new .recover code).
FossilOrigin-Name: 92facbc73a940d2844ac88fafd2d2dadb10886fb0b7c53e23f346d18fa6d6327
2019-04-29 11:41:46 +00:00
dan
490e6f2506 Fix a stack overflow that could occur when renaming a table that has a trigger containing a window function invocation that itself contains a specific syntax error.
FossilOrigin-Name: c621fc668c6538f9f5bdac204f012c64998679a61aa8e224d212503820224c09
2019-04-29 11:27:58 +00:00
drh
f78d0f426c Take collating sequence into account when removing redundant columns from
indexes on WITHOUT ROWID tables.  This is the first proof-of-concept fix
for ticket [3182d3879020ef3]. More testing needed.

FossilOrigin-Name: b34fa5bff40d3d364bd8c80e7de55c606ef3caac47b14b5265ebcb38857eb85e
2019-04-28 19:27:02 +00:00
dan
73c0d272a9 Add the ".recover" command to the shell tool. For recovering as much data as possible from corrupt databases.
FossilOrigin-Name: 50fe48458942fa7a6bcc76316c6321f95b23dc34f2f8e0a483826483b2fb16f6
2019-04-27 20:30:19 +00:00
drh
6c59136498 Fix a minor typo in a comment. No changes to code.
FossilOrigin-Name: 95209072176ff21a91e96d5bd014b35ef100da2b0b93958baf6df4294a8daa85
2019-04-27 20:16:42 +00:00
dan
1b16216f9e Fix building the shell with SQLITE_OMIT_VIRTUAL_TABLE. And without SQLITE_ENABLE_DBPAGE_VTAB.
FossilOrigin-Name: 425d708c3908fe74f69b62e6dd1722a0018088977e12f14b312dad1df0fbb804
2019-04-27 20:15:15 +00:00
dan
0aa01ee42c Add comments and fix formatting issues in new code in shell.c.in.
FossilOrigin-Name: b91d819bd16de43fc99e379da0ba9c915b0c5afc68e804a50c3c1662c1f9a740
2019-04-27 19:36:49 +00:00
dan
42ebb01e9f Add the "--lost-and-found" option to the ".recover" command. For setting the name of the orphaned rows table.
FossilOrigin-Name: 67bb88e24c74d02ae0c4ac6ff2f873f6b0035ccefe5cccfc71c5686cbc76b4c3
2019-04-27 18:47:03 +00:00
dan
f57bea31ba Fix a problem in the .recover command with recovering WITHOUT ROWID tables where the PK columns are not the leftmost in the CREATE TABLE statement.
FossilOrigin-Name: 91df4b8e0386105d01614921e8410994b621404a3d46ec4af8687b8743c52d52
2019-04-27 15:35:45 +00:00
dan
98c5ad309f Have .recover store all orphaned rows in a single table, with extra columns to indicate the orphaned page and sub-tree they were discovered within.
FossilOrigin-Name: 7221f6e33ed6a5a96ec61e25f2a1f70b84aae66e503d897eb7b7ff1aec42355d
2019-04-26 21:11:37 +00:00
dan
db5ba5c385 Omit tests of the LIKE optimization in like3.test when SQLITE_ENABLE_ICU is defined.
FossilOrigin-Name: af53c41a127c314c0608f3fd016d3a26896783745e46cd180976a188400cdb75
2019-04-26 17:08:50 +00:00
dan
ca42438261 Fix another problem with database freelist handling in the ".recover" command.
FossilOrigin-Name: bee2652ac26370e612a8c81dd7554befc2d523442a2fbbc77dc73479e6a0d7fd
2019-04-26 15:40:27 +00:00
dan
c0b42437ab Fix a locking-page related problem with the ".recover" command.
FossilOrigin-Name: afdae10424f0f3d0f10a4b73e9732aa55c5ee664814d8ca0edd372cfb17c2445
2019-04-26 15:14:53 +00:00
dan
6aa001527c Merge latest trunk changes into this branch.
FossilOrigin-Name: 1da302d85d7ad4ba54f877117a45d667439fd2ef31dc70ea1d54dc1fba196e68
2019-04-25 20:06:34 +00:00
dan
9c014f8b0c Unless the "--freelist-corrupt" option is specified, do not have the .recover command attempt to recover data from pages that are on the database free-list.
FossilOrigin-Name: 8d2f52bb640d6d0f84b18d746043e56f45a73ace93239be1d036701f7f4018fd
2019-04-25 19:23:15 +00:00
dan
b9b71dbfd4 Fix a bug preventing .recover from working on databases where the final page of the db is corrupt.
FossilOrigin-Name: 959bbd11e92cc789973daf20dfcb8a6d8dc724dd603b286cbdd59e5d1fdb2909
2019-04-25 16:20:40 +00:00
dan
efa363b84c Improve the performance of the .recover command.
FossilOrigin-Name: a50768314d10d743a0cc013b434b516f0763e0a6c5b79655d8fefde7de53e869
2019-04-24 20:48:55 +00:00
drh
dbdd93b7e1 New test cases in test/fuzzdata8.db.
FossilOrigin-Name: 7be6222c9ec44596e4eddd906c831eb1272b90fbdf68641d791f216264feb7cf
2019-04-24 17:04:02 +00:00
dan
bebea908b8 Fix another instance in fts3 where a corrupt record can cause a buffer overflow.
FossilOrigin-Name: e1724f1d618cfbcfd1e495d8965a395656cfc1114e1bffd4bc3be0bd5cdb6550
2019-04-24 16:13:52 +00:00
dan
a27cce76bf Fix a problem in fts5 where a corrupt position list could lead to a buffer overwrite.
FossilOrigin-Name: 516ca8945150bdc1363603e234be5f3f4a3861f581d7cc9455da3e87b9974309
2019-04-24 15:57:25 +00:00
dan
04687f9e03 Fix an error in fts3_write.c allowing a corrupt database to cause a crash.
FossilOrigin-Name: 6e4a5f22811bcd1485e27073ec96821d448b91b6d1ff1659cc3772449d19a762
2019-04-24 15:13:02 +00:00
mistachkin
8e7e517b68 Correction to the #if in the previous check-in.
FossilOrigin-Name: 30dc05ac12910d318a737f8d7a0e895e5c42ff4c53472aeebc89f052eac05deb
2019-04-24 04:53:01 +00:00