Commit Graph

22111 Commits

Author SHA1 Message Date
drh
56c65c92cb When the sqlite_stat1 data is missing for some indexes of a table but is
present for the table itself or for other indexes in the same table, then do
not let the estimated number of rows in that table get too small, as
doing so can deceive the query planner into ignoring a perfectly good index.

FossilOrigin-Name: 98d4262018a81a9a36dd8beb4b02ff0e75cdcbb8a121d143157ffb37b228d60d
2020-05-28 00:45:16 +00:00
drh
b639a2094a Small performance improvement and size reduction in the expression
code generator.

FossilOrigin-Name: eeb53e219551d8a05a87f1de9a7cd9af295d08a296f1f435a8509ea1252ccdcc
2020-05-27 12:44:28 +00:00
drh
399062cccb Change a datatype from i16 to int to appease Converity and help eliminate
a false-positive.

FossilOrigin-Name: 5b560ec49041d89c87ea3315d8fc17f7fb0e03a82091934be7373b290183f82e
2020-05-27 00:02:07 +00:00
drh
a3d6b8e5a7 Fix the cksumvfs extension so that it will not register itself more than
once.

FossilOrigin-Name: d5cdd57150db914b61b8b9c61c6caac9690fe7b647ee2c003e75b9b62be62752
2020-05-26 20:33:18 +00:00
drh
ed505ce3e4 Performance optimization in the transfer of error messages from statements
to connections.

FossilOrigin-Name: 0e898f4fed1c851cb90f940175110e632a20668a285d39f5f94f7358c3064882
2020-05-26 20:31:17 +00:00
drh
47937cfd8d Increase the version number to 3.33.0 to begin the next release cycle.
FossilOrigin-Name: 790badb390d59062cd2d8d1dec76cc6104c9425610a67503f6be38076b6a458e
2020-05-26 11:23:48 +00:00
drh
ed1e910448 Changes to sqlite3SelectNew() to work around a false-positive warning
from GCC-10.  The code is very slightly larger and slower as a result.

FossilOrigin-Name: 04e1edd8e5821a377407263829ed0d87968c708c9aeb1282107ea6f39a11c1cc
2020-05-26 11:10:25 +00:00
drh
bdd4f7d91c Innocuous changes to help Coverity avoid false-positives.
FossilOrigin-Name: 4ec8a5a203f10d228d0b3389120638766cc343179dbe38d5dbf69b650765934c
2020-05-26 10:54:46 +00:00
drh
d63c76fb31 Version 3.32.1
FossilOrigin-Name: 0c1fcf4711a2e66c813aed38cf41cd3e2123ee8eb6db98118086764c4ba83350
2020-05-25 16:19:56 +00:00
drh
b6907e2993 Extra assert() statements in the printf() logic.
FossilOrigin-Name: b1b182be2ab34cec1d94c5570bc361331a34f727eb9fa4aadfabb7f1ef79f83e
2020-05-25 15:41:03 +00:00
drh
0934d64045 Defensive code that tries to prevent a recurrence of problems like the
one described in ticket [7a5279a25c57adf1]

FossilOrigin-Name: 572105de1d44bca4f18c99d373458889163611384eebbc9659474874ee1701f4
2020-05-25 15:19:52 +00:00
drh
efc752b131 Fix minor compile issues with optional extensions.
FossilOrigin-Name: 3261ee9ec26bbeaa64190c12556a1d8146270b6660c70004830bd38c1b5b63f4
2020-05-25 12:49:58 +00:00
drh
91960aa53f Make sure variable declarations are at start of scope even when
SQLITE_ENABLE_SNAPSHOT is used.

FossilOrigin-Name: a77ceaf6ba934b1d73c90b8980191a65d02ad6ce1e11e6baf573b3a132685545
2020-05-25 12:02:12 +00:00
drh
d3bf766127 Attempt to work around a false-positive warning in the CGo compiler.
FossilOrigin-Name: d4bf60f464789935dc193ea99bf730c8fade448c7dca13eb3ce297965980f36e
2020-05-25 01:31:09 +00:00
drh
e859e43bb8 Version number to 3.32.1.
FossilOrigin-Name: 56e5063c326ffbfd3e3cb6f2b05718412aca2cb183274bfe11f5666effdd04b9
2020-05-24 12:36:20 +00:00
drh
c37577bb2d When rewriting a query for window functions, if the rewrite changes the
depth of TK_AGG_FUNCTION nodes, be sure to adjust the Expr.op2 field
appropriately.  Fix for ticket [7a5279a25c57adf1]

FossilOrigin-Name: ad7bb70af9bb68d192137188bb2528f1e9e43ad164c925174ca1dafc9e1f5339
2020-05-24 03:38:37 +00:00
drh
e40cc16b47 Move some utility Walker callbacks into the walker.c source file, as they
seem to belong there better.

FossilOrigin-Name: dac438236f7c5419d4e7e094e8b3f19f83cd3b1a18bc8acb14aee90d4514fa3c
2020-05-24 03:01:36 +00:00
drh
ca74fbf6f1 Improvements to parse-tree tracing logic. No changes in deliverable code.
FossilOrigin-Name: f7e5a68a7ebbb97a5beb050a75b3b4cf2fd6adc54653da993a8950fb3a5799f7
2020-05-24 02:05:04 +00:00
drh
16dc07f756 Minor fix to a comment. No code changes.
FossilOrigin-Name: efdbb2b499bda8ffcfe54f5d6ece08a2c58fe7a490d9550785d806bd404abb8c
2020-05-24 00:30:38 +00:00
drh
dd6c33d372 Limit the "precision" of floating-point to text conversions in the printf()
function to 100,000,000.  Fix for ticket [23439ea582241138].

FossilOrigin-Name: d08d3405878d394e08e5d3af281246edfbd81ca74cc8d16458808591512fb93d
2020-05-23 19:58:07 +00:00
drh
8e50d65aaf Improved bytecode comment.
FossilOrigin-Name: 9224f1543b51a674ad6d7db8e90d97e1b0d1abe68bed3417820ebd09d27270f9
2020-05-23 17:56:49 +00:00
drh
0b0274a90c Version 3.32.0
FossilOrigin-Name: 5998789c9c744bce92e4cff7636bba800a75574243d6977e1fc8281e360f8d5a
2020-05-22 17:46:16 +00:00
drh
f25f8d5834 Change a NEVER macro into a NO_TEST comment, as the conditional is reachable,
but only when compiling for Windows 32-bit.

FossilOrigin-Name: ce36b6d1331edba5a921fef32553e2470a79bdb1f62d2cfd81190691c83d5b06
2020-05-21 20:38:39 +00:00
dan
23e3c340b5 Avoid another potential OOB read in sqlite3expert.c.
FossilOrigin-Name: 0ccea80092f16e7f17f4c4de4f8be3fdef217199fcc08ace37e179c1b22c1294
2020-05-21 19:13:46 +00:00
drh
4f1315a432 Back out the change from [7fab1393c2b22b1f] that tries to convert invalid
surrogate characters in UTF16 into the replacement character 0xfffd, as we
find that this breaks some software.

FossilOrigin-Name: 4218c7b71fb6b227dbe4b852718584c150164af2d84e067cb810aa602554a609
2020-05-20 15:02:04 +00:00
drh
5a8cd2e40c Add compiler hints to disable TSAN for the routines that access the -shm
file header in WAL mode using a double-read with memory barrier.

FossilOrigin-Name: 3117c1b5a9e348fd8d16ba9d03fdafaad8514567fb3403f72b86d6162ad40bde
2020-05-19 15:51:10 +00:00
dan
10757ed0ca In os_win.c, avoid calling sqlite3_uri_boolean() on anything other than a main-db filename.
FossilOrigin-Name: cb0a18e64f8d81c2ada9f698faaf5ca68a0666687bf6f3abc860324cb1997463
2020-05-19 15:40:07 +00:00
drh
1a7feefac5 User-suggested improvement to the README.txt for the ICU extension.
FossilOrigin-Name: 1d1293c25abdd4b0fca64e5b1d0a118e2f339635dbc89422c0c2463fbf9ee27f
2020-05-19 12:29:56 +00:00
drh
f16cf653f4 In wal.c, improved comments on concurrency issues. More use of
AtomicLoad() and AtomicStore().

FossilOrigin-Name: 4bf566feca3a8fbe5e386533aac30e0ac25836cfc820a3abd91e156bd6198b4a
2020-05-19 12:27:29 +00:00
dan
a5ee67d5b3 Add vdbevtab.lo to build of libsqlite3.lib in Makefile.msc.
FossilOrigin-Name: f64d054b799c0af8d582fd9aff9bcbfa380ef08026ba5db8c5f89f6f56dfdad9
2020-05-18 18:02:37 +00:00
drh
c795e3df7a Avoid harmless UB in memcpy() in the JSON extension.
FossilOrigin-Name: 69e149f76853d196c8855fedfc98848b60fb116ac36bc08824b1a122469f8ece
2020-05-17 13:47:28 +00:00
drh
d924e7bc78 Use the sqlite3Realloc() interface internally, rather than the public
sqlite3_realloc64() equivalent, to avoid unnecessary calls to
sqlite3_initialize().

FossilOrigin-Name: 1313557b512297e7b75ed748894379b2022aecf696d5a58318e46a668321c1ff
2020-05-17 00:26:44 +00:00
drh
b2eb7e46eb Performance optimization for the sqlite3FindTable() subroutine.
FossilOrigin-Name: 55910b9a7287be92af9f95e0af54af822055d15b7eabbcc81d61410d0bf67726
2020-05-16 21:01:00 +00:00
drh
8c1febb2f9 The OP_RealAffinity opcode is not necessary after reading values from
a virtual table (such as rtree).  It is harmless, but it does use CPU
cycles.  Might as well leave it off.

