Commit Graph

20849 Commits

Author SHA1 Message Date
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