Commit Graph

23039 Commits

Author SHA1 Message Date
dan
5daf69e5f4 Allow sub-queries in the FROM clause of an UPDATE...FROM statement to access the object being updated without using an alias, as is required in the parent query.
FossilOrigin-Name: 740cb43025449b7d7b47a97ad00885e54b7701cbcb14f4a50c7523022e3936d5
2021-07-05 11:27:13 +00:00
drh
e46292a920 Improved rebustness in sqlite3ExprListDup() when it contains a vector assignment
from an UPDATE where the initial term is omitted.  This can happen during a
UNION ALL query flattening while processing a virtual table update in which
the first term of the vector is repeated.
[forum:/forumpost/16ca0e9f32|Forum post 16ca0e9f32].

FossilOrigin-Name: 2547cfe38f8fb35109b3fc5bdfada387fe4b2b8a304156b704ab7f03f1f71198
2021-07-05 02:40:29 +00:00
drh
10f08270e1 Ensure that TK_SELECT_COLUMN Expr nodes always have their iTable field set to
to the number of columns in the vector. This is not strictly necessary. It
just simplifies the state description and make the code easier to reason about.

FossilOrigin-Name: 026f08d4cff19a95e0f38f2ef431cacd65c7c77ed92e30d7f2ded84651f47150
2021-07-05 01:11:26 +00:00
drh
105c4b5ced Fix an incorrect comment on testcase misc1-27.0. No changes to code.
FossilOrigin-Name: 49829ae3229b7c7c7adeaa970a84aebd5157bc93b38fd6d80d86cc03f5fdde6f
2021-07-05 00:07:39 +00:00
drh
4a4e02bc52 Enhance the treeview debugging mechanism so that it correctly deals with
TK_ROW expression nodes.

FossilOrigin-Name: e87fdb6514b6f6775a5a36ca0ec5c920eeaba9e3b842dffa327e970b27cd036d
2021-07-04 22:33:08 +00:00
drh
24384d88d6 Fix a (harmless) typo in a comment. No code changes.
FossilOrigin-Name: d2b9b8daa3b87c3dba1329e2f2f44b60d6b5bb9a49d741045aa20cc7813446b2
2021-07-03 18:57:40 +00:00
drh
5c46a7e555 In the PRAGMA foreign_key_check, ensure that sufficient registers are
allocated for the virtual machine, even if one or more foreign keys reuses
the same column multiple times and has more columns than the table it is part
of.  [forum:/forumpost/a6b0c05277|Forum post a6b0c05277].

FossilOrigin-Name: 68db1ff9c44fa9c37690ce55ad304d4263ba6fac490063d9e08470de6c17cfe6
2021-07-03 02:55:47 +00:00
drh
dd51365408 Put ALWAYS() on a branch that is always true due to [d4097364c511709b].
Fix a testcase precondition associated with the same check-in.