FossilOrigin-Name: dc18d89354cffcb726722c234a0271ab628a71277b22887eea2bf118028193a6
2020-05-16 18:01:02 +00:00
dan
becd68ba0d Fix a use-after-free bug in the fts3 snippet() function.
FossilOrigin-Name: 0d69f76f0865f9626078bee087a22fb826407279e78cf9d5382e1c985c9f64a9
2020-05-16 17:26:58 +00:00
drh
c48428899d Extra memory barrier during initialization.
FossilOrigin-Name: 043a7e142dfc2b0da5fbc0b025d005ccad4886f0b0ff65426ba9155ca40394ca
2020-05-16 16:23:48 +00:00
dan
62c94d0afe Add sqlite3BeginBenignMalloc() and EndBenignMalloc() calls to debugging function sqlite3VdbePrintOp().
FossilOrigin-Name: 6f857d0e9e0893524c2f828a1a1600fefb6efeff12ecbc9bb1da106a5aff9c1c
2020-05-16 15:18:27 +00:00
dan
b2c6fe225a Update code in sqlite3expert.c to account for the fact that "-- TRIGGER xyz" VM comments are now omitted for some builds.
FossilOrigin-Name: 7cf93dc55c48c68731a1fe3ae3517fcfeb5c252bfa87e715a333c6194bcc0ace
2020-05-15 18:48:31 +00:00
dan
d48eafb984 Fix another build problem for SQLITE_OMIT_VIRTUALTABLE builds.
FossilOrigin-Name: 5e1eb0fa3afd74251bc8f484e3edfa81b15610479431af205bd952c91eecd21f
2020-05-15 16:19:35 +00:00
drh
cc1d9109c4 Fix a documentation typo. No changes to code.
FossilOrigin-Name: 758353c72627a847ba027ca44a750bbf057827dafd05811f56e4765dfc77623b
2020-05-15 16:05:31 +00:00
drh
bbf6d4328e Adjust some requirement marks. No changes to code.
FossilOrigin-Name: 7285ae2ce8fb1439e1acea2ec321abbc76aab0a2e84b58683fddb0a7bf74fb1b
2020-05-15 15:03:51 +00:00
dan
2629adc7b2 Update test file e_fkey.test to account for the fact that new columns with REFERENCE clauses and non-NULL default values may now be added using ALTER TABLE if the table is empty.
FossilOrigin-Name: 4087fce97252beda2456164afe9508f952fc9fe4be68ad0e9b330569a78e42f2
2020-05-15 13:52:33 +00:00
dan
34d1566763 Fix SQLITE_OMIT_VIRTUALTABLE testfixture builds.
FossilOrigin-Name: 3d9780c5f6095ea35bc731a51eb34d7cf8bd5dcece825b686b94fd50131626e2
2020-05-15 11:36:16 +00:00
dan
a796de8300 Test script changes to account for the fact that the "p5" column in the EXPLAIN output is now an integer, not a text values containing a 2-digit hex value.
FossilOrigin-Name: 102126d80872fdb7469233611cab28100c8455aab4ce25702b83398394559185
2020-05-15 11:26:31 +00:00
mistachkin
a8e41ecaca Enhancements to long-path support in the Win32 VFS.
FossilOrigin-Name: 0119d96decd344ae711388ac8475b92464a6d018ecf73862170f137410036dac
2020-05-15 01:18:07 +00:00
drh
043c8f60a8 Move some new test cases from fts3snippet.test into fts3snippet2.test.
FossilOrigin-Name: fa203999944133941a38e5c858f1f66fc1ef4d2f33222ab81cbf4e3fc1539f1c
2020-05-15 01:13:46 +00:00
drh
856408abf4 Add the SQLITE_ENABLE_FTS3_PARENTHESIS option to fuzzcheck. Add a new
test case that uses that option.

FossilOrigin-Name: c49a33db954f1a3fbc1889bbe9f3f3fdb8fb00e31aafb91cd6f5d1602db5c2b9
2020-05-15 01:02:00 +00:00
drh
219b8e7e75 Fix a null pointer deference that can occur on a strange matchinfo()
query.

FossilOrigin-Name: a4dd148928ea65bd4e1654dfacc3d8057d1f85b8c9939416991d50722e5a720e
2020-05-14 23:59:24 +00:00
drh
3d863b5e4e Do not allow a virtual table to be renamed into the name of one of its
shadows.

FossilOrigin-Name: eca0ba2cf4c0fdf757bae19c6397a48245adb99e8017ddc28f01804072a30b2c
2020-05-14 21:16:52 +00:00
drh
3c0e606bba Implement the IIF(x,y,z) SQL function that is short-hand for
"CASE WHEN x THEN y ELSE z END".  For compatibility with SQL Server.

FossilOrigin-Name: fce173cd211b15867369b6a54fad48168352fc83981a722ce98e57299b88608a
2020-05-13 18:03:34 +00:00
drh
ffe421c76a Remove unused constant SQLITE_FUNC_COALESCE.
FossilOrigin-Name: a116b20f863e9732cd08fbfbb1aa48204a17d611c9c1edde85dcf59310bde782
2020-05-13 17:26:38 +00:00
dan
8b4f231c47 Use AtomicStore() and AtomicLoad() in a few more places to avoid a theoretically undefined behaviour. This is not actually problem on any known hardware.
FossilOrigin-Name: fda57d4d2f1499c861d43026aa9362d1a30d67c9c002ebf5b0cdc25251537fbb
2020-05-13 13:33:30 +00:00
drh
2493dcdd07 New test case in test/fuzzdata8.db.
FossilOrigin-Name: fa11230135610f01c56d6f436f30a8b57a50b430fe7397ea3a0b6642986b3a39
2020-05-11 11:11:25 +00:00
dan
efa78884a8 Fix a problem handling constant integer expressions with collation sequences in PARTITION BY clauses.
FossilOrigin-Name: 155e6649efe8614718be7ac6c3cccf5b073ae57496dc220db5e4313621f5188e
2020-05-11 10:55:24 +00:00
drh
9e5fdc41c1 Release some restrictions on columns added by ALTER TABLE so that they
only apply if the table contains one or more rows.

FossilOrigin-Name: 3a16c0ce4d8851f79f670d94786032c8007619154ece44647dc9cc5b1f9654ff
2020-05-08 19:02:21 +00:00
drh
98aa1d735e Fix the count-optimization so that it honors the NOT INDEXED clause.
FossilOrigin-Name: 0d23a0b209900f4d7c6c13f75d4364f19afc23db72f9cfdb11e05b81502e8040
2020-05-08 18:22:00 +00:00
drh
91d4c374e2 New test cases added to test/fuzzdata8.db.
FossilOrigin-Name: 3fce9711a47329811cd333ae2f1d1384a96d73b9a5d6f9d08454a57a3fd24fc8
2020-05-08 15:28:07 +00:00
drh
acc175215a Do not retry on a failed realloc() unless SQLITE_ENABLE_MEMORY_MANAGEMENT
is available, meaning that the retry has some possibility of success.

FossilOrigin-Name: e9a8f910b5e2b84dd77364783f0610bca970cc88aa037c88636c72145b99f411
2020-05-08 10:44:23 +00:00
dan
2d3ed22a3f Fix a failing assert() in fts3 triggered by a corrupt database.
FossilOrigin-Name: cb299a090c81cdc5c116c4e15ab38fce112916f8b0fad0c7f2ab127e79238a94
2020-05-07 19:55:40 +00:00
dan
b28f44eba2 Changes to avoid deadlock in SQLITE_ENABLE_SETLK_TIMEOUT builds.
FossilOrigin-Name: 652e4b23fffbff128b177697d7217b7d5aad8baf2364df1646b268ce6774e0fb
2020-05-07 14:39:56 +00:00
dan
11a8182e5c Fix an error that could occur if the first transaction executed by a connection configured to use blocking locks is a write-transaction for which the WRITER lock cannot be obtained.
FossilOrigin-Name: 49e4dc72f7a4b28e4b49d7b91030bc986aea3ff44dac38cb6e68305800cd1de5
2020-05-07 14:26:40 +00:00
dan
4cbe5d3588 Merge trunk changes into this branch.
FossilOrigin-Name: ac4ee69664278a828e0a64c5be3b96fdb6eb6acc95646a9425c667aea328791c
2020-05-07 14:05:08 +00:00
drh
e937df81f0 Fix the handling of reserve-bytes so that the maximum value of 255 can be used.
FossilOrigin-Name: 99749d4fd4930ccf15227f67c732266af9e09dd3cabdc0834fb450ef98196441
2020-05-07 01:56:57 +00:00
dan
a8aae52391 Avoid leaking a file-handle in test file walsetlk.test.
FossilOrigin-Name: 3cfc675e2e917b69108feb3a75728b573abe8e44f0890a7d20d307b0b6784c0e
2020-05-06 21:25:39 +00:00
dan
bc9fc18e45 Fix an assert() failure that could follow an IO error.
FossilOrigin-Name: e89c864299024cdce395a15c19b000b976142b9eed267901a288adaa695f9e65
2020-05-06 21:24:29 +00:00
drh
783e159e48 Fix harmless compiler warnings.
FossilOrigin-Name: 92dc59132f8547635d73c61c21ea29b380c401ddc84a6d01412808e00386b9e8
2020-05-06 20:55:38 +00:00
dan
7a623e1d25 Fix a problem preventing building without SQLITE_ENABLE_SETLK_TIMEOUT defined.
FossilOrigin-Name: 98eb54c6d83992886f17a00b6fc8998df230e3b5f45bafc6fae0d15a9ee5a4c6
2020-05-06 20:45:11 +00:00
dan
7bb8b8a4f7 Add error code SQLITE_BUSY_TIMEOUT, used internally by the OS layer to indicate that a call to xShmLock() has failed due to timeout of a blocking lock.
FossilOrigin-Name: f3ef9c7c2b4ba3de1057ad569f068b241d5f23e6629d8e0dacf85e57fd13b8aa
2020-05-06 20:27:18 +00:00
dan
fc87ab8c4a Fix compiler warnings in non-SQLITE_ENABLE_SETLK_TIMEOUT builds.
FossilOrigin-Name: 22de99ef410ba2a540871f3e61157d8dc4b969416f14808aeca73971b17fcd51
2020-05-06 19:22:59 +00:00
dan
861fb1e9dc Block on the WRITER lock when attempting to run recovery.
FossilOrigin-Name: 105d6c9bbcadc64faa2b24e315cb13227b17cfc6bf1b3512713f80ce56976a3d
2020-05-06 19:14:41 +00:00
drh
e0a8b712c1 Provide the SQLITE_DEFAULT_LEGACY_ALTER_TABLE compile-time option.
FossilOrigin-Name: 63e659d9a793227604aa95685a8d83cd08305f1d01e135407a3ffc6d54482ab8
2020-05-06 18:43:57 +00:00
dan
d0e6d13301 Add tests for running recovery when opening a write transaction or performing a checkpoint with blocking locks enabled. Fix some failing assert() statements.
FossilOrigin-Name: d096ea3fe20f8af90f9e3f798fd0a69527b32ac8e208ade58b9d0af0e831f41b
2020-05-06 17:18:57 +00:00
dan
293e9f5d6c Merge latest trunk changes into this branch.
FossilOrigin-Name: a3727dba10b476f414f0a049b35f2a5c169a408eccefa6833821560684e07f8b
2020-05-06 15:07:25 +00:00
dan
58021b237a Unless upgrading an existing read transaction, have ENABLE_SETLK_TIMEOUT builds attempt to use a blocking lock when opening a write transaction on a wal mode database.
FossilOrigin-Name: d6f819a9e6b35f3fd558bd93255a6a24ad690a0fa15a82b009ca9c641db983c6
2020-05-05 20:30:07 +00:00
drh
fde2592503 The only known path to a corruption detection branch was cut off by the
previous commit implementing earlier index corruption.  So make the branch
NEVER.  Maybe a fuzzer will find a new path.

