Commit Graph

9015 Commits

Author SHA1 Message Date
dan
0433789863 When it is known when preparing a statement that X cannot be NULL, transform the expression (X IS NULL) to integer value 1 instead of 'true'. This is because under some circumstances, "Y IS TRUE" may not be equivalent to "Y IS 1".
FossilOrigin-Name: cc4bb05b3653e9502b95ea6fe0bfb77feebc11285b66e1dde4c7b945928efbf1
2023-03-03 16:25:18 +00:00
drh
dc81902445 Do not use an expression index on a generated column if generated column
has the wrong affinity.  dbsqlfuzz 65f5eb57f8859344d5f1f33e08c77ee12960ed83

FossilOrigin-Name: e95439119ac200cb47d0e277622f41ee7986b364487cd252b485ce5fa030d70f
2023-03-03 15:12:46 +00:00
drh
3f23ce664e When flattening the right operand of a LEFT JOIN
(check-in [41c27bc0ff1d3135]), ensure that the OP_IfNullRow opcode does not
NULL-out a subquery result that was computed within OP_Once.  This fixes
the problem problem reported by
[forum:/forumpost/402f05296d|forum post 402f05296d].

FossilOrigin-Name: 8fe13f7a5e5eb798189acb25a608df7a94c2f5cc83463331a048b779c7890c82
2023-03-02 13:49:50 +00:00
drh
bf90114867 When flattening a view that is the right operand of a LEFT JOIN, using
the optimization of check-in [41c27bc0ff1d3135], always insert the
TK_IF_NULL_ROW expression nodes, even for TK_COLUMN expressions, as
the TK_COLUMN might be a column from an outer query and hence still need
to be NULLed out. This fixes the problem described by
[forum:/forumpost/26387ea7ef|forum post 26387ea7ef].

FossilOrigin-Name: 198b3e33dcfd74c7ba6abcf789ee81dfed464a50ebf15c8edeff349d36789fca
2023-03-01 20:23:46 +00:00
drh
fe37348255 Follow-up to [bbaf1f2eb1e1637b]: Make sure subtypes do not cross a subquery
boundary even if the function that returned the value with a subtype is
buried down inside a larger expression.  This fixes a problem identified
by [forum:/forumpost/37dd14a538|forum post 37dd14a538].

FossilOrigin-Name: e72661eb680ea707a839cb3d5cf6c7ef03706e7b40af1b84760147e59cd61a50
2023-03-01 15:21:53 +00:00
drh
46960e4677 Do not attempt to apply the count-of-view optimization to a CTE.
dbsqlfuzz ef8623915d843b150c159166ee4548c78cc6895a

FossilOrigin-Name: abc3a383636c0346053b5d09d96585f56c64cacb5751673ea3bf339e4955d1cd
2023-03-01 13:54:07 +00:00
drh
f1f4f090c7 Activate SQLITE_DBCONFIG_STMT_SCANSTATUS in fuzzcheck.
FossilOrigin-Name: 4fe1419ac3161ea8735241b04913593170c636cf3e1583756fe94edd396cd38b
2023-02-28 21:23:46 +00:00
drh
0bdee38969 Updates to speedtest1.c and the speed-check.sh test script so that they work
with the new SQLITE_DBCONFIG_STMT_SCANSTATUS control.

FossilOrigin-Name: bd02df052e1ef78b5335915a38f3c5e13c3c04ab82fd251aeb42a440d1d39257
2023-02-28 20:06:30 +00:00
dan
06382de2a3 Change the name of SQLITE_DBCONFIG_STMT_SCANSTATS to SQLITE_DBCONFIG_STMT_SCANSTATUS.
FossilOrigin-Name: a63e4a150b505fc309fac847131009ee9965eb1b798ebcb202ec8b52f9189240
2023-02-28 20:04:01 +00:00
dan
45163fc45e Add an sqlite3_db_config() option - SQLITE_DBCONFIG_STMT_SCANSTATS - for enabling and disabling the collection of sqlite3_stmt_scanstats() statistics in SQLITE_ENABLE_STMT_SCANSTATUS builds. Collection of statistics is disabled by default.
FossilOrigin-Name: 0f5579bef27b84ee855065cfe87703c51e1f9773906a9e0d4e4dafc90bd0e553
2023-02-28 19:39:59 +00:00
drh
4990fc84f1 Only use a Bloom filter on an automatic index if one or more of the key
columns in the index can take on non-TEXT values.