FossilOrigin-Name: 55e2fbebb0a2c9991feef46f31e79b82a24de272aae836bf4d3c06ee06ef1a70
2021-07-02 12:25:30 +00:00
drh
4d466698a2 Fix a harmless assertion fault discovered by
[https://oss-fuzz.com/testcase-detail/5517690440646656|OSSFuzz].  The
assertion fault is harmless because the assert() checks a condition that
that is harmless if false and the assert() is disabled in production
builds.

FossilOrigin-Name: 79443aabe1db8cc2ff9537fde0dac0e858eae3f3848ee9cc1b8fba47b824bf08
2021-07-02 12:08:12 +00:00
dan
b9248ef5c7 Allow unqualified "rowid" references to be used in join queries, provided that only one of the source objects has a rowid.
FossilOrigin-Name: d4097364c511709b1874881a0c036640777d1f724165416adf6f53a41f8c6e40
2021-07-01 18:19:17 +00:00
drh
3832ac9f51 Import the updated nmakehlp.c file used by the TCL Extension Architecture (TEA)
builds in the amalgamation tarballs.
[forum:/forumpost/5a5001f20a|Forum post 5a5001f20a].

FossilOrigin-Name: 595bf95bf8884c545e85e3feee6f43503b59d3c6d69073f0aaba4473c7c61cac
2021-07-01 16:57:48 +00:00
dan
90d3b24a16 Fix a memory leak in fts5 that could occur when processing a query containing multiple classes of error.
FossilOrigin-Name: 7c279670f544a5bb9733a88862d9e490062b07415cd790e0d6d1e2cb584d2007
2021-06-30 14:04:25 +00:00
dan
c629e21786 Fix an assert() in fts5 that might fail when dealing with corrupt records.
FossilOrigin-Name: 9e760e256089c0ebbf816a8de8b186f62e1ffcd6b8b0e76dab8387798cd4d0e1
2021-06-30 12:11:19 +00:00
drh
14a1b1c132 Do not enforce the SQLITE_LIMIT_FUNCTION_ARG limit for internally generated
SQL.  This prevents problems with statements like ALTER TABLE if the
function argument limit is set too low.
[forum:/forumpost/17735aa21f3ddab2|Forum post 17735aa21f3ddab2].

FossilOrigin-Name: 763fdec5b3151eeab001c50e78f654cd9b4b4c10e81e50a663046a70e64d5339
2021-06-30 11:53:21 +00:00
dan
cf1e25566b When generating data for a RETURNING clause, avoid assuming cursor number 0 is available for use.
FossilOrigin-Name: 4b2c59acce6ff1bb6c9c04c45c80945ae23a26588718cc20635d60f7497adabb
2021-06-28 15:25:17 +00:00
drh
4422b3a646 The OP_ReopenIdx opcode should clear the cursor if the cursor is being
reused.  This prevents leaving the cursor in an initialized state which
could cause problems for a subsequent OP_SeekScan opcode.
Fix for ticket [6dcbfd11cf666e21] and the OP_SeekScan optimization
of check-in [4a43430fd23f8835].

FossilOrigin-Name: d4bf5243f2bf0a2bc77ad12f3e1e4797cb62f2745f9d54eee5f675c3b5f80880
2021-06-25 14:48:24 +00:00
drh
81640a226e Remove a redundant "ANALYZE" line from the ".fullschema" output.
FossilOrigin-Name: 7b47f420954000ce46d05adde6e91a2fbdab8dd528ebd8089cca4fcf9d8a3605
2021-06-25 11:21:21 +00:00
drh
69935c0935 Fix a bug in the ".fullschema" dot-command of the CLI brought to light by
check-in [a2ddb89b206c1387] - raising an error on at attempt to access the
rowid of a subquery or view.

FossilOrigin-Name: 36875827a416067e1b8ffba0ff0ff88313177f8d84dd8e5bc9c23ea3f2d587ba
2021-06-25 11:14:10 +00:00
larrybr
83cb9eb48e Document sqlite3_wal_hook() return.
FossilOrigin-Name: 8acaf7964551b4524fcdbb8d01fae7b0911508ecf6dcf23c3e0f8d8c790b78d8
2021-06-25 00:25:38 +00:00
drh
dff34ab96f Allow the SQLITE_OPEN_EXCLUSIVE flag in sqlite3_open(). Return the
SQLITE_CANTOPEN_EXISTS extended code to indicate that the open failed because
the database already exists.

FossilOrigin-Name: d091150ff80709a1e50e0431aa33021f036979e4a88e9769eeec431dfad6d5f5
2021-06-24 18:23:54 +00:00
larrybr
c06836c3b1 Make conditional nature of sqlite3_normalized_sql() better known.
FossilOrigin-Name: 0e0ece7111945d61278e60385f883303b593ed0d64beeb951b9c49f243531628
2021-06-23 17:41:38 +00:00
larrybr
10496f7657 Fully incorporate *_changes64() API improvement.
FossilOrigin-Name: 6699a2f6bec9dfcdc456ff1cd8e652588b144ec28b7eac6e403a63eab61b416e
2021-06-23 16:07:20 +00:00
drh
9b9f235165 Show CROSS JOINs in the TreeView debuggingn output.
FossilOrigin-Name: 72e09b6c9b74c8226b231fec021228af6bc191fc1b5798d0ff2e893f4ba203bf
2021-06-23 11:39:00 +00:00
dan
a261c02d44 Fix a problem handling ORDER BY terms of the form "ORDER BY likely(<integer>)" within window frames.
FossilOrigin-Name: 710f75b98bb4ac5bfdfa745c1de832dd1e4d9fb387da52b2f0d1353613f5cdc3
2021-06-23 11:12:48 +00:00
drh
415ac68ae8 When an index is used by all branches of the WHERE_MULTI_OR optimization and
becomes a covering index, make sure the index has been created prior to
NULLing it in the OP_NullRow opcode of a LEFT JOIN.  See
[forum:/forumpost/0575376e07|forum post 0575376e07]. The covering-index for
WHERE_MULTI_OR optimization was added by [62678be3df35cdcb].  Test cases are
in the orindex01.test module of TH3.

FossilOrigin-Name: 787c76a865dc51dbca4f30432d64783199c2efb1df4619e4bbaf32182977321e
2021-06-22 23:24:58 +00:00
dan
2c7188732d Add the sqlite3_changes64() and sqlite3_total_changes64() API functions.
FossilOrigin-Name: 48fdec22c966003f5577e0bf52906ef90df11e4e395723a646304e67ed976f37
2021-06-22 18:32:05 +00:00
dan
020c4f3830 Fix a problem causing sqlite3_changes() to return an incorrect value following a "DELETE FROM tbl" command on an intkey table (because internal b+tree cells were being included in the count).
FossilOrigin-Name: f662ff4746aaa43e63e20710b8cbfeeceab3183e953ac1685c41846d2e9d124c
2021-06-22 18:06:23 +00:00
dan
b9f8a187de Ensure that the cell array used in balance_nonroot() is always large enough, even if the pages being balanced are corrupt.
FossilOrigin-Name: 53f64e83b39cb56ac7211ffc80d06da13318e1da9dbca7b9123954f5be229a0d
2021-06-22 14:59:34 +00:00
drh
4d2c20331a Load recent dbsqlfuzz cases into test/fuzzdata8.db.
FossilOrigin-Name: a766bba0eead47e9ff24b6afd152a7fbd331261e04dd76feb9510585a08c5786
2021-06-20 22:52:51 +00:00
drh
b915418134 Remove a NEVER() that is reachable by a corrupt database.
dbsqlfuzz 8456a0f88e39a49fb675d8f77394979ebb2a03c1.  Test case in TH3.

FossilOrigin-Name: 1c41e86fa102ec2b73fb7a55357ba6328fda37af316215e8808be88e2d1fd75f
2021-06-20 22:49:26 +00:00
drh
41d26396bb Do not allow an SQLITE_CORRUPT error to mask a prior SQLITE_IOERR in
balance_nonroot().  dbsqlfuzz 5e1c86e7f18023f2b9abe3429977d7ea726f50d8

FossilOrigin-Name: 50e818767e423991b99b3155cb15a0d1c1b744ab6139a8273f9348aab9a53d9c
2021-06-20 22:17:49 +00:00
drh
5d8ade1f67 Remove unnecessary (redundant) variable initialization from
sqlite3BtreeInsert() for a small size reduction and performance increase.

FossilOrigin-Name: 70d1836474207fa045ff7aa513839c9df26ea6e180eb898b30d89bd5b3833f58
2021-06-19 20:20:23 +00:00
drh
f51bad45f0 The previous check-in is a significant change to btree, so go ahead and
increment the version number for the next development cycle.

FossilOrigin-Name: 2eb6697051c13bf0cc3772fd6c16bfdea0be3b01c0d985e05004c04eaf7a4a48
2021-06-19 18:35:20 +00:00
drh
42a410dcad Split the sqlite3BtreeMovetoUnpacked() routine into two separate routines
sqlite3BtreeTableMoveto() and sqlite3BtreeIndexMoveto(), since we usually
know the type of btree in advance.  This results in less branching and
better performance.

FossilOrigin-Name: 3b0d34e5e5f9a16c3397e4551f3b534729b1b375770f05f6ed5847818b1f4c0b
2021-06-19 18:32:20 +00:00
drh
6d72858e79 Version 3.36.0
FossilOrigin-Name: 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5
2021-06-18 18:36:39 +00:00
drh
9c32c914b8 Add an ALWAYS on a branch in STAT4-only logic that is now always
true due to check-in [c21bc5a2353e660f].

FossilOrigin-Name: 7bd55eee1ac63cf6d5699ce85bc5a29bf51afdf7a80bce44937fa833947a40f4
2021-06-16 19:23:24 +00:00
dan
755708538d Omit a handful of tests from pager1.test when testing SQLITE_ENABLE_ZIPVFS builds.
FossilOrigin-Name: c3036c28259c1375cd2c480c9ca0ce7f9aa1e952be4f110dde49b2b7d72a43b7
2021-06-16 18:58:01 +00:00
dan
7379b455a5 Do not run test file sessionbig.test on 32-bit platforms. It uses too much memory.
FossilOrigin-Name: 75e53215fe436999cdc70434c6ae96d3ce6642c71528cce9f5715fe1b1b81876
2021-06-16 16:56:56 +00:00
drh
a4df1bd5ff Adjust the mkshellc.tcl script so that the generated code always uses
unix-style line endings.

FossilOrigin-Name: 9f69af4dbcb273519fa87b7868f3792560fb71b192f4ffe53b8b465334da5ae4
2021-06-16 15:56:09 +00:00
larrybr
d95a652025 Avoid ominous warning in showdb.c
FossilOrigin-Name: f8d7ac0104b76555142ce0d32714594f42d19b311dce2f77f42f92756b5e0c93
2021-06-16 13:26:40 +00:00
drh
cbe83495ee Adjustments to requirement markings in comments. No changes to code.
FossilOrigin-Name: be00e45b723adf64bc78927dc12de3116fd04912a52e5c105a52f235c57698f5
2021-06-16 12:26:01 +00:00
drh
236bcdf3e4 Enhanced defense against integer overflow in ALTER TABLE.
FossilOrigin-Name: fb7f094e4e0f03622c2e7fa02483c17671a8899c7ad8aba8659177180f406704
2021-06-16 11:32:54 +00:00
drh
82f62e8324 Fix some #ifdefs so that builds work for all supported compile-time options.
FossilOrigin-Name: ca7d78f7818b4754fd04ea2b618dee1f01e11c6a5acb54951217c0d03df8e187
2021-06-15 20:10:25 +00:00
drh
9d82a2ccfe Fix an incorrect ifdef in the previous check-in.
FossilOrigin-Name: 4b2bb46730393292364b2be7db4e73fc8f93cd5a141aaf04f20fe0119deb5ab3
2021-06-15 20:07:16 +00:00
drh
f54e79405e Fix some minor #ifdef issues so that all of the supported compile-time
options continue to build.

FossilOrigin-Name: d8cf407046f20b0398f19acd0dab6acb6c742911e21e1003cb5b194dd668d98e
2021-06-15 18:46:06 +00:00
drh
17adf4e5a1 Update the "nmakehlp.c" utility program sources associated with the TCL
Extension Architecture, obtained from
[https://core.tcl-lang.org/sampleextension/file].  Perhaps this new
version will sit better with salmonx's static analyzer
[forum:/forumpost/7f0beca9797ee23a|(ref1)],
[forum:/forumpost/7d5c8b19231ad57f|(ref2)].

FossilOrigin-Name: 603b851d7d923d71543760b09a55d72dbbc185ac9c353c954c331c0454992c80
2021-06-15 15:36:05 +00:00
drh
a959bf5311 Add NULL checks on all sqlite3_vfs_find(0) calls. This is not strictly
necessary.  There are no vulnerabilities here.  However, adding these
checks avoids unnecessary static analyzer complaints.
[forum:/forumpost/ce1193be15|Forum post ce1193be15].

FossilOrigin-Name: 272a15b9f418fb0b31a9808f7c42c20cf52318035ff98935d8e8519634357e8d
2021-06-15 15:15:40 +00:00
drh
972da42749 Prevent an infinite loop in the trim() SQL function if the second argument
is a carefully malformed UTF8 string.

FossilOrigin-Name: 829343c26ed7b87fafc70de3369625209bad91e79bb7ca2946d5c8d61cc1c3c4
2021-06-15 14:34:21 +00:00
drh
11e489d6cb Fix typos in testcase() macros from check-in [c09d90eec2a49b94].
FossilOrigin-Name: d4d9869c30710914b7ba51221b2c2223a9cf16b913bd6f3866ae747494a116af
2021-06-14 20:49:33 +00:00
drh
93fd5420d0 In the authorizer, use SQLITE_DROP_INDEX, not SQLITE_DROP_TEMP_INDEX
when dropping an index in an attached database.

FossilOrigin-Name: e5a5acd6006133c5da4a7dd79726dbaa41c0d60ebeda890f848a6aafe5f9ef70
2021-06-14 20:41:20 +00:00