FossilOrigin-Name: 9a84d8eb44b12ddea921baa73ac3bffa8c8d23a852605dc1dbde37907360bd79
2020-05-05 19:54:02 +00:00
drh
85bd353ac2 Earlier detection of index corruption caused by missing index entries.
FossilOrigin-Name: f339f31f9e9a856b576f99c5230fdf6d60fdc2873e48cb5aa0a4ab1d04e3c930
2020-05-05 18:42:49 +00:00
drh
eb8305bbc7 Fix a compiler warning in cksumvfs.c.
FossilOrigin-Name: 68033bcade87e6046f4c0a49936d63ce531c680c1def98fae02afa0c79db2c7f
2020-05-05 13:41:40 +00:00
drh
3d42fb788a Fix harmless compiler warnings.
FossilOrigin-Name: 8eee591d3cb9fadfd5cac5543bd66ef9cb371a72d3ad3241fb3bfd67fb216eda
2020-05-04 19:52:00 +00:00
dan
8714de97c0 Changes to avoid deadlock in SQLITE_ENABLE_SETLK_TIMEOUT builds.
FossilOrigin-Name: 553423c23142cf0ec219192315d57ce8a0e10c3d8678d28bc110a1a9a7c17cee
2020-05-04 19:42:35 +00:00
drh
44a5c86c6c Minor change to the sqlite_stmt virtual table, for test coverage.
FossilOrigin-Name: 838987b2097c4b7acaa65aea99cfdaf199f04d76bcf6ef12743c60b338a965f7
2020-05-04 19:04:23 +00:00
drh
20e34f9110 Simplify the initialization of built-in extensions.
FossilOrigin-Name: 729f2397358d0382e255ba0058bf70bc9ed410b7621a67466da13de437d3ba5c
2020-05-04 17:15:21 +00:00
drh
995e1af9fa Ensure that the master-journal name is in a form suitable to be passed
into sqlite3_uri_parameter().

FossilOrigin-Name: d1ba026d882f070b351280028e2fa88a3cca59b46d4683302e24c6677e0951b9
2020-05-04 11:47:38 +00:00
drh
278b0517d8 Add the SQLITE_FCNTL_CKPT_START file-control and use it to optimize
the cksumvfs extension.

FossilOrigin-Name: efdecb13091316aeac2722f58577cb0314e008e857f2816a2a222bac0a83e9e1
2020-05-02 04:08:23 +00:00
drh
477a357278 Add support for PRAGMA analyze_limit and approximate analysis.
FossilOrigin-Name: 812547525d35df975f40cbbeb604cc9cd2dec809c1ca083cbb139fe59ffa1d73
2020-05-02 03:46:32 +00:00
drh
f72981f2d9 Add a missing VdbeCoverage() macro.
FossilOrigin-Name: 77a55c394d2c313a5710229bee9262457dcfc6620e6500f9f526c5f6acf87cef
2020-05-02 03:29:21 +00:00
drh
c75921ac4e Merge the bytecode and tables_used table-valued functions. Requires
-DSQLITE_ENABLE_BYTECODE_VTAB at compile-time.

FossilOrigin-Name: d09bcce37f1eaf084e3b07eb4a23653ea1f370cdd290ce3875408186adf87022
2020-05-02 00:31:00 +00:00
drh
7e088a6c0a Corner-case changes to the bytecode virtual table for testability and
correctness.

FossilOrigin-Name: baa720e4a88f268ed95337daab5f434fd3263b00f09101cddc6424765bf3b722
2020-05-02 00:01:39 +00:00
drh
51f1c6f3ec Merge recent enhancements from trunk.
FossilOrigin-Name: 96dfc71ea599702ef38b60952d03e95dce5a8c534cd943e076e9c76b00e61e65
2020-05-01 18:58:21 +00:00
dan
7465787b97 Fix problems with UPDATE...FROM statements that modify rowid or primary-key values.
FossilOrigin-Name: 623ab585d1aa1bdde2df17f1936aa4eec2d997b274acc5c7b291d9566a9ec2c5
2020-05-01 18:43:49 +00:00
drh
fcf31b28ff Add the SQLITE_FCNTL_CKPT_START file-control. Use it to optimize the
cksumvfs extension.

FossilOrigin-Name: b40f5aa344ae10cf4da83b3aa9e4866d6f6ffb06ba7e34ec1ce80c92468cf3bf
2020-05-01 18:37:34 +00:00
drh
e754830eae Merge recent trunk enhancements.
FossilOrigin-Name: 2100b2c8f339e9778723fa0c91e479bab8675cf6fbea1664b6af49f40db6d27b
2020-05-01 15:04:13 +00:00
drh
5051194270 Clarification to the sqlite3_uri() family of interfaces. Documentation
enhancement only - no changes to code.

FossilOrigin-Name: 853703cd6d44d6dd48ef5eda6523e374b8ebdf7c338ddaad31c15a40a8b3fd9b
2020-05-01 13:45:12 +00:00
drh
8b2d8de3e2 Update documentation for sqlite3_close_v2() for clarity. No functional
changes.

FossilOrigin-Name: 80498b69ea489e8816c80a52c9e55a62699116fcbfdcbfd922ef23c2d9938871
2020-05-01 13:32:19 +00:00
drh
cdb6ce980b Add the new SQLITE_IOERR_DATA result code and use it in cksumvfs.
Also enhance cksumvfs to emit an sqlite3_log() message whenever it finds
an invalid checksum.

FossilOrigin-Name: a094e8bfdef10d9e5d97f5a9f7c15b0fc547358b83367762ba5c2dfd2c9d0117
2020-05-01 11:31:43 +00:00
dan
8b023cf592 Add OOM tests for the new code on this branch.
FossilOrigin-Name: e4a18601e5093896e5b323c21aec986b07259353d2ef9455d0a81c6846f40282
2020-04-30 18:28:40 +00:00
dan
1e113844fc Report an error if an UPDATE...FROM statement has an ORDER BY but no LIMIT clause. Add tests for multi-column primary keys.
FossilOrigin-Name: ffcdb6689123bb871c9bd8f977197f86f37c42e9094e2d4bb187ff479f74cf65
2020-04-30 15:49:56 +00:00
dan
f2972b6083 Fix problems with using LIMIT and FROM clauses as part of single UPDATE statement.
FossilOrigin-Name: b717dc3c5fafb9b86a141e7ecffc030fd9b36aa57a0b3e5200d64ad23a0aa13d
2020-04-29 20:11:01 +00:00
dan
9ed322d6c3 Fix various bugs in new feature on this branch.
FossilOrigin-Name: 823ba94e29dece1687e28711e503a1f56d392c306b0cbc0a20548180834530d1
2020-04-29 17:41:29 +00:00
drh
95063d8c90 Do not allow page_size changes on an active cksumvfs database.
FossilOrigin-Name: 2c17cdce26fd935e6d81ff828f4670291fc014013c93b2a1578506598345ee86
2020-04-29 01:09:46 +00:00
drh
451f89a896 Fix incorrect error message when something goes wrong with the
sqlite3_dbpage() table-valued function in the .dbinfo command of the CLI.

FossilOrigin-Name: 0dcf002463f5931c3875d2038d2b97298f1800b1cdfa70485d6430ab758f3b25
2020-04-28 23:09:56 +00:00
drh
065e4a8d29 Add the cksumvfs extension.
FossilOrigin-Name: 237c10f941cc6cb775693ae87513ff1b816f12b5e9c3d57b057421204d2d02cf
2020-04-28 20:47:40 +00:00
drh
23bef340be Use AtomicStore() when setting the mem0.nearlyFull boolean to avoid
harmless TSAN warnings and to forestall doubts about threadsafety.

FossilOrigin-Name: ce980af65a9b528f112baa22a95020a98ac5340155a0b53b09c46f99aad9b12b
2020-04-28 14:01:31 +00:00
drh
9f603fcefd Use an AtomicLoad() macro in sqlite3HeapNearlyFull().
FossilOrigin-Name: 7556bc632e271d8a1e4fd836ce91e28213768ac09c90857b91171e9cd1009884
2020-04-28 11:45:41 +00:00
dan
69887c99d4 Allow a FROM clause in UPDATE statements.
FossilOrigin-Name: f353a1a613bb7ad8cedcda377a7fe6fd05ee03b1f50665b00b84a868a71c5bec
2020-04-27 20:55:33 +00:00
drh
e238e31413 Yet another attempt to enhance sqlite3_load_extension() so that it works
with Window-style pathnames using a backslash separator character.

FossilOrigin-Name: b73d9a7d6f7fec0ffc9640902a849289c305f8651e891388c01255c4da7a6c4b
2020-04-26 22:04:48 +00:00
drh
ec9a25c7c7 Fix an issue with check-in [bc3bf7c6681a96bc] when compiling on Windows.
FossilOrigin-Name: 57b16d8ca3d1ede3b411389256bec6686433aae716f47bca309ee7c8e5fe3128
2020-04-26 14:33:54 +00:00
drh
7d9ad75a56 Fix the sqlite3_load_extension() interface so that it tolerates backslashes
in place of forward-slashes in pathnames on Windows.

FossilOrigin-Name: bc3bf7c6681a96bc18a1ed02f0ccced4731d5dab45f60c347dd1841706e6b62a
2020-04-25 21:05:51 +00:00
dan
07f9e8f4f3 Ensure affinity is not discarded from a view column if the view appears on the rhs of a LEFT JOIN. Fix for [45f4bf4e].
FossilOrigin-Name: ac31edd3eeafcef46164a4506bbc32c711bb7cd78378aeaa4c9bb12524ac5ea1
2020-04-25 15:01:53 +00:00
drh
ab2172e69f The new sqlite3_database_file_object() interface requires that the pager
never invoke xOpen with SQLITE_OPEN_MAIN_JOURNAL unless it is using
a pointer to the journal name found in the Pager structure itself.   Make
this the case when processing a master-journal.

FossilOrigin-Name: b4987a5ced0c0f2c606c040e0c1b8ee11175f40ae35a7446308a43e77b1f1db2
2020-04-24 18:20:30 +00:00
drh
742efb6749 New test case for ticket [1dcb4d44964846ad].
FossilOrigin-Name: 9e9f1e96c9aac60fcbbcda6923e01e350ca4dd88acefb9d400979419ba4e1e4d
2020-04-24 17:55:52 +00:00
drh
5415ab49b4 Fix an uninitialized variable in the newly enhanced ".output" command of
the CLI.

FossilOrigin-Name: 65c6c26bb48d5347ce53bb3607de3a03a5a03946b232d35e46a20533f86750f8
2020-04-23 20:45:46 +00:00
drh
542bd6521e Fix an off-by-one error in the "calculated" page count output from the
sqlite3_analyzer utility for databases that are more than 1GB in size.

FossilOrigin-Name: 8789368b91fb5b7477bdba3a953412fc3839b4894443b65186f7b8f79f6369c9
2020-04-22 13:49:25 +00:00
dan
fc7f31742d Fix an integer overflow in fts3 causing a usan error.
FossilOrigin-Name: e256f85289a78e629acdf83e5bf1f8df2a0ffb3d559738eb9e49db6c228dc8c0
2020-04-22 11:11:17 +00:00
drh
4d34766f4e Clarify the comment on the sqlite3BtreeGetRequestedReserve() routine.
No changes to code.

FossilOrigin-Name: 52a6acca6d5d376308d354c02f4d676d9375c34c3841d7b1941196ee8b4e2511
2020-04-22 00:50:21 +00:00
drh
6ef2dc137d Add the sqlite3_database_file_object() interface.
FossilOrigin-Name: f534ebeaaf34f825550138f09f9a40221dfa7cd5c6537ef9f86dce5249025ec3
2020-04-21 20:19:25 +00:00
drh
9a1bb3f616 Add the sqlite3_database_file_object() interface to sqlite3ext.h.
FossilOrigin-Name: 3cabe06b6e9433cbfb4bf7bd72a425f43b54f57d84a205adbaa6a1147bbe46bf
2020-04-21 19:27:08 +00:00
drh
480620c713 Experimental API: sqlite3_database_file_object().
FossilOrigin-Name: ae697b152d22737169892411a0c4d908895ff5fb249cce9bdb1ba0bbe32806f0
2020-04-21 01:06:35 +00:00
drh
3b9f154bb7 Do not use O_NOFOLLOW when opening a directory just to call fsync() on
that directory.