FossilOrigin-Name: 5916705c731604d2e6b51a307cc8d7b67f4c102062bfdfcbc716a2916e0b0d86
2023-02-28 18:06:52 +00:00
drh
a353369f57 In the Bloom filter optimization, hash all strings and blobs into the same
value, because we do not know if two different strings might compare equal
even if they have different byte sequences, due to collating functions.
Formerly, the hash of a string or blob was just its length.  This could
all be improved.  Fix for the issue reported by
[forum:/forumpost/0846211821|forum post 0846211821].

FossilOrigin-Name: 090304b870419acb5b05205a07fc75830b556928149f76a843cda526f77a6fc0
2023-02-28 14:28:54 +00:00
drh
f43ffb30b0 When an automatic index creates a Bloom filter, show that in the
EXPLAIN QUERY PLAN output.

FossilOrigin-Name: d7b2ac1c1a31fa4285cf6df0995db7e7705bb6a1bc94850c14c94cc4e3eb239a
2023-02-28 13:46:01 +00:00
drh
baef8442d3 Further to [46639f682975dac6], the parameters of a table valued function that
is on the left side of a RIGHT JOIN do not need to be in the ON clause.  Add
new test cases and tags to associated test cases with the code.

FossilOrigin-Name: 18ee689de3d1ae43b05ca52e0b62c49442ebf68a88814a7c679e8856250a4b0d
2023-02-27 14:48:54 +00:00
drh
4edbcdd391 In the [/info/7c2d3406000dc8ac|omit-unused-subquery-columns optimization], be
sure to remove the EP_Skip and EP_Unlikely flags from the result set expressions
that get nulled-out.  dbsqlfuzz bf1d3ed6e0e0dd8766027797d43db40c776d2b15.

FossilOrigin-Name: 21aec65e5e2a01e58dd0bb8c8b9b29b8414373b53353fc7ca80a152fdd27566b
2023-02-26 11:36:35 +00:00
drh
acf8905425 Adjust testrunner.tcl to make use of the new number_of_cores TCL command
available in testfixture, and to use no more than half the available cores.

FossilOrigin-Name: e0122d3863ed03e7bb64400d6561cbc824ecb14d228949ffde443069dbb4223a
2023-02-24 13:45:51 +00:00
drh
4b04ced3e0 Fix an incorrect optimization that was attempted as part of
check-in [18de3a8e6b431a07].

FossilOrigin-Name: f32055e8110a2eac6c9e26d1d1e620f0668bcb475d49d309dc549cea05e1e582
2023-02-24 01:08:35 +00:00
drh
4df23a3248 Increased precision of floating-point to decimal conversions when the
floating point value has no fractional part.
[forum:/forumpost/d1387c3979c7f557|Forum post d1387c3979c7f557]

FossilOrigin-Name: 18de3a8e6b431a075143631eafdcf0e1b1a21868b417394c365d46d2feca10b5
2023-02-23 21:18:47 +00:00
drh
af03eb3241 Enable the count-of-view optimization by default.
Enhancement request [eaed8e36ce888f1e].

FossilOrigin-Name: a4aacdd323a854d771c8cb1e2e4cfc4fb66b0020cfed23525733603605f5c63b
2023-02-22 21:47:02 +00:00
drh
95dee6d2e3 Avoid computing the values for unused result-set columns in subqueries.
Performance optimization request [baa5bb76c35a124c].

FossilOrigin-Name: 7c2d3406000dc8ac5a99cc205b036356b67e4b0b94738592ffc5680749696904
2023-02-22 21:11:34 +00:00
drh
bcb3215630 Remove the push-down optimization restriction that was added by
check-in [1ad41840c5e0fa70] because it is no longer needed after
the enhancements to compound query processing in check-in [27655c9353620aa5]
This resolves the performance regression reported by
[forum:/forumpost/bcc4375032|forum post bcc4375032].

FossilOrigin-Name: aa6bd6dff751223e302575c60f335707e4bb820bff716cab3706b564e18ed7ed
2023-02-22 20:42:15 +00:00
drh
1603f7edee Fix stale requirement marks and fix a typo in the documentation for
sqlite3_preupdate_hook().