FossilOrigin-Name: 2fc80ef16ce5878311ab88a0c64631813572ffbb71f75363b4619c9667e0926b
2020-04-20 17:35:32 +00:00
drh
541ef2c36c Enhance the ".filectrl" command in the CLI to support the --schema option.
FossilOrigin-Name: 698d40db58b76f4094687d46b5c6292702a62168054f9e6a70ee86650a6635f7
2020-04-20 16:21:30 +00:00
drh
45248de39a The SQLITE_TESTCTRL_RESERVE operator is removed. In its place is the
more generate SQLITE_FCNTL_RESERVE_BYTES which is an API and which can
operator on more than just the main schema.

FossilOrigin-Name: abc1aad74f7b6a1e72fb09936239f2224aa942d16296c6a3de0b8daef4bc8471
2020-04-20 15:18:43 +00:00
drh
871f45441c Remove an obsolete comment. No changes to code.
FossilOrigin-Name: 4135cb024456288d9c85aef5fb572dbb591527dd33d9a60ca5946b712c269941
2020-04-20 14:05:54 +00:00
drh
7a43100afb Add the --bom option to the ".excel", ".once", and ".output" commands
of the CLI.  Also fix the "--all" option on ".help" so that it works with
two dashes in addition to just one.

FossilOrigin-Name: d5b0def96ba6d90f47bc96fab1ccf9c501d84885d086744035b16fd96f3e248c
2020-04-18 14:12:00 +00:00
drh
1d9ea27f7e Fix the ".excel" command and the ".open -x" and ".open -e" command so that
they work better when running from an in-memory database and on Windows
and when running from a script.

FossilOrigin-Name: 07752164c2bf00b6885808533bbdb2cefbf1bf281a887b0b4f6316649a6cb810
2020-04-17 23:46:54 +00:00
dan
054a081555 Merge accidentally created fork.
FossilOrigin-Name: cb772b7a8fb53694cb267e74c11f49d2b9fd6920821c4e232f90ec35739c8904
2020-04-16 15:56:03 +00:00
dan
7576a68c8c Improve corruption detection in fts3 shadow tables earlier in order to prevent an assert() from failing.
FossilOrigin-Name: a9ec8c8f80a59badabb0afdb4189f0fd2934f936530d4151de395b3a7e7c1f1f
2020-04-16 11:35:27 +00:00
drh
c39b121a95 Clarification of the byte-order determination for UTF16 inputs to routines
like sqlite3_bind_text16() and sqlite3_result_text16() and others that
accept UTF16 input strings.

FossilOrigin-Name: a42fdcf54bcbd72a301dad4a040346dc48e67cacab43479ec618f5c32108c55f
2020-04-15 17:39:39 +00:00
drh
f05dd03a6e Build the UINT collating sequence extension into the CLI.
FossilOrigin-Name: 2b8c6b035a276029850de02651712a5fd69f4dfee45083d24b9d1f998004829b
2020-04-14 15:53:58 +00:00
drh
e6a85962e7 Add the UINT collating sequence extension. The implementation is copied out
of the "natsort" branch.

FossilOrigin-Name: 6f46c6e3e3c471ca864d7596e0211ee90316b784c8fe22c7ae177c9d29731dc7
2020-04-14 15:48:55 +00:00
mistachkin
43e862723e When compiling the shell for WinRT, avoid using Win32 APIs that are unavailable.
FossilOrigin-Name: 85d3dc8c50d8dbb8eac1956e8976e861d3b671e03355ca9257060fa3dca51cc4
2020-04-09 15:31:22 +00:00
drh
75b5f22c01 Merge recent trunk enhancements into the bytecode-function branch.
FossilOrigin-Name: 7e6576ec00fde277c5c7abac264f7ec7e531de00c4e112bf733a07fe703fadcc
2020-04-09 15:07:22 +00:00
drh
ad996da0f6 Merge trunk enhancements into the approximate-analyze branch.
FossilOrigin-Name: 17901ea6a1951b8c55671408841901c6660e3f8099378204f080b171a684d718
2020-04-09 15:01:09 +00:00
drh
4b3282d8a0 Limit LIKE/GLOB pattern length to 100 bytes (default is 50K) when running
dbsql cases in the fuzzcheck utility.

FossilOrigin-Name: 10306118e8591e727af477a1a15d136852d21170e645bd0e75f7c88346b037d7
2020-04-07 15:07:11 +00:00
drh
aa0696ee9a Add the --spinner option to the fuzzcheck test program.
FossilOrigin-Name: b1eae2686f03a6e20a49ca2b3a654b3019506d4941708ee3919c339cd093a57d
2020-04-07 13:08:56 +00:00
drh
2d99f95721 The ALTER TABLE fix of check-in [7e5ad8e0ab7ee91a] is no longer needed due
to the changes at check-in [4cf8721f5ceb1fda].  But, we keep the defense
in place as an assert() for extra safety.

FossilOrigin-Name: 230556e859536bbadf0daf8133a9a01ef4f03148b3296723e37bad66e3fc3d82
2020-04-07 01:18:23 +00:00
drh
b3120fdf5b Remove dead code that was added during initial development of RENAME COLUMN
but never actually served a purpose.

FossilOrigin-Name: c95c4cda4640f05d61b13b4e60494dec07d4483734fc41ffcce73fb5163cbb0d
2020-04-07 00:54:09 +00:00
drh
4047bdfd2c Performance improvement in sqlite3ResolveExprNameList().
FossilOrigin-Name: 7e170e67f24c7cdef7e7ceac4e0b81a75382618e4abe9e604f3d7f6db9dc6396
2020-04-06 20:35:52 +00:00
drh
d44390c8c5 Performance improvement for column name lookup.
FossilOrigin-Name: 1e4b6a93987cdfbf829e2ff35ef417c290625f2894ad11949e301af518f1fb44
2020-04-06 18:16:31 +00:00
dan
85f2c76cf9 When running ALTER TABLE, avoid adding some internally generated tokens to the token map to improve performance on schemas with nested views.
FossilOrigin-Name: 4cf8721f5ceb1fdaefdc355b3211f75c53c4cdf9d2582ca70fc96777a9b057c2
2020-04-06 16:37:05 +00:00
drh
47f8ef32a0 Remove a NEVER() that could be true in sqlite3MatchEName().
FossilOrigin-Name: 921448f0e24a3753374b32be9d7bf36a9ca5d8522eff9f0b51dc243f08652419
2020-04-04 11:58:22 +00:00
drh
2e52a9c611 In the push-down optimization, do not substitute columns that have previously
been identified as being constant by the propagate-constants optimization.
Fix for ticket [51166be0159fd2ce]

FossilOrigin-Name: 70c44811d12f540d4ec1c29dedbe999cf79b82e326a8712ae2fa0725d6bd8a65
2020-04-04 00:15:54 +00:00
dan
c59b4acf5d Avoid factoring out constant expressions on the LHS of an IN(...) operator, as the IN(...) operation may affect the affinity of these values.
FossilOrigin-Name: 98d56b4a34fddcbaecd953a045ae0270b4d78c1edf34cc73522fb4e12743af80
2020-04-03 19:37:14 +00:00
drh
a96a69b7db Add a test case to fuzzdata8.db for the recent Henry Liu bugs.
FossilOrigin-Name: 42b02454b146ca1b04c0a5321465326435fc5b995f5498d3b1cf69c558a20f95
2020-04-03 16:11:32 +00:00
drh
eb110d9687 Merge updates from trunk.
FossilOrigin-Name: 348c40136c8ec20f36ccdd4c8a6d4ec2d8274328b86b25b385813e3aae31ea8b
2020-04-03 15:48:05 +00:00
drh
c415d91007 In the event of a semantic error in an aggregate query, early-out the
resetAccumulator() function to prevent problems due to incomplete or
incorrect initialization of the AggInfo object.
Fix for ticket [af4556bb5c285c08].

FossilOrigin-Name: 4a302b42c7bf5e11ddb5522ca999f74aba397d3a7eb91b1844bb02852f772441
2020-04-03 13:19:03 +00:00
dan
4db7ab53f9 Do not suppress errors when resolving references in an ORDER BY clause belonging to a compound SELECT within a view or trigger within ALTER TABLE. Fix for ticket [a10a14e9b4ba2].
FossilOrigin-Name: 684293882c302600e112cf52553c19d84fdb31663d96e5dd7f8ac17dda00a026
2020-04-03 11:52:59 +00:00
dan
fb99e388ec Fix a case when a pointer might be used after being freed in the ALTER TABLE code. Fix for [4722bdab08cb1].
FossilOrigin-Name: d09f8c3621d5f7f8c6d99d7d82bcaa8421855b3f470bea2b26c858106382b906
2020-04-03 11:20:40 +00:00
drh
49d01abaac Fix a minor problem with EXPLAIN QUERY PLAN for triggers.
FossilOrigin-Name: 6e11c03f84efa93b218b07e39b6b56b1d872639f39c18498ee54d8cd8364d4f5
2020-04-02 19:58:31 +00:00
drh
e1cd73f671 Minor changes for better test coverage.
FossilOrigin-Name: ae3ac297d2deee2a687ae2e9cf98aaf3e1b41196363238101a19d38092aebec6
2020-04-02 17:21:51 +00:00
drh
91654b2016 Fix an obsolete comment in the parameter binding logic of the CLI.
No changes to code.

FossilOrigin-Name: c9c735e201d7900d8c2b766463a6c90f547d9844352719dc650734e25e635fad
2020-04-02 13:21:10 +00:00
drh
c004bd54e3 Fix another harmless compiler warning.
FossilOrigin-Name: 949eec2530bbe7f48daddfb3022d60ea5d7a43f0f5d120e71c682054feb721db
2020-04-02 13:08:54 +00:00
drh
e0ef4e2b47 Add a missing #ifdef to avoid a harmless compiler warning.
FossilOrigin-Name: cc54de354317ebc080d4d1ee25427b31a49c4a75e01cb5d9966f1aaeb2ad098d
2020-04-02 12:53:17 +00:00
drh
e065a18a4b Merge enhancements from trunk.
FossilOrigin-Name: d1731385c077f298b0cf654d6183ed40f7e5c07e4e2ab7f69109cf951ce99d9e
2020-04-02 12:24:08 +00:00
drh
31e3744ecb Simple fixes to PRAGMA analysis_limit.
FossilOrigin-Name: c20d4fdee21409ebc9c65c9540af8ac48d1f4425499a6674ef9319655c192612
2020-04-01 01:15:16 +00:00
drh
49a76a8fe5 Add "PRAGMA analysis_limit=N;" to limit the number of rows visited by
ANALYZE when N is positive.  Positive N also disables collecting stat4.

FossilOrigin-Name: a279b151c1623807774daf4975175c62ea252eefb71f9820ced6773769b392c5
2020-03-31 20:57:06 +00:00
drh
dcdd707a9c Merge recent enhancements from trunk.
FossilOrigin-Name: c705ce266ad25af71791035590875f0ea9f2c72826b3eda17f065d2bf091de92
2020-03-31 18:41:21 +00:00
dan
892edb69c4 Use __atomic_load_n() and __atomic_store_n() for a few more things where they are available.
FossilOrigin-Name: a49f8ec552bede7da731e0571ccf49de1a30e7be3a5673150436c8b411ba6ffc
2020-03-30 13:35:05 +00:00
dan
3e42b99175 Fix "GCC_VESRION" typo in wal.c.
FossilOrigin-Name: fbd9378727141848ba2f5a8eee3076ecbd315e4a87b264c6d890103d56b2e4bc
2020-03-30 11:17:37 +00:00
drh
218da8c6f1 Enhancements to the SQLITE_ENABLE_SETLK_TIMEOUT compile-time option to avoid
rare deadlocks on recovery.

FossilOrigin-Name: 06885e9aa4e430d10f4b32105bcf405c65fd6f7b4cd451baf56fb4f12f408963
2020-03-28 19:02:39 +00:00
drh
b1243a6d9c MSVC does not allow constant expressions as initializers for
constants with /fp:strict.

FossilOrigin-Name: 076658e5d21d9284448f41312b83a6c3d25394c2bfa088ef6cdfe1dc60277856
2020-03-28 12:01:25 +00:00
dan
97ccc1bd11 Modifications to the way blocking locks are used in SQLITE_ENABLE_SETLK_TIMEOUT builds so that multiple processes or threads may not deadlock when operating on a single database.
FossilOrigin-Name: c516027d5fd876b7d0bf566435667d554db29ded30ad6fc1165caa4a93d015a0
2020-03-27 17:23:17 +00:00
drh
8f78a528d5 Add the tables_used() table-valued function as a variation on bytecode().
FossilOrigin-Name: 6283c677d57220e54375a6463f453c6d068e042263558df16cff1055d1b0d3f5
2020-03-26 16:48:18 +00:00
drh
c5eeacd58b Merge updates from trunk.
FossilOrigin-Name: d7db09101878102e192ee7a81437e8f6f2e317ddf110852673a2e81d1f80ae0e
2020-03-26 15:28:46 +00:00
drh
95b395901a Reinstate the optimization that converts "x IN (y)" into "x==y".
FossilOrigin-Name: 27936e6884e77093533719c7955a17f051cfb359872e51a6d1481152e6256443
2020-03-26 00:29:50 +00:00
drh
cdbb28154e For the LIKE pattern in the .dump command of the CLI, accept backslash as
an escape character.

FossilOrigin-Name: 029ceea612f5c7a1420939d8a772eefcc6f9550d24d57b52ae1729ea9d85fae9
2020-03-25 20:31:45 +00:00
drh
8e9297fb79 Enhance the ".dump" command in the CLI so that it accepts multiple LIKE
pattern arguments and shows the union of all matching tables.

FossilOrigin-Name: 45fba3d7055f90f67005ca740687f060a2311db40c8f6a161bfea0424e6ebf6d
2020-03-25 12:50:13 +00:00
drh
7797207554 Optimize the "subprog IS NULL" constraint.
FossilOrigin-Name: ca8c5f028b9f6f32639c8bc9df5dc02537e21385fcbe7e1ae600c640977ea0d5
2020-03-24 18:41:58 +00:00
drh
cf08f08d2c Fix a memory leak.
FossilOrigin-Name: c9f3405eeac8aff171b5d76bae954f3b51b353d16286a3d2af43ef942c212abc
2020-03-24 17:52:31 +00:00
drh
0518d06117 Provide content for the bytecode.subprog column.
FossilOrigin-Name: df893364b7cea07ff2b15b80cb294dccaffe701d51452264599b55304a36fa7c
2020-03-24 13:27:53 +00:00
drh
eeb55d8694 Fix the build so that it works even without SQLITE_ENABLE_EXPLAIN_COMMENTS.
FossilOrigin-Name: 5896cbf4d0c7854c29c96d2ea2cea4adaedaa027a0fe4a3f0ac4dfbeaabb8dec
2020-03-23 23:17:38 +00:00
drh
8c5163a697 The bytecode() function now runs and sometimes works, but it untested and
there are known problems.

FossilOrigin-Name: 6819b86eb2de516c445655a83f9b2ba5ae0bff660cffaf84f1345d9be79b051e
2020-03-23 20:58:55 +00:00
drh
cb49f5468e Further simplification and modularization of the EXPLAIN logic.
FossilOrigin-Name: aee1c12f4227cea9e8c6295cee3ec11797422c31b48c9468f176eb52f8261fe8
2020-03-23 19:14:11 +00:00
drh
356cd76aa8 Begin breaking appear the sqlite3VdbeList() routine into subroutines that
can be reused by the bytecode() table.

FossilOrigin-Name: 2c4dd79fbd4b9f72634a732abb9ed833cd8c9b05fe1e10af8f23e6d6ec023c7c
2020-03-23 17:24:46 +00:00
drh
691b5c54b8 Infrastructure for the bytecode() table-valued function. The function itself
is not yet implemented.

FossilOrigin-Name: 2795f0d633577e0de66b389d9e8e44c55e85975bdc62f1a0b8f93959d19b22bf
2020-03-23 15:49:22 +00:00
drh
74a07986ce Fix to the recomputation of the colUsed field added by check-in
[a9bb71ba708ba722].  This fixes ticket [5829597ac43811e3].

FossilOrigin-Name: 5d14a1c4f2fc17de98ad685ad1422cdfda89dfccb00afcaf32ee416b6f84f525
2020-03-21 23:10:38 +00:00
drh
f7f6dbf501 Enhance the treeview system to show the SrcList_item.colUsed field for
FROM clause elements.

FossilOrigin-Name: 8a5c539b77aa174c048a504d211c56902075f9b42b654e1f8cc5767739e5fcc9
2020-03-21 22:03:32 +00:00
dan
7d76fad8eb Simplify some of the code modified by the previous commit.
FossilOrigin-Name: 04abadb545d1b34bdd74d62becb3bfd83aceee373fd6b4b708d5ad53f41d9464
2020-03-21 20:58:05 +00:00
dan
31f170f396 Ensure that "main" can always be used to refer to the main database, even if it has been renamed using SQLITE_DBCONFIG_MAINDBNAME.
FossilOrigin-Name: 682b426f5658254e63dff02c960b557fb33cb3e944fdd14faa0aa9988af7269a
2020-03-21 15:41:55 +00:00
dan
465c2b8964 Consolidate some code on this branch.
FossilOrigin-Name: a85c63daa640e02fdfd891a05a1a09e848c9621a5dd6e112338451008623ecbb
2020-03-21 15:10:40 +00:00
drh
2c3629e1c9 Change a bitfield in sqlite3_stmt into an unsigned character, for slightly
smaller code and better performance.

FossilOrigin-Name: 0d4d3c642494ad494b4ec937215eaf833158e62e5ae59ed981d6b546220c13b8
2020-03-21 15:07:27 +00:00
drh
62b6e1d042 Performance optimization in sqlite3VdbeMakeReady().
FossilOrigin-Name: aa92f9b95f95d40cc58910da87168a5bd440f71deb072dc651bb15936315786c
2020-03-21 14:22:27 +00:00
drh
2aee514b4c Recompute the set of columns used for each table when the table is
involved in query flattening.

FossilOrigin-Name: a9bb71ba708ba72255ba8d18c9856e38ddf53eae2d61c8435149354fb2b2459e
2020-03-21 00:05:53 +00:00
dan
00bd55e1ae Allow "main" to be used to refer to the main database even after SQLITE_DBCONFIG_MAINDBNAME has been used to assign another alias.
FossilOrigin-Name: 75c85ca32f9ae4a28fd8f8ff2f7639599413d22af706e9799a0e76cc560d14eb
2020-03-20 20:54:28 +00:00
dan
ec8e689a20 Avoid an undefined integer overflow in fts3 by detecting data structure corruption earlier.
FossilOrigin-Name: 86e98ddc19470410ccc6d2cf4ad56ef0bc5a23b7fbe6331b8cae374689f54529
2020-03-20 20:18:49 +00:00
drh
589c787620 Chagnes the ESCAPE clause on the LIKE operator to overwrite wildcard
characters, in order ot match the behavior of PosgreSQL.

FossilOrigin-Name: 11e0844f71e8f2d27ce9363fb505e02fd7795c61dae0b3886cf0d8df4484dd97
2020-03-19 18:13:28 +00:00
drh
f0a2172d1d Fix an integer overflow problem with the dbstat virtual table that comes up
when trying to analyze a corrupt database.

FossilOrigin-Name: 1d64f4a8af81fe1235fffa54884d8f842a48ff6a33d6172f0cd65bf42fe8b2a1
2020-03-19 17:27:52 +00:00
drh
91a23dc299 Fix a typo in a comment. No changes to code.
FossilOrigin-Name: 3a51919ac23ae7312d78905334dc97742b517a7476052a85aa07945d9c77697b
2020-03-19 15:57:03 +00:00
drh
78a50d7280 Fix the build for when SQLITE_ENABLE_STAT4 is defined.
FossilOrigin-Name: 8f0a8c2aa45f7cf7339094d83893aeb046b010b5b97bb4dae99ac07a8ebf2fa6
2020-03-18 15:58:13 +00:00
drh
59a8cb7931 Add the SQLITE_ANALYZE_LIMIT compile-time option (expected to be temporary)
that sets a threshold at which ANALYZE starts to use approximations during
the analysis process.

FossilOrigin-Name: a773fd4698d474fda5e57bc77ed66a79cf74efee2706f43f6def6f450bfd1fc0
2020-03-18 14:43:05 +00:00
drh
9f27463684 Provide an estimated row count to stat_init() for STAT1 analysis.
FossilOrigin-Name: 714419fe85cfdad22979183a94e4569c87740652758ab76b646753cf2b013b54
2020-03-17 17:11:23 +00:00
drh
e50478d727 Remove the SQLITE_OMIT_BTREECOUNT option. Btree count is required.
FossilOrigin-Name: a9bfa47aeea27e91611ba913d33e6635d2016e2c2ab78f9b0657f1bd8933e1a8
2020-03-17 13:41:51 +00:00
drh
dc4a1687b8 Improved bytecode comments for the ANALYZE command.
FossilOrigin-Name: c38ea4139d87535b789f43eb1e38b2dc4b8312352a721035283e67cf0f3d5067
2020-03-17 13:07:04 +00:00
drh
9d8c287309 Merge changes from trunk.
FossilOrigin-Name: 93d710262eb046e2370660b1096ac634373755f92a2e9b1220df3b2bda5f9eeb
2020-03-17 12:37:27 +00:00
dan
553948e514 Fix handling of window functions in aggregate queries that have no GROUP BY clause. Also remove a faulty assert causing the error reported in [618156e3].
FossilOrigin-Name: 38e3dd389d142e520c71139ec84aa3c7722992af28a5f93a7f16e0ea176b74bb
2020-03-16 18:52:53 +00:00
drh
14c98a4f40 At the end of the right-hand table loop of a LEFT JOIN that uses an IN
operator in the ON clause, put the OP_IfNoHope operator after the
OP_IfNotOpen operator, not before, to avoid a (harmless) uninitialized
register reference.  Ticket [82b588d342d515d1]