FossilOrigin-Name: 655991f5d9afdd3281049eb430921046e0ba90eef215020c2fb149adc0d3c4c5
2023-02-18 20:31:26 +00:00
drh
16cdb4b632 Fix a harmless typo in the test case added by [29fc06465efb948f].
FossilOrigin-Name: e0a0bf56f11f32f58705098e76c276deaf90cfa87e110032bdaad10ce9674f61
2023-02-17 22:48:46 +00:00
drh
ab31a5df93 Do not allow the COUNTOFVIEW optimization to run if the count() contains
a FILTER clause.  dbsqlfuzz 4f8e0de6e272bbbb3e1b41cb5aea31e0b47297e3

FossilOrigin-Name: 29fc06465efb948f98d2733bb25ffa1e0662a0189304006b3d0be9fec7dd28c5
2023-02-17 18:27:48 +00:00
drh
e43d101c83 A few simple test cases for the omit-unused-subquery-column optimization.
FossilOrigin-Name: cf8f57c53425d89619ece10edc197d7d28946d3b23fcb4f526330196c76d9cc1
2023-02-16 19:41:39 +00:00
drh
90b7af7715 Do not perform the omit-unused-subquery-columns optimizations on a
subquery that is DISTINCT, as that can lead to incorrect results.

FossilOrigin-Name: cc148503db8ef180bce984328da7e84959afadd6a9613c2d03bc1eafeb95dfad
2023-02-16 15:54:55 +00:00
drh
e3ec00ccb8 Do not compute result columns of subqueries that are never used. Make those
columns NULL instead.  This optimization potentially resolves the enhancement
request described by [/tktview/baa5bb76c35a124c|ticket baa5bb76c35a124c].

FossilOrigin-Name: 5dec3cc0225296a043d17f73126d477d90a604f82b3180628176d8f950adbce8
2023-02-15 17:53:17 +00:00
dan
bdb2ec409a Update testrunner.tcl to run zipvfs test scripts on unix.
FossilOrigin-Name: e6c8e19ab0d6e7526d4596b75a45bb6becaf3c029690f7e75c016eac803c9990
2023-02-14 18:09:40 +00:00
drh
d6ba4252b2 Ignore extra parentheses around a subquery on the RHS of an IN operator,
because that is what PostgreSQL does.

FossilOrigin-Name: ecdeef43b27412b0b0b09e09a62ad3a03836a3fc80f2070268090e7ca8f02712
2023-02-13 19:32:40 +00:00
drh
b4dc263ec5 Do not allow WHERE clause terms to match constant string index terms, which
can happen if DQS_DDL is enabled.  Follow-up to
[44200596aa943963].  dbsqlfuzz 54c9db85ed4af7055f5fd0d50877875c82b11d46.

FossilOrigin-Name: 2d2b91cc0f6fed8cb6f738dc7019047ce0f1e86b5eb8efa997095d08a32cbcb6
2023-02-13 18:42:01 +00:00
dan
0c69938511 Allow vector-IN expressions like "(a, b) IN ( (?,?), (?,?) )" to use an index.
FossilOrigin-Name: 1815b15ddb8785a25b7617aab19e13c2410b9377389c16a85176025b3d9400e8
2023-02-13 16:10:31 +00:00
drh
80e936aef0 Do a better job of detecting when a WHERE clause term might be useful to
an expression index.  Fix for performance regression reported by
[forum:/forumpost/e65800d8cb|forum thread e65800d8cb].

FossilOrigin-Name: 44200596aa943963bc6ca98b5d4fd5b9235d1109d8dfc1a75eeae353b4239142
2023-02-10 21:53:33 +00:00
drh
9a8330b550 New test cases added to fuzzdata8.db.
FossilOrigin-Name: be67bafccd79ba835ed7e287e09852ce83805da0797b164d0c8e44be05d9d28a
2023-02-09 12:47:15 +00:00
drh
601e4d4a0f Back out the 'txn' enhancement to date/time functions. The duration of a
"transaction" is confused and needs to be straightened out prior to moving
forward with this change.

FossilOrigin-Name: 4a145f07322d768a07619bed27e0390d50f3a01d07787b9296234a5ceb6f1218
2023-02-08 20:29:48 +00:00
drh
159cbfe1cb Test cases to show that CURRENT_TIMESTAMP and similar hold the same value
across a transaction.