FossilOrigin-Name: 8b437b47266ec2d80d85eafcfdd6949556d6c28d9d67d5f43d89799f0f5b7bd0
2020-03-16 03:07:53 +00:00
drh
ba25c7e29f Remove stray comment characters at the end of an #ifdef that were
accidently left in the previous check-in.

FossilOrigin-Name: ea914bec81c49625072fc9d23faa048300f3a0421e069d303b7203edcdfb3743
2020-03-12 17:54:39 +00:00
drh
576d0a9fd9 Fix comments and strengthen assert() statements associated with the
OPFLAG_SEEKEQ and BTREE_SEEK_EQ flags.

FossilOrigin-Name: 231749213854756b599b33413b17b35186f17889b0c73f109fa9db726b415558
2020-03-12 17:28:27 +00:00
drh
e31f00bbef Merge enhancements from trunk.
FossilOrigin-Name: 4945a66237fa3861bc691d5fbef0d40286b596a0902b4f4c032d1d6528bb1a1b
2020-03-11 20:03:22 +00:00
drh
2267a7fa87 Do not factor out constant functions into the initialization section of a
prepared statement, because even though they are constant, they can still
throw exceptions.  Instead, put such functions in an OP_Once block.  This
fixes ticket [3c9eadd2a6ba0aa5] and causes COALESCE() and CASE...END to
be short-circuit.

FossilOrigin-Name: c5f96a085db9688a09793f52ce1ecf033c2e6e2e5873a19fe0fb374b242b317f
2020-03-11 19:56:26 +00:00
drh
9b258c54e4 Rename sqlite3ExprCodeAtInit() to sqlite3ExprCodeRunJustOnce().
Other changes to make the new code cleaner.  Test cases added.

FossilOrigin-Name: d7f18489978fdbbe3ab317485518cac91a75416ccef55898301afdd76d3b415b
2020-03-11 19:41:49 +00:00
drh
38dfbdae8a Do not factor out constant functions into the initialization section at the
end of the prepared statement, be cause if they throw an exception, it will
abort the statement even if the function is never called.  Better to put
constant functions in an OP_Once block.

FossilOrigin-Name: 97a18a5cd701848a9660385e31bffe2c397e3cfe57ccdb876f44d08c00d1d39a
2020-03-11 17:58:27 +00:00
drh
8d5cea6b61 This variant to the fix for ticket [e0c2ad1aa8a9c691] uses fewer CPU cycles.
FossilOrigin-Name: fb5a8a9edd0a4f979d6c30278d4ddc73c651f56ae989b4e5983fca36887c5ceb
2020-03-11 02:04:15 +00:00
drh
2e51dc6c9b Merge updates from trunk.
FossilOrigin-Name: e05f743f619a6b60d0782ee85c73f6866696962954d7cb3eceb03af79c6a6189
2020-03-10 22:55:51 +00:00
drh
e7375bfa72 Enhanced detection logic for preventing the use of static schema expressions
by code generating routines.

FossilOrigin-Name: 5f60b527b938c0778e8f725c635ce0dc5ed7a4e01fd6252aa2cdb64da2f625bc
2020-03-10 19:24:38 +00:00
drh
5cf1b611a2 Further changes to ensure that expressions held in table and index definitions
do not get passed down into code generator logic where they might be modified.

FossilOrigin-Name: f45f5de000834da5b23cdcf12c3f0e3073287756afe06bdb77b95fb65b250258
2020-03-10 18:55:41 +00:00
drh
24e399038b Make a copy of the expression that defines a value of a generated column
before sending it to the code generator routines.

FossilOrigin-Name: 03d201c041c17579e791c73fe6babd60b9f892a84ffd1470851f8eb2857d3990
2020-03-10 13:35:04 +00:00
drh
0c76e892d9 Apply the correct affinity transformations when pulling values off of the
sorter index used for GROUP BY.  Ticket [e0c2ad1aa8a9c691]

FossilOrigin-Name: 101f7dea75a203f1f3aa422a607ef701eb0901ba4d5e8d1075cd350454a61956
2020-03-10 11:50:43 +00:00
drh
088489e8d9 The sqlite3ExprCodeFactorable() routine should make a copy of non-factorable
expressions, as they might be coming from a DEFAULT or generated column
in a table constraint.

FossilOrigin-Name: a2d6f108c5d07559b125823a04c9cb072c80be80d7913097891a6192c7e1e225
2020-03-10 02:57:37 +00:00
drh
9d33d9e7ac Background work for experiments trying to enhance ANALYZE so that it runs
off of samples of the entire index and does not need to read the entire
index.

FossilOrigin-Name: 29d1cc5c3619a88229f18c3c8131228f8a2d151ac3d9203f0c7fc538a996ecec
2020-03-10 01:24:13 +00:00
drh
afa1ecac9b Cleaner separation of the STAT4-specific logic in the implementation of
ANALYZE.

FossilOrigin-Name: 3df07e5a9a3781a4cf866fc6ee0e5c6f9cd7ca35ce0a6eb3aa7f5f3502e0ffae
2020-03-09 18:26:11 +00:00
drh
ccb3781673 Enhancements to the ".import" command of the CLI.
FossilOrigin-Name: cab1834cfc71f71bfed3c5170a0ba40a39385c3b2c50b7c6b6f09cc830dd1b1e
2020-03-09 15:39:39 +00:00
pdr
45dc9ca46b Fix typos in RowSet.
FossilOrigin-Name: 86465c08f4d629a296332a7985937326ac43ea2822c5651bf03862cd79d370fc
2020-03-09 03:21:33 +00:00
drh
ed5e66881e Fix typos in the Lemon documentation.
FossilOrigin-Name: 35f1f151ac478d6b46f3685d2565c35108ef74bd33ce96fb65300d3c303b289b
2020-03-09 01:02:45 +00:00
pdr
db9cb17dc7 Avoid a redundant NULL check
FossilOrigin-Name: 25dc53f6608dd9b8b4e8d8ee22e194a6d41d15811781752797cb42fc22ee1317
2020-03-08 13:33:58 +00:00
dan
0ea2d42ac3 Report an error if the main, or any other, database encoding is modified by an external process (perhaps using the backup API) after the db has been opened.
FossilOrigin-Name: 895bd20b29e223496e1585483c6ce3335ae9050f2e5de4d6b69d0e40df396862
2020-03-05 18:04:09 +00:00
drh
42a630b1da Change the sqlite3.pDfltColl (the default collating sequence for the
database connection) so that it is the collating sequence appropriate for
the database encoding, not the UTF8 collating sequence.  This helps to
ensure that the database encoding collation is always used, even for
expressions that do not have an defined collating sequence.
Ticket [1b8d7264567eb6fc].

FossilOrigin-Name: 4a5851893c3d71cc823b6ab5df5e58a852cd322fff26290f1ea05b63d67f564a
2020-03-05 16:13:24 +00:00
drh
4cf2121e1c When printing the OP_CollSeq opcode for EXPLAIN listings, include the
text encoding with the name of the collating sequence.

FossilOrigin-Name: eb5c1b77d1c55fc286ff8fccfd61e21cb67aec92d6f93b093b9af5c32165d82b
2020-03-05 14:19:49 +00:00
drh
f5cfe6f2c4 Fix a false-positive in the debugging logic that attempts to detect the
use of uninitialized registers inside triggers.
Ticket [c4c56482ced89d90]

FossilOrigin-Name: 0463576b5de0a1ee71530f0e4988fc9cceda79148520bea2c67f1fbc4a99cea9
2020-03-03 20:48:12 +00:00
drh
d346fe0ab5 Remove an invalid assert() on the debugging logic that checks to ensure that
register values are not used after they go stale.  Ticket [d165ad781b39d574].

FossilOrigin-Name: bd94d7d052734460904c687756231f8aa243a2252f07f742dd1e437aa940f536
2020-03-03 20:04:29 +00:00
drh
b3f0d92b91 Improved detection of corruption in the interior nodes of a segment btree
in FTS3/4.

FossilOrigin-Name: cc99447ac923166104e8a7c75088ed95279f4491b30cfa37dc3ee5e005dd9fac
2020-03-03 01:16:04 +00:00
drh
39b3bcf8ef Enhance the fuzzcheck test program so that it is able to simulate OOM errors
in the same way that dbsqlfuzz does.

FossilOrigin-Name: a65c8d4e26b2428ecb8232a4a6a44443aa1701319223397e61a823a5aa1827de
2020-03-02 16:31:21 +00:00
drh
a2ec2e4843 Fix a faulty assert() statement in the stale-register detection logic.
Ticket [da5a09be6dabbf42].

FossilOrigin-Name: 219c296cc8cab13fa12b64c297bc4a98d8e21491309d97a031edf89ae77fce75
2020-03-02 01:50:48 +00:00
drh
7f05d52c4c Ensure that the NULL-scan pass counter is initialized when a ORDER BY NULLS LAST
is used on the right table of a LEFT JOIN.  Ticket [e12a0ae526bb51c7].

FossilOrigin-Name: 704bb9a39acbee420c1d6ac9eb1466a02dd77d3334b938bfddf235973129b5fe
2020-03-02 01:16:33 +00:00
dan
0a21ea997d Fix a problem with window functions occuring within sub-selects that are part of an OR term in a WHERE clause of the outer SELECT.
FossilOrigin-Name: 1e174ed0d29366eb56ad1a0cc8defcb440b426bfd9525aed2f93468248606efc
2020-02-29 17:19:42 +00:00
drh
4a3a3eb3d7 In the CLI, add the ".oom" command for debugging builds.
FossilOrigin-Name: 9c3136a722715952d155aae55cbc6d1fb921c6940d8e7d3e32fcba000f6ac1ed
2020-02-29 15:53:48 +00:00
drh
2826918d10 The RTREE extension behaves has if data columns have type REAL, so we
should actually declare them as REAL so that automatic indexes handle
them correctly.  Ticket [e63b4d1a65546532]

FossilOrigin-Name: 85a9b6a92fd5805d5936f02d555af395441607b9eb5f4dae63560b5e65663b00
2020-02-28 16:04:28 +00:00
dan
9e5ecdc172 In sqlite3changeset_apply(), ensure that DELETE and UPDATE changes are always executed on main database tables, not similarly named temp tables, as documented. INSERT statements are already being handled correctly.
FossilOrigin-Name: f71a13d072398c9fc3556f42d75159cc2d0edc2c42f6c47f64503a7fbbca6e37
2020-02-27 17:16:45 +00:00
drh
be284e4ece Fix harmless compiler warnings from MSVC.
FossilOrigin-Name: 951b39ca74c9bd933139e099d5555283278db475f410f202c162e5d1e6aef933
2020-02-27 16:21:39 +00:00
dan
67e2bb92df Optimization for "SELECT min(x) FROM tbl" where "x" is indexed and NOT NULL. This also allows similar queries on NOT NULL virtual table columns to be optimized.
FossilOrigin-Name: 59726777934e201d94e99ca693f0fda4ebfb1c7883d0258ce542f63f9924c28c
2020-02-27 15:07:16 +00:00
drh
47a60d4518 Extra zero terminators on the end of the blank filename returned by
sqlite3PagerFilename() for an in-memory database.  This helps the result
work better with sqlite3_filename_journal() and similar functions.