FossilOrigin-Name: 7b2fa20e31b8a0314b9ccb97bb556898d552505dbc5943f248df3f86c0f4e008
2023-02-08 12:31:47 +00:00
drh
3393ee7ff6 Simplify the code and add test cases.
FossilOrigin-Name: d3bed4caff561e71c396cc869c5b4d9bf216ba203485e738c12ec62741f1aba5
2023-02-07 23:55:59 +00:00
drh
da3d655fd8 Remove the long obsolete "client/server" mode tests.
FossilOrigin-Name: 08e3114caec0633fc54f8febb7f4732b46a1f47508bbca0a6a2bff02591254d5
2023-02-06 15:46:34 +00:00
dan
6896da42c6 Update test scripts speed1.test and speed1p.test so they may be run by testrunner.tcl.
FossilOrigin-Name: e761d4b9c8dcacccc927d23f20fdf779a0ae5304281b5bd6aa998bade56f0a37
2023-02-06 15:46:01 +00:00
drh
634ed64312 Shorten the status line for testrunner.tcl so that it fits on an 80-character
terminal.

FossilOrigin-Name: b760a7307c453d95cf3b302c9867c84a9c899956c16c2ce1ea6cce8f025db425
2023-02-06 14:48:02 +00:00
dan
ee18659f69 Fix a formatting problem in scanstatus2.test introduced by [81c118d9].
FossilOrigin-Name: 928ab40edbf11c02b3f03e660051d9587243002b9220adc77f972c3758c12b19
2023-02-06 13:36:34 +00:00
dan
0bd0843eb1 Add the --fuzztest option to testrunner.tcl. Also, have it print whitespace over the top of the old report line before writing the new.
FossilOrigin-Name: d83ce01fe1f21edcc93ad4c6308026156f235bab75e16e15389e27ad388fb274
2023-02-06 11:43:22 +00:00
dan
2288ecbb9c Fix problems with test scripts preventing them from running with SQLITE_DEFAULT_MEMSTATUS=0 builds. Or builds without SQLITE_ENABLE_STAT4.
FossilOrigin-Name: c0fbc89ed26b6eb361c1a05e2fb0d78d101fe2daf2947bbe5e0e58e0c2a779a2
2023-02-06 11:02:31 +00:00
dan
e734207a79 Fix some test scripts that were failing with SQLITE_OMIT_VIRTUALTABLE builds.
FossilOrigin-Name: 81c118d90b281b30f40b3eeefaeb2c8350aa40080b4fe7de8f21d263986c6acb
2023-02-06 10:47:57 +00:00
drh
072f48e556 Do not use a Bloom filter if any outer loop lacks STAT1 data, since without
STAT1 data, the query planner cannot make an accurate determination of
whether or not a Bloom filter will be useful.  This fixes the problem
reported by [forum:/forumpost/56de336385|forum post 56de336385].

FossilOrigin-Name: e6ab96bd0b9efc51fd703bf7e92b079943ad9a3b92183d434adc11fb7d238afb
2023-02-05 20:29:10 +00:00
drh
e88b209874 In fuzzcheck, only show the description of each database if the -v option
is specified.

FossilOrigin-Name: 6a58179aaffa77a5542ab620ffce6f68135e399de957b1a97113fd2f1dc0c098
2023-02-05 17:09:18 +00:00
drh
fdde4042eb Modify the status line output from testrunner so that each line overwrites
the previous rather than scrolling.

FossilOrigin-Name: ad4d28cd68589a9259069c77c8d375ae49cfd0bcdf3b03d3e84418569e12ebfc
2023-02-05 00:32:32 +00:00
dan
a3d4d7a0ae Avoid running rbu tests under permutation "journaltest", which does not support wal. Fix some other test script problems.
FossilOrigin-Name: 92f018698a87ed32acc31d83f7246dbb7295867bd6a801b7984a16f97a5c7786
2023-02-04 21:25:17 +00:00
dan
b713d501f6 Changes so that wapptest.tcl still works.
FossilOrigin-Name: 7624de3a93e03e9e825b1a283ccde8ad3aa41f93dd5c7f63692620a5177cbda9
2023-02-04 18:58:51 +00:00
dan
0415dd9c56 Update testrunner.tcl usage message.
FossilOrigin-Name: b7c246bc3f462098f6281ee2cd2e4e870b6d6481263d277f04956596a4764558
2023-02-04 18:50:16 +00:00
dan
4e5ff3b820 Add testrunner.tcl "njob" and "status" commands.
FossilOrigin-Name: 3869cd3d306ed68ec6e118aa10b4e835f2bab1294039888d88a30b3cfcf1d7be
2023-02-04 18:47:59 +00:00
dan
bd55d3ddab Fixes for testrunner.tcl on windows.
FossilOrigin-Name: b98e19fc41cb7f89ae9e063b8af414bc01d14833a14de5d646069483ef0127b2
2023-02-03 21:18:58 +00:00
dan
33d3559736 Have testrunner.tcl run various builds as part of the 'release' command.
FossilOrigin-Name: ba2fae30a81e2574f13a7351c9f843b8c2c7d2c93fcd71fb2de98f5b34f3e109
2023-02-03 18:47:00 +00:00
dan
60228cb3d2 Avoid using Tcl command [clock] in testrunner.tcl.
FossilOrigin-Name: b2faf9289f6fbbcd4491e1b063da731b35aeed9ff1fc97f64798e99cac847b4a
2023-02-03 11:32:51 +00:00
dan
e18fdcd35f Do not run test script pendingrace.test as part of the inmemory_journal permutation.
FossilOrigin-Name: 69d934a1bfad86f3f60dab146db539645f5735f1bdb07dfe3a3d88828a03390b
2023-02-02 20:15:42 +00:00
dan
b0c8e2f900 Add configuration data for osx and windows to testrunner_data.tcl
FossilOrigin-Name: e45d34656a110f85671d8b5d33f0d6d807fd64dfef5777fefba22ac6836f0e86
2023-02-02 19:41:43 +00:00
dan
986c22a6d0 Update testrunner.tcl to use a separate process for each test script. And to run some extra tests too.
FossilOrigin-Name: d090948a69a9c4b86693bd3caedba3d7e5883e4b2ad1f2d4bf7ae14c105ddea7
2023-02-01 20:14:59 +00:00
drh
54725efd80 Just because a CTE is used more than once, does not mean it should be
tagged with M10d_Yes and thereby prohibited from participating in the
query flattening optimization.  See
[forum:/forumpost/1d571c02963355ed|forum thread 1d571c02963].

FossilOrigin-Name: 66f29c403d28630bfaea9124bd63ee4a047b1fe4a7e27dc5d10d67d1601b15e0
2023-02-01 15:41:07 +00:00
dan
ca3aabdf53 Fix a race condition during hot-journal rollback that could theoretically cause spurious corruption errors.
FossilOrigin-Name: 20ea53ddf590a9dd19501fabd2bfdb9c10b5eb265cd2995bdb335769c936c763
2023-01-31 20:21:06 +00:00
drh
f7af9ba13c Additional tweaks to the enhancement at [609fbb94b8f01d67] to further reduce
the cost estimate for constructing an automatic index on an ephemeral table,
in order to resolve the performance problem described by
[forum:/forumpost/1d571c0296|forum post 1d571c0296].

FossilOrigin-Name: bf1aae7a8c7f2c74681aa29baa35259d10ce6a1737d2607def6bf27fed592131
2023-01-30 20:44:54 +00:00
dan
20438431c8 Fix a problem causing "PRAGMA quick_check" to return spurious corruption errors for a WITHOUT ROWID for which all columns are either virtual or part of the primary key, and for which the order of the columns in the primary key definition is different from the order in the table.
FossilOrigin-Name: a7530f897127f35a212db6557edbcbbb286cc0e094754c1c1b74ce8dbf724470
2023-01-28 17:37:37 +00:00
dan
54c9250b09 Update sqllimits1.test to account for the fact that if an odd value is specified as the length in bytes of a utf-16 string, it is truncated to the largest smaller even number.
FossilOrigin-Name: 74508470c4caff04638e750cd84073f3137b8a9f72c6fe390a279da7b1c13398
2023-01-28 16:37:30 +00:00
dan
3db12cd7c4 Have some RBU tests run as part of veryquick.test/testrunner.tcl.
FossilOrigin-Name: f51406e3bf92f2b46f13d08fb7c7fe7683feba68b5a8fa18f6f6b8845662deac
2023-01-26 18:16:51 +00:00
dan
a0fe1e7d13 Fix a problem with fts3 auxiliary functions and one or more NEAR expressions ORed together.
FossilOrigin-Name: de4690a10ad4631e7452ccbb05b177a821d9dda387a854d216a6c54c7a189ead
2023-01-25 15:45:45 +00:00
dan
0fa2bbf9e1 Fix another problem with fts3/4 auxiliary functions and NEAR expressions that consist entirely of deferred tokens.
FossilOrigin-Name: a8c91c132f6157b7e3649f57a799984b1d7f8a18fd434515c875617d4195db29
2023-01-25 13:42:55 +00:00
dan
f36fa4e902 Add scalar SQL function unhex().
FossilOrigin-Name: 890e9629a7480138c9c1d3acc2d1e7b3c05e0d156e5c5fba428bc1aeb790fbfb
2023-01-24 20:17:43 +00:00
dan
a50db438eb Update unhex() to allow a second argument, specifying a set of characters that are permitted to appear between pairs of hexadecimal digits.
FossilOrigin-Name: 66c8562690b19f17972589611810e1dccad3a48777acb05208289c1f77076f71
2023-01-24 17:19:47 +00:00
dan
e35d1e1e6a Fix a problem with using fts3 auxiliary functions with expressions like "E AND ...", where E is a NEAR expression that consists entirely of deferred tokens.
FossilOrigin-Name: 39bfae4c4698a13e07c4a0725f2790955e03b601fe64e17a000c691def1bdcb8
2023-01-24 11:24:28 +00:00
dan
e3c11d55db Add experimental user function unhex().
FossilOrigin-Name: dbe424b5db33ce2c7562dfb44daf2969cf3074234cc891eb9b8d0d907faf6a78
2023-01-23 14:11:34 +00:00
drh
a96cd076fe Extend the carray extension to allow the use of BLOB values to be bound
as an array of "struct iovec" objects.