FossilOrigin-Name: 63e533d28e87bbb10e0c611de4b79d22aae291b163fe59d1f95dcad9ab3939e4
2020-02-27 13:54:18 +00:00
drh
df97d43930 Ensure that the filename passed into the xFullPathname method of the VFS is
acceptable as an argument to sqlite3_uri_parameter().  The interface spec does
not guarantee this, but it has been so historically and some applications
have come to depends on it.

FossilOrigin-Name: bfb09371d452d5d4dacab2ec476880bc729952f44ac0e5de90ea7ba203243c8c
2020-02-27 11:32:14 +00:00
drh
a8781d9d93 Update the fuzzcheck test module so that it avoids inserting text values
that contain embedded NULs in the XSQL table.  Fix some legacy entries in
the test/fuzzdata8.db that had embedded NULs.  Add in new dbsqlfuzz cases
that have accumulated over on the dbsqlfuzz project for a while.

FossilOrigin-Name: 47d4240c4a837e829f593bb2aad7563010838f55345e7a0d8e2ea79462aeeb3c
2020-02-25 20:05:58 +00:00
drh
f575c1cf06 If STAT4 determines that a WHERE clause term that is not used by an index
has very high probability of being true, then do not use that term to reduce
the estimated output row count.

FossilOrigin-Name: 40739c793b0e98a3bae296d3a1f74944edcdd4cc33c26b417fde4eaf6f14d062
2020-02-24 17:05:09 +00:00
drh
f06cdde2cf Rework this changes so that instead of setting the WhereTerm.truthProb when
a term is seen to be of low selectivity, it merely sets a new flag
(the TERM_HIGHTRUTH flag) which causes whereLoopOutputAdjust() to ignore
that term.

FossilOrigin-Name: 4558163b6a525990f0f1b6629dbb76daf49bcaf1ddbaf0c50fe05ce9ee480ff8
2020-02-24 16:46:08 +00:00
drh
35d3cb80c4 Disable the new analyzeG.test module if not building with STAT4.
FossilOrigin-Name: 4a9d3005769e0398183b03a3e132e3946b9d1c48073af2e0559d7beeac3245c0
2020-02-24 13:35:34 +00:00
drh
2ed1b0e753 Merge bugfix from trunk.
FossilOrigin-Name: b542dee9de843c19664c19df7435c6034d23d0d213804d588ec0ff599082d576
2020-02-24 13:26:29 +00:00
drh
0990c415f6 Fix a problem with ALTER TABLE for views that have a nested FROM clause.
Ticket [f50af3e8a565776b].

FossilOrigin-Name: c431b3fd8fd0f6a6974bba3e9366b0430ec003d570e7ce70ceefbcff5fe4b6fa
2020-02-23 17:34:45 +00:00
drh
cea1951e80 Do not activate the truthProb adjustment mechanism if the truth probability
is less than the heuristic value, as there could be correlations unknown to
stat4.  Also add additional tracing output to make truthProb adjustments more
visible.

FossilOrigin-Name: c535fea147ce5c6e4aab25d3c85a3f53a7364c5b5ee10fb6d393c5911a02be7e
2020-02-22 18:27:48 +00:00
dan
5c19346451 Add new test file analyzeG.test, containing a test for the change on this branch.
FossilOrigin-Name: 243ab1852a2291595527ea1f26e78ad83eda285ae28f876bc1c703677f495cfa
2020-02-22 17:32:00 +00:00
drh
89efac94fd When stat4 information is available, try to use it to improve the truth
probability of WHERE clause terms that do not participate in the index.

FossilOrigin-Name: 1babd6ec5d60e2c34aa1c0285ead768a88004218468e97262411973fe3487022
2020-02-22 16:58:49 +00:00
drh
e8c4f03266 In the OP_Column opcode, if the cursor is marked NullRow (due to being the
right table of a LEFT JOIN that does not match) and the cursor is the table
cursor for an OR-optimization with a covering index, then do not substitute
the covering index cursor, since the covering index cursor does not have
the NullRow flag set.  Ticket [aa4378693018aa99]

FossilOrigin-Name: f02030b3403d67734bba471a91ad5bfdb03ddf6fdc3ef14808a04495e43b0470
2020-02-22 13:01:19 +00:00
dan
8a64d62d31 Add test case for previous commit.
FossilOrigin-Name: 14d14eb537075c6ac77513b1e7305bed8bc01a9034dfb763fd96f76400f2b705
2020-02-20 14:11:08 +00:00
drh
5f69512404 Early-out on the INTERSECT query processing following an error.
FossilOrigin-Name: a67cf5b7d37d5b1484be32092635faafd8f76e5881898cd9435517c4b287d663
2020-02-20 14:08:51 +00:00
drh
1cfee74a28 Fix a potential NULL pointer dereference following OOM. Problem discovered
by dbsqlfuzz.  Test case in TH3.

FossilOrigin-Name: 5aeb5a2d295e10d5fc1d456b3acaf8ac13c04cb5bb71a8c4571541d366e95887
2020-02-19 15:39:46 +00:00
drh
4b9e736898 Remove a NEVER() macro and add a test case to cause its argument to be true.
FossilOrigin-Name: ee034fe916448e953ee7824e5c0db99a36a0ad138ebfb25f751bf84cb80a8fa7
2020-02-18 23:58:58 +00:00
drh
4defdddc31 Add the new sqlite3_create_filename() and sqlite3_free_filename() interfaces
for use by Shims.  Use these interfaces inside the multiplexor.

FossilOrigin-Name: 9469f36ac89e4b75d0ab25fefbeff25201992c53141da915dcaa017083cab6db
2020-02-18 19:49:48 +00:00
drh
0184a256e3 Convert invalid surrogates to 0xfffd when translating UTF.
FossilOrigin-Name: 7fab1393c2b22b1f3b159b631e06e7e0d3900850ee249c38e4d3cdd0aacf637e
2020-02-17 23:08:16 +00:00
drh
78d1d225d8 A better (smaller and faster) solution to ticket [4374860b29383380].
FossilOrigin-Name: abc473fb8fb999005dc79a360e34f97b3b25429decf1820dd2afa5c19577753d
2020-02-17 19:25:07 +00:00
drh
bf48ce49f7 Take care when checking the table of a TK_COLUMN expression node to see if the
table is a virtual table to first ensure that the Expr.y.pTab pointer is not
null due to generated column optimizations.  Ticket [4374860b29383380].

FossilOrigin-Name: 9d0d4ab95dc0c56e053c2924ed322a9ea7b25439e6f74599f706905a1994e454
2020-02-17 00:12:04 +00:00
drh
ac9e184e1f Avoid an infinite recursion on an illegal recursive definition of an
fts5vocab table.

FossilOrigin-Name: 109ee07433b274a39954cef62bf67d47bcda960df9bef56127210ebf1c3c104c
2020-02-16 17:40:35 +00:00
drh
fdfd45aef3 Fix problems in the constant propagation optimization that were introduced
by check-in [1c3e5c20a9e6f501].  Fix for ticket [1dcb4d44964846ad]

FossilOrigin-Name: c9a8defcef35a1fee6bcbb88252a2d0076dabe8381b0128b2257b5b5cc494e0f
2020-02-13 22:12:35 +00:00
drh
ab7fdca2ee Disallow the skip-scan optimization in the absence of sqlite_stat1 data.
FossilOrigin-Name: e0c6b8bdb76fcd4f08c89ff20dce6a33ef3c11752e1e919fec5c4e7d423c4b93
2020-02-13 14:51:54 +00:00
drh
0ba3621592 Omit O_NOFOLLOW from the open() call when opening /dev/null, since /dev/null
is a symlink on Solaris, we are told.

FossilOrigin-Name: 0c683c43a62fe25c6cb765e4a31556ec91a7c21af79349b3d7eeb13f73dd1cdc
2020-02-13 13:45:04 +00:00
drh
77c9b3ccb3 Fix an incorrect assert() statement that was added yesterday.
Tickets [41c1456a6e61c0e7] and [fb8c538a8f57ae2a].

FossilOrigin-Name: abfb043ebb0c55fdc2be58255bc852b13865d81fa4c2e0dbe8c375810557aafe
2020-02-13 11:46:47 +00:00
drh
efdba1a8b3 Increase the default upper bound on the number of parameters in a single
SQL statement to 32766 (from 999).

FossilOrigin-Name: 2def75693a8ae002375aff80db0e6c970c75f75e8b6ba64f2c518712badb0ae8
2020-02-12 20:50:20 +00:00
dan
41aa442cf4 When determining whether an == or IS constraint in a WHERE clause makes an ORDER BY term redundant, consider the collation sequence used by the == or IS comparison, not the collation sequence of the comparison expression itself. Possible fix for [fb8c538a8f].
FossilOrigin-Name: 16aed5d0c63dcdc2054dbb8a4b6b992476640433bf81e19301e6db5a3fc82633
2020-02-12 11:57:35 +00:00
drh
df9b5cab93 Mark the sha1() extension function as SQLITE_DETERMINISTIC.
FossilOrigin-Name: 7d8dcfb95cea732e7588e7505bf80a171dd2e371b164c9435c6ac286060df6df
2020-02-10 19:24:49 +00:00
drh
b6664744c0 Fix the build for when SQLITE_VDBE_COVERAGE is used.
FossilOrigin-Name: 084381649edf374ccc5664f136055109a31d4c3a19c4ae2ee5275f630507a2a3
2020-02-10 13:29:10 +00:00
drh
dc4f6fc099 During byte-code generation, strive to avoid jumps that merely jump to the
following instruction.

FossilOrigin-Name: bcf876e67e75f6709f2b25683a3952bbbb87c672bb9d7af456feebc0ab9f6c31
2020-02-07 19:44:13 +00:00
drh
b48c0d59fa Simplify the code by removing the unsupported and undocumented
SQLITE_HAS_CODEC compile-time option

FossilOrigin-Name: 5a877221ce90e7523059353a68650c5fdd28ed032807afc2f10afbfbf864bdfe
2020-02-07 01:12:53 +00:00
drh
c84ad31851 There is no need to keep track of the number of changed rows or of the
last-insert-rowid while running VACUUM.

FossilOrigin-Name: a8a7c05b16f6c73ac55c359fbf62cae4a76eb0d105a3c53e9f47cede9fd85916
2020-02-06 20:46:08 +00:00
drh
0de19cac43 Unroll the comparison loop inside keywordCode() for to avoid unnecessary
comparisions and thus help that routine run faster.

FossilOrigin-Name: cec5f920f5c2a963f88329a08a443fc04be2dd6f7f2d840be63c0ab1de898f0a
2020-02-06 15:38:43 +00:00
drh
c879c4eac0 Separate OP_IdxInsert and OP_SorterInsert into completely separate opcodes,
helping each one to run a little faster.

FossilOrigin-Name: 447d71f0867a11f789eba164ea77470b3ae4953927556304b0861cf690250776
2020-02-06 13:57:08 +00:00
drh
5bdad79f01 Remove dead code from the sqlite3_filename_database() function.
FossilOrigin-Name: 1b6185550f2bcfa11513898984f1fc2029e0356e9acdc786c5c4a8006b1da2ba
2020-02-06 13:09:56 +00:00
dan
fcbc673752 Fix some fts3 problems found by usan.
FossilOrigin-Name: fb7ccf61bed8d862986eda7096bec3df5947f1d1c88f27e7d9c8acf420f40c50
2020-02-06 10:55:10 +00:00
drh
2a74006087 Small size reduction and performance improvement in the
sqlite3VdbeMemFromBtree() interface used to pull content out of the b-tree
and into an sqlite3_value object.