FossilOrigin-Name: e117a03ca6560e958884f277db827c51ae337a970c17143a0a5f9b150f52f87a
2023-01-20 21:00:03 +00:00
dan
d993b15aa3 Ensure that the database encoding cannot be changed while there are statements running. And that the connection is left in a valid state after an obscure OOM within sqlite3_deserialize().
FossilOrigin-Name: a02da71f3a80dd8e817e89cdaa775c95e38c90d2471f8fec516bed086539e2c0
2023-01-20 17:50:24 +00:00
dan
ab5ebc4082 Add tests for changing the database encoding via RESET_DATABASE/VACUUM. And test that it is not possible to trick another connection with this.
FossilOrigin-Name: b869054acb8f171cbc16808eb87be85e6e38d5c5670522ff4e49aef92250d5b2
2023-01-20 15:13:30 +00:00
dan
b8f9913baf Fix numbering issue in and remove duplicate test from windowB.test.
FossilOrigin-Name: fa10e561f5dcdb23af862c2e486e877d379f12eae077ae5fd3da6028f1c20b49
2023-01-19 18:16:09 +00:00
dan
19ab86f3ff Update virtual tables json_each and json_tree so that adding "ORDER BY rowid" to a query does not require an external sort.
FossilOrigin-Name: ce18f0ed684824e67ed6c09acab8e735fef2c52b2ed32270dee1a2a67802c59b
2023-01-17 15:46:27 +00:00
drh
c37af308fa Add test cases to confirm that the schema parsing quirk in which an
ON CONFLICT clause is accepted and ignored on table CHECK constraints but
raises an error on column CHECK constraints.  We want to continue supporting
this harmless quirk to avoid breaking legacy applications and databases that
accidentally use it.

FossilOrigin-Name: 92b6a9cd0fb027fe675b3913aa07c75445bba0cfac9530d08d7e48f7869c04cc
2023-01-17 13:33:51 +00:00
larrybr
e8f114baa6 Cause .clone to not trip over sequence table as reported at [forum:/forumpost/71ff9e6c4c|forum post 71ff9e6c4c].
FossilOrigin-Name: b44d04f7b051d807a81152a6e4f15a765f7b9ed1f01b48b40dc5420c11e0c251
2023-01-16 21:49:37 +00:00
drh
475e76d43e In expression nodes of type REGISTER with sub-type COLUMN, ensure that the
iColumn field is set correctly, as otherwise the "IS NULL" operator might
be incorrectly optimized.  Fix for the problem described by 
[forum:/forumpost/d010a26798915b53|forum post d010a26798915b53].

FossilOrigin-Name: 0819a1869a39d54a405259ea323365506a182962a02affdef16a03446005da64
2023-01-13 19:29:46 +00:00
drh
2fc9dc9330 Fix sqlite3_prepare() so that it only invokes the progress handler on every
N-th call to sqlite3ProgressCheck(), where N is the progress handler step
count.  Also fix faulty asserts exposed by the ability to interrupt in the
middle of sqlite3_prepare().

FossilOrigin-Name: 05461651599bb490ac6cfd893645dabab9cccedc6adcce15aee2487b2ea6027a
2023-01-12 19:51:49 +00:00
drh
3b7a19b033 Add a new sqlite3_is_interrupted() interface that can be used by long-running
app-defined functions and similar to see if they need to exit early due to
an sqlite3_interrupt() call.

FossilOrigin-Name: d030f341369b7f32789cbcf3d0ad9a2ac5cad99a56dac7dfe68b7f06dc339b17
2023-01-11 00:27:06 +00:00
drh
706631de32 When computing the datatypes for columns in a view, use the same datatype name
as the underlying table if such is available and is consistent with
the computed affinity of the column.
[forum:/forumpost/7fb1fe9dcf310ef5|Forum thread 7fb1fe9dcf310ef5].

FossilOrigin-Name: 497a98363fd1ed079544620ec5d0883f987ed03013131542741c93d7568e8568
2023-01-10 19:57:26 +00:00
dan
2e77734b98 Fix handling of unix paths that contain ".." components such that "/" is considered its own parent directory.
FossilOrigin-Name: 3c6cadb396de3981bd950eddd532daa8134bd4bf22c578620e323835c96a8500
2023-01-10 14:31:56 +00:00
drh
6791891f92 Fix JSON functions so that they work correctly under PRAGMA trusted_schema.
[forum:/forumpost/c88a671ad083d153|Forum thread c88a671ad083d153].

FossilOrigin-Name: 51a5d83c425d2e31508b73074d0076156817afb19003f847d16bf4a69ae5077b
2023-01-09 12:01:30 +00:00
larrybr
4ff47d3e37 Doc-only update, sqlite3_preupdate_hook() return
FossilOrigin-Name: 2da51d7e1b9f16ef03efbb096ce2a84e8c23b883380f48b2d374bdc521865aeb
2023-01-07 22:28:00 +00:00
dan
e3b1c3868b Fix a problem with applying integer affinity to a MEM_IntReal value. Forum post [forum:/forumpost/d270125fae|forum post d270125fae].
FossilOrigin-Name: e58bba93717cd6ff950c6f9e077b4327b59b1956dd5f6668be3de9509584b8fe
2023-01-05 13:35:23 +00:00
drh
b8a655beeb In the zipvfile extension (which is not part of the SQLite amalgamation, but
which is included in the CLI by default) ensure that fopen() is not invoked
using a NULL filename.  Fix for the issue reported by
[forum:/forumpost/d1c96a9032e564f8|forum post d1c96a9032e564f8].

FossilOrigin-Name: d32757ddf5d311b6f62545c861fd606244e03f02cb2e317c1131ee6b80c2299c
2023-01-05 01:26:58 +00:00
dan
52c08ee982 Ensure that LIMIT clauses may be passed through to virtual table implementations even if the WHERE clause uses operators that may only be optimized by virtual, not built-in, tables (!=, functions, MATCH etc.).
FossilOrigin-Name: f38caab23bcef1df02618376de22d208a3333d023628cde310345505933329f1
2023-01-04 17:46:29 +00:00
drh
d0fe0fc531 Enhance PRAGMA integrity_check so that it verifies that the string values
stored in indexes are byte-for-byte identical to the values in the table, and
not just equivalent according to the collating sequence.
dbsqlfuzz 686e2e205e0c0594d3fb524bea0c25e621d1a870.

FossilOrigin-Name: 9302e4bfdce5905576b8f0af7d6b3a864e1dcd58ed89bb303010a1c4f826e915
2023-01-04 15:18:52 +00:00
drh
12e1eb344f A call to sqlite3_declare_vtab() should not cause DML/DDL authorization
failures.