FossilOrigin-Name: ae6dd8d3e921670ee6450453b54245dd71bcfff3fd1bc7fdb7cf4cf9585c3375
2020-02-05 18:28:17 +00:00
dan
3cdc820544 Enable more detailed log messages in SQLITE_ENABLE_CORRUPT_PGNO builds if database corruption is encountered.
FossilOrigin-Name: 57c36a293e16bb4d9652874124ee1447bef278e08664bc8dd0070a0ee2ef1173
2020-02-04 20:01:44 +00:00
drh
92a27f7bf2 Extend the OP_Copy-coalesce optimization fix of check-in [b36126c1889e323c]
so that it is also correctly disabled by the CASE operator.
Ticket [9d3666754ac37d5a].

FossilOrigin-Name: 29a969d6b1709b80d9cb88b60971e4eb021f7f5f8ee9a619be74b833a78a35ef
2020-02-04 01:41:44 +00:00
drh
40d1db8d20 Fix a problem with the byte-code decompiler that was inserted by the
enhancements at [4248980a356f659b]

FossilOrigin-Name: af63e95dcdd6e9741cdddc3698e857e3b8be40048d3036f939f3583e517c4eff
2020-02-04 00:55:27 +00:00
drh
51f37b2bb8 Cosmetic change to the xfer-optimization to put the OP_RowData opcode closer
to the corresponding OP_Insert opcode.  This makes it slightly easier to read
and understand the code.

FossilOrigin-Name: 0ea2dbfc9088561d62c3456803cb08d357e4e60f1d21f6ed37315564be4957d3
2020-02-03 19:56:51 +00:00
drh
081ce2042c Increase the version number to 3.32.0.
FossilOrigin-Name: 8130bbb4217bd4a4db1f6bf97115a60bee8b29943bed0c7bdf54bba5edbed8fc
2020-02-03 12:25:18 +00:00
drh
9dce0ef4ca On an INSERT or UPDATE, perform affinity conversions on new data prior to
running CHECK constraints.  Ticket [86ba67afafded936].

FossilOrigin-Name: 1d4f86201dab9a22df9ef8175a7ebf3640e97cdb23a06fb454b4c69bfda3a9af
2020-02-01 21:03:27 +00:00
drh
d7b10d74e1 Fix the comment display for the OP_Function opcode. And at the same time,
improve the comment generating logic to make use of the newer
sqlite3_str_appendf() interface.

FossilOrigin-Name: 4248980a356f659b10b12c778592996d53c91fae4ea50c8566678da176bdd152
2020-02-01 17:38:24 +00:00
drh
745befd13f Merge the sqlite3CodecQueryParameters() fix into trunk.
FossilOrigin-Name: a812f533693a3605f297199ae0320d663e872208675e86860c5c1803943943aa
2020-02-01 14:20:35 +00:00
drh
1eac966076 Fix a problem in sqlite3CodecQueryParameters() that was introduced by the
query parameter encoding changes for the 3.31.1 release.

FossilOrigin-Name: cc65ca541265bd7061ed8f5ec9a54f3c384c41019c5ea1c68dcaabeff3495839
2020-02-01 13:30:39 +00:00
drh
7aedd5d70b Fix a minor typo in a comment in the btreeinfo extension.
FossilOrigin-Name: b5a66d10f4bbaf10def7b50b9ed98b05b41bb2c2af5ab9a90f6cda61169ab123
2020-01-31 14:52:19 +00:00
dan
d03f77ae46 Fix a problem with the processing of IN(...) constraints handled by virtual table implementations that do not set the "omit" flag when the virtual table column contains at least one NULL value.
FossilOrigin-Name: dcb4838757ca49cf149a6e883b3eb0ac8a075147387a078280dfabe39b1a3e8d
2020-01-29 15:03:01 +00:00
dan
759e9cc064 Add a test case for commit [ffd8bb93].
FossilOrigin-Name: bcd5b37b8ebd67537f60c0061fcbc70b2aebebb88d6fb842ccf321a3e20c122c
2020-01-29 13:56:35 +00:00
drh
48118e4060 Remove a NEVER() that is in fact reachable. Test cases in dbsqlfuzz and TH3.
FossilOrigin-Name: ffd8bb9351fbd8c1285491d4e10734f6816689de6042d640c178a5ecda75a5ef
2020-01-29 13:50:11 +00:00
drh
ffd3fd0c30 Add new memory barriers during initialization.
FossilOrigin-Name: a9b2adc5d61790abd86839d12e7ecb98a85d7e4cde5f94558530e32449d9e483
2020-01-29 13:10:50 +00:00
drh
9ca9a53a42 Modify a couple of FTS test cases so that they work on big-endian platforms.
FossilOrigin-Name: b20503aaf5b6595afafee6aa2bc6276354a62b0f583f6d94e31fedfdfc130347
2020-01-29 12:37:59 +00:00
drh
02a95eb9bb Faster decoding of 32-bit variable-length integers in cases were we do not
need to know the number of bytes in the encoding.

FossilOrigin-Name: 59a31b16b54a0068c81ee65bc2fa905c2c826e98da3a7ffd8c3ea860a2827b4a
2020-01-28 20:27:42 +00:00
drh
925ab5c17e Small performance improvement to the key-comparision routine for strings.
FossilOrigin-Name: 41454499a2b63c5fe6fae2d2085773a5f7d869250dcbe669929d20c961211f70
2020-01-28 20:09:39 +00:00
drh
fbfd113365 Reinstate the optimization of converting "a IN (C)" into "a=C" but only
if C is a constant.  If the RHS is a table column, the complications of
managing affinity and collations become too involved to mess with.

FossilOrigin-Name: 8ac26a23d7f0ef29c5eb007c7467181f8b96102c8600ea8a5b15cc7584af27bd
2020-01-28 18:09:53 +00:00
dan
4b2f45be34 Fix a 4 byte OOB read in test_multiplex.c.
FossilOrigin-Name: 912148913c11d98e48119a2c1fa7a0e52f318af36e7e2491d968ffde286c949f
2020-01-28 16:55:32 +00:00
drh
b9f2e5f777 Minor change for compatibility with the s390 architecture.
FossilOrigin-Name: 04885763c4cd00cbca26d048f2b19316bfc93e8edebeceaa171ebfc6c563d53e
2020-01-28 15:02:23 +00:00
drh
562fd18b9d Version 3.31.1
FossilOrigin-Name: 3bfa9cc97da10598521b342961df8f5f68c7388fa117345eeb516eaa837bb4d6
2020-01-27 19:55:54 +00:00
drh
f54f105446 Update the version number to 3.31.1.
FossilOrigin-Name: 6fb9a8fb85486a8fccc462856316ef523450c23a7a7a81c8dfb323fbe809f8f5
2020-01-27 17:09:02 +00:00
drh
532b0d23fd Revise the layout of filenames in the Pager object so that it is unchanged
from prior versions.  It turns out that some important 3rd-party software
does questionable pointer manipulations on those filenames that depend on
that legacy layout.  Technical this is a misuse of SQLite by the 3rd-party
software, but we want to avoid unnecessary breakage.

FossilOrigin-Name: 34ab760689fd493eda482e856047708d74e769a01cc90b69da456d79ffe39aea
2020-01-27 14:40:44 +00:00
drh
9a3bdeba3e Fix typos in the sqlite3ext.h header file that prevent some newer APIs from
being accessed from loadable extensions.

FossilOrigin-Name: 14331989fcaf6591336290ed1548e9c90f0f153e27f456f4c30c966f9c23aa6e
2020-01-23 15:00:18 +00:00
mistachkin
8122c6e9be Fix variable declaration issue seen with MSVC.
FossilOrigin-Name: 8a6fe3066cf0599fcf2960e8fb3ae39e4e7a61ec81e8ec71d0b5910aee2c16f6
2020-01-23 00:08:25 +00:00
drh
78b5220328 Fix a NEVER() macro that can be true if compiled with
SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION.
Ticket [b985f0bd1636d9bc]

FossilOrigin-Name: 9f0f5d593a383ec2bebb6513ad566813f5b3dc6f052c61bcd76e8ac557bbb062
2020-01-22 23:08:19 +00:00
drh
1a3220ace6 Version 3.31.0
FossilOrigin-Name: f6affdd41608946fcfcea914ece149038a8b25a62bbe719ed2561c649b86d824
2020-01-22 18:38:59 +00:00
dan
d0add948ea Update test file exclusive.test so that it works with the "journaltest" permutation.
FossilOrigin-Name: 4daf94d83319231e42243625c804d5db2d14f10fa5ea1a1f358c3603c47b955b
2020-01-21 16:31:26 +00:00
dan
8c812f98a3 Fix a problem with using views in SQLITE_OMIT_VIRTUAL_TABLE builds. Also some test case fixes required for the same builds.
FossilOrigin-Name: 934ee8bdb481a5cbd3d9c5f53028073129d3bca4fee14fe4a49bbf9c0c9d74f7
2020-01-21 16:23:17 +00:00
dan
7d2a1be84b Fix a case in fts3auto.test that fails for SQLITE_DISABLE_FTS4_DEFERRED builds.
FossilOrigin-Name: d241055ead935f0e461a67f483788bcd59f7e8d65ade54b9c7c7c4fec9414102
2020-01-21 15:01:14 +00:00
dan
70a32703ac Fix an assert() that could fail in SQLITE_MUTATION_TEST builds following an error in a query that uses CTEs.
FossilOrigin-Name: c7e29458a73bbe73a1429477d0c01d5a7b870ab75d3cb08a703be21714e439b7
2020-01-21 14:42:48 +00:00
dan
39ef8b31fb Fix a problem in the userauth extension causing it to occasionally set "PRAGMA count_changes" (and some others) to true.
FossilOrigin-Name: 3a62f64222ebd176c06e89b9fe5275b7b1f09df0afbae1c5c148a4e527e9d80b
2020-01-21 13:40:35 +00:00
drh
988af251d8 Fix the series.c and spellfix.c extensions to use SQLITE_VTAB_INNOCUOUS
correctly.  Fix the documentation on sqlite3_vtab_config() to take into
account SQLITE_VTAB_INNOCUOUS and SQLITE_VTAB_DIRECTONLY.

FossilOrigin-Name: 9265cb7f026c0e959bd034d4cd94fe597744e0dd455d0a20736ee5f5bee880c8
2020-01-21 12:29:02 +00:00
mistachkin
cbf1c8c25b Improvements to the autoconf TEA Makefile for MSVC.
FossilOrigin-Name: cffcf12f03906debeac6a974534b4439a4952cc72767e3bcb8e6d91da944d69f
2020-01-21 01:45:27 +00:00
drh
be03cc9fcf In the fuzzcheck test program, reduce the default expression depth limit
from 1000 to 500 to avoid stack-overflow problems when running stress tests
using clang ASAN.

FossilOrigin-Name: 63d886f4ce3c770498b8bdad45b04143a3f63197d81793bde107450aba4a9c87
2020-01-20 14:42:09 +00:00