FossilOrigin-Name: eed1e030722deb24674e7c2d165a2a359576c6bb5769d3bdd5fa645bc0f2ecc7
2022-12-29 18:54:15 +00:00
larrybr
0953c5354a Add base64() and base85() text/blob conversions to the CLI.
FossilOrigin-Name: 4bc98a2d9520efa9b80142163cbfab72a5f2fe9854cd6ba8291dcefdb872e657
2022-12-23 19:04:59 +00:00
stephan
913dcaf0ca sessionfuzz.c: use lt/gt brackets instead of double-quotes when #including zlib.h, as reported in [forum:91a104bd65 | forum post 91a104bd65].
FossilOrigin-Name: 7d7780c350f3239f9c9feb91924a01a4eba31b88060946c766719c9d50c16bcd
2022-12-22 10:53:08 +00:00
drh
87bdc152a1 Add about 150 new fuzzer cases to test/fuzzdata8.db.
FossilOrigin-Name: a8d8d9cd65e64e0a492a80c00050f54ab75de82651230049f65c9d2b78a164f2
2022-12-20 15:22:57 +00:00
drh
1379b9f51a Improvement to the dbsqlfuzz fix of [f113eebdbe68246f].
FossilOrigin-Name: 79d62956f206cb2987891d4ba5985cece21fc8c8c1158f46c2951f65c0dcf4e8
2022-12-20 14:02:35 +00:00
drh
98164c3452 Do not use indexed expressions to replace the expression being indexed on a
RIGHT JOIN as that leads to problems, as shown by
dbsqlfuzz a644e70d7683a7ca59c71861a153c1dccf8850b9.

FossilOrigin-Name: f113eebdbe68246fd38d640b0cdf0fd73ab5d2abad9226274dfa2e41fe286bf0
2022-12-20 01:48:43 +00:00
drh
a9d18d83fc Disallow some of the query invariant tests on SQL statements that contain
a GROUP BY since output terms that are no covered by the GROUP BY are
indeterminant.

FossilOrigin-Name: 28ba1fec4519e7ca9466f1a2f787c905f2cf880d38a004639f99f948e46a51e7
2022-12-16 18:32:07 +00:00
drh
d980442188 In the fuzzer invariant checker, do not add new WHERE clause terms that
make use of an ambiguous column name.

FossilOrigin-Name: d5b46541c30bcbeb7e57b5b5951856d564e81f7f9638d66d205157797964418c
2022-12-16 12:07:48 +00:00
drh
00d6b2755f Create a new affinity called FLEXNUM that works like NUMERIC except that it
never tries to convert integer to real or real to integer.  The affinity is
only used internally - it is not possible to create a table column with this
affinity.  This affinity is used on subqueries and views that are built off
of a compound SELECT and where the datatype is controlled by a CAST expression.
dbsqlfuzz c9ee6f9a0a8b8fefb02cf69de2a8b67ca39525c8

FossilOrigin-Name: 44135d6ea84f7ba6b36549954b38a8bc048d5ffea5a9779e35950afa4eb2dfb2
2022-12-15 20:03:08 +00:00
dan
118b53bd21 Fix an incompatibility between the Tcl interface and the "memdb" vfs by allowing memdb to accept filenames that begin with '\' characters.
FossilOrigin-Name: bd537f2057a4800bd30e7dd57405c3e57df649471104c80bd32573a89568029e
2022-12-15 18:56:12 +00:00
dan
8b58fbf5ee Update a test case in scanstatus2.test to account for recent planner enhancements.
FossilOrigin-Name: 53e07dc6b6521bb7757d0bc2cf12a501bb929afafdb16737058496afca8e6742
2022-12-15 11:39:12 +00:00
drh
604314d94e Merge all the latest trunk enhancements into the coroutines-exp2 enhancement
branch.

FossilOrigin-Name: ea278438b72e85d217e72c836cbefd68bd8b336baf33507b2d8d12ef436424cd
2022-12-14 17:52:15 +00:00
drh
ed07d0ea76 If the SELECT that implements a subquery or a VIEW or a CREATE TABLE AS is
a compound with different result datatypes on two or more arms of the compound,
then the overall column type becomes BLOB (ANY).

FossilOrigin-Name: 6ebb178c6b688ebd632e91a5ec4c748567833037c679ab3d72fb770deb230fe1
2022-12-14 14:41:35 +00:00
drh
a8b5c8739c Back out the part of the change in [88a05141c28e5ff1] that adds affinity to
the materialization of a view, as the affinity can be undefined for a compound
query.  This passes all TCL tests, but shows failures in the TH3 tests derived
from [forum:/forumpost/6f842bc5b2dadcb2|forum post 6f842bc5b2dadcb2], presumably
because the WHERE clause of the query uses constraints of the form
"source_crs_code='8675'" instead of "source_crs_code=8675".  Perhaps further
changes on this branch should reimplement affinity on joins in cases where
the affinity is unambiguous.

FossilOrigin-Name: fe5a77bcc4de8f49cc4fe6bd2e2e1f31da8d3bc84120daaa99eb853b06291d15
2022-12-14 09:06:45 +00:00