1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

497 Commits

Author SHA1 Message Date
drh
cc42fddfd9 Merge the latest trunk enhancements into the bedrock branch.
FossilOrigin-Name: c09656c62155a6e82d0fa6c27bf8ec40a14854845adfa53db3cb42a0b1b29101
2025-02-18 14:48:14 +00:00
drh
9d90a3af2f Use the sqlite3ColumnIndex() routine to look up a column in a table, rather
than using a custom loop.  Performance improvement, size reduction, and
complexity decrease.

FossilOrigin-Name: 351dbbc2bf0b23efdc625ddaa5dc2239cf2990addf071a04bd41612b341de8c8
2025-02-08 14:15:42 +00:00
drh
920662eaf3 Merge the latest trunk enhancement into the bedrock branch through the wal2
intermediary.

FossilOrigin-Name: ff94464cec871bd90634e7e1e4252954eb68e77037dd290b0fbf7747c9b19308
2024-08-29 23:43:55 +00:00
drh
b204b6aa7b Give unique names to fields in the SrcItem object, to facilitate analysis of
how those fields are used using "grep".

FossilOrigin-Name: 9f5aeef3cbc2c95267c8f7bf60d5c66971a76789669fb0e8f853273ff6f616f2
2024-08-17 23:23:23 +00:00
drh
bc4ac5f7c6 Merge the latest trunk enhancements into the bedrock branch.
FossilOrigin-Name: 7a2a64b64655e9fdc551765f9f6b6a4d2898a488230eca240b6ee4df86b5c491
2024-04-05 14:54:26 +00:00
drh
65a1d7a284 When compiling with SQLITE_ALLOW_ROWID_IN_VIEW, if the RETURNING clause of
an UPDATE of a view specifies a rowid, then return NULL for the value of
that rowid.  dbsqlfuzz 7863696e9e5ec10b29bcf5ab2681cd6c82a78a4a.

FossilOrigin-Name: c7896e88850669e18e89d44c4169d4f4a5d4b904bea6ccb2ac64f93b6d348a42
2024-04-05 11:23:51 +00:00
dan
a7866eefb5 Merge latest changes from the wal2 branch into this one.
FossilOrigin-Name: 4d8df0c426b8ce3db6cfb71e23f752026ef886b9bb833dc4be9717db9955b1db
2023-08-21 18:31:53 +00:00
drh
592ae2823c Fix harmless compiler warnings reported by MSVC.
FossilOrigin-Name: 391e21bb6e0b2f4632972b6617a3a18192f88deb29eee5bc060846468e624b21
2023-08-14 12:20:44 +00:00
drh
08901378d9 Merge all the latest trunk enhancements into the bedrock branch.
FossilOrigin-Name: 859932ebce830c757cf4e889f2efc54807bd4d7947cf5d64a5d9e570bf75ed80
2023-08-11 11:46:08 +00:00
dan
be3ab76bfb Changes so that sqlite3_vtab_nochange() works with "UPDATE ... FROM...". Use this to allow UPDATE on a contentless fts5 table if new values are supplied for all indexed columns.
FossilOrigin-Name: 16cd2161e312cf97129011fc829079db8f762b822b2f4fabf7ff6742c071302f
2023-08-07 16:15:56 +00:00
drh
afdcd07fae Merge the latest trunk enhancements into the bedrock branch.
FossilOrigin-Name: 877ffece0531054f24410c9e4c0b89599a9506689cc97233d33c18b9a15e6308
2023-08-03 23:26:39 +00:00
drh
d192b4441d Restore part of the UPDATE one-pass optimization that was removed by
check-in [2c56b984a0bd3be5]: only disable one-pass if the WHERE clause
contains a subquery.  Allow subqueries in the SET expressions.
Fix for performance problem reported by
[forum:/forumpost/8ab195fd44e75ed0|forum  post 8ab195fd44e75ed0].

FossilOrigin-Name: 42916af9fc0f379a608a08db894400bd735a28e26ab1ffd604d1fddfbdb3ec0c
2023-08-01 00:34:03 +00:00
drh
f3445f4757 Merge the latest trunk enhancements into the bedrock branch.
FossilOrigin-Name: 0551b79b17579a91d891c745ecd0e35b5142f944ed59eb3c95c37e5a4de8a461
2023-06-22 14:40:38 +00:00
drh
f6e04b6e29 Avoid unnecessary calls to sqlite3CodeRowTrigger().
FossilOrigin-Name: 27c174dbd0e7ba029d13fb005fc950ac99eb6aee31903ee3acfc88c262d13f6a
2023-06-20 15:48:24 +00:00
drh
56a410741b Address various harmless compiler warnings from
[forum:/forumpost/d526da8ee4|forum post d526da8ee4].

FossilOrigin-Name: 365caf2f97e8f15842f52536e8d05d359e9d6e863182e020ce14a9a9f27ee057
2023-06-16 14:39:21 +00:00
larrybr
55be21647e Fix straggler misspellings and tidy the custom dictionary. Also include pickups from [forum:/info/c61fb09afd|forum post c61fb09afd].
FossilOrigin-Name: 8c291d99946eb32b20b743921202f9c7cfb716268ff526817b27adbb7942e40b
2023-06-07 17:03:22 +00:00
dan
32a5feb53e Avoid an assert() failure that could occur in SQLITE_ENABLE_UPDATE_DELETE_LIMIT builds when a WITH clause attached to an UPDATE or DELETE statement created a CTE of the same name as the table being modified.
FossilOrigin-Name: 8edf56d1698c3db38250db3b25864f658488414efb3a6b3e1443283b6affd26d
2023-05-17 11:31:51 +00:00
dan
bf1305334f Merge latest wal2 changes into this branch.
FossilOrigin-Name: b2e0800b24f8c676e189d63abd77ca45a972de9722ece5de6efe2db6ede75cbd
2023-05-04 14:41:10 +00:00
drh
3cbf38c783 Fix multiple problems with RETURNING on a DML statement against a view,
all inspired by [forum:/forumpost/dc3b92cfa0|forum post dc3b92cfa0].
(1) Do not allow a RETURNING clause to trick the code generator into thinking
that the view being updated has an INSTEAD OF trigger.
(2) Generate all result columns for a view in a DML statement.
(3) The automatic covering index for a view should cover all result columns
of the view.

FossilOrigin-Name: c8bedef0d61731c29ae34de1594222d15b578f9e2cddbbd5b74fb3059644fe0f
2023-03-28 11:18:04 +00:00
drh
7d5a549121 Do not use the one-pass optimization on an UPDATE if there is a subquery
in the WHERE clause, since if the subquery is hidden behind a short-circuit
operator, the subquery might not be evaluated until after one or more rows
have been updated.  Fix for the problem reported by
[forum:/forumpost/0007d1fdb1|forum post 0007d1fdb1].  This is the same
problem that was fixed by [73f0036f045bf371] only for UPDATE instead of
DELETE.

FossilOrigin-Name: 2c56b984a0bd3be5ec326a2109ea7b8f1d4ef63c8fc325caac9663cf2479eaff
2023-03-16 10:17:30 +00:00
drh
d50f1f4f5b Merge the latest trunk enhancements into the begin-concurrent-pnu-wal2
branch.

FossilOrigin-Name: bcab19d21be42121f1ea3961aedbbe463c60d85d0a3dd8b9593040d217bac3a7
2022-12-21 20:43:53 +00:00
drh
93f41e22d4 Remove the SQLITE_PREPARE_SAFEOPT flag. The name is obsolete and it is at the
wrong level.  Instead use the SF_UpdateFrom flags on the Select object.

FossilOrigin-Name: 78723a9a7e72b42d28fc5645661da17f20cedcf864819b861800ad9340007be1
2022-12-09 18:26:15 +00:00
drh
ad9ff1d5f2 Simplified experimental changes to promote the use of co-routines. Less
cruft than the coroutines-exp1 branch, but still does not work.  Checked in
as a work-in-progress.

FossilOrigin-Name: e2318a30bf6ad2aeb4c4cb29661bc24ff78eb51bf07decc4b8da1ecac0015ef0
2022-12-06 15:24:05 +00:00
drh
7bc4ce3412 Merge the latest trunk enhancements into the begin-concurrent-pnu-wal2 branch.
FossilOrigin-Name: aa2e247b58dea930c4f0af3566d287f196ea178be8e994fc9eec685a89bebac8
2022-11-04 19:09:41 +00:00
drh
c9ef12f62b Code clean-up for the integrity_check enhancement.
FossilOrigin-Name: a140173102febe9ef8064ee9b95bee489db54caba149e577d69e4d75161bf390
2022-10-10 21:21:04 +00:00
drh
49d77ee642 An attempt to enhance PRAGMA integrity check so that it does data type
checking on non-STRICT tables.  Specifically:  (1) Columns with TEXT affinity
should not contain numeric values, and (2) columns with numeric affinity should
not contain text values that can be converted to numeric.

FossilOrigin-Name: 8b1e7f0524637728cebe81c7d3ff8ad8a5a55782eac6409b425dad538024f596
2022-10-10 18:25:05 +00:00
drh
db7a64354a Merge the latest trunk enhancements into the begin-concurrent-pnu-wal2 branch.
FossilOrigin-Name: 82e7e836011f52c09196aa6af9519cd9f584881d41dcbcdb23969e863c6e4fb0
2022-06-16 13:56:11 +00:00
drh
10c5341c72 Dbsqlfuzz discovered a case where a bytecode branch is in fact taken, so change
the designator from VdbeCoverageNeverTaken() to VdbeCoverage().  Test case
in TH3.

FossilOrigin-Name: 988a2a759f2b9da0e287e65306039b7a3e2b5aac3d31fe15cbb30d30ea6caf71
2022-06-15 12:32:27 +00:00
drh
5eedf42dbf Merge the latest trunk enhancements into theh begin-concurrent-pnu-wal2 branch.
FossilOrigin-Name: d28af1f8a5da1810d41766074560fc3a1ec8fdc22b1efa59056eae4e5c6b66a4
2022-05-10 12:45:41 +00:00
drh
2a7dcbfbb0 Attempt to show triggers in the TreeView output from DELETE, INSERT, and
UPDATE statements.

FossilOrigin-Name: b0939d6f4d94b45dce53ace6295508a67d574cc72bd6977623bf77065b3c4e64
2022-04-06 15:41:53 +00:00
drh
5e431bead8 Rename debugging defines and variables from SELECTTRACE to TREETRACE (and
similar) since the functionality has how expanded to include data structures
beyond SELECT statements.  Should not affect deliverable builds.

FossilOrigin-Name: 393fa32e188a017f431372b54037cb31e885030542f00d0bfd59da9d9db5c014
2022-04-06 11:08:38 +00:00
drh
f8ef2dbd7b Add additional tree display routines for DELETE and UPDATE. No changes
to deliverable code.

FossilOrigin-Name: fbd288ff3d4ea47cd324b5952e7754a465901844f2d950f0860d4488d5b6eb9f
2022-04-06 10:37:44 +00:00
drh
5794413d8c Merge recent trunk changes into the begin-concurrent-pnu-wal2 branch.
FossilOrigin-Name: cb045aba7c7f73ca4ad33f77a1ad0c3196eb4db0b2792a1bbbe079593c4f8f56
2022-02-04 18:02:39 +00:00
drh
895bab3383 Give the virtual table xBestIndex method access to (some) OFFSET and LIMIT
clauses.

FossilOrigin-Name: 74fa5757ee0a8499bcd6546dac1a3ecc6048ba9cff9e3e574e28e6e82e894a3d
2022-01-27 16:14:50 +00:00
drh
6ee0c5e255 Merge the latest trunk changes into begin-concurrent-pnu-wal2
FossilOrigin-Name: 3d949775e3029c6bf7cb06946ce52e2dfab451a3f7e685d654807cb5ac750b02
2022-01-25 16:05:35 +00:00
drh
0c7d3d399d Remove many redundant checks for sqlite3.mallocFailed now that any OOM should
cause Parse.nErr to be non-zero.

FossilOrigin-Name: 1f7fa46126ea33ed30e93186aff3df51068aeb4be6f79a102bfe8c4e44941d71
2022-01-24 16:47:12 +00:00
drh
77dc2a7ff9 Merge the latest trunk enhancements into the begin-concurrent-pnu-wal2 branch.
FossilOrigin-Name: 45fa7efecb8d28dd68b844c9f74b751aab6e7ad7d03f03e8a5881f0e09fb86a2
2022-01-17 19:46:10 +00:00
drh
3b26b2b56b Check for foreign key constraint errors prior to returning the results from
a RETURNING clause.  See [forum:/forumpost/793beaf322|forum post 793beaf322].

FossilOrigin-Name: a818ba2ed635b91e279dde44236fc7446a33db2b46c9409b67021248c01bf4e5
2021-12-01 19:17:14 +00:00
drh
8c8b9357e4 Merge recent trunk changes into the begin-concurrent-pnu-wal2 branch.
FossilOrigin-Name: 5b6f6514bd3dcfb45c0ac9a2c4f806fa2f2e8bd7ee62f766bdc218246b4d9e22
2021-08-03 16:44:57 +00:00
drh
cf9d36d1b3 Refactor field names in the Column object, zCnName and zCnColl, to make them
unique and thus easier to find amid all the other code.

FossilOrigin-Name: 8b781dcaf68e0cf12a844708c82eee00193e340195cbca915d077e4846983bf3
2021-08-02 18:03:43 +00:00
drh
f38524d20d Refactor the Table object to reduce its memory footprint.
FossilOrigin-Name: bbb6759bcf6e01d36dfc787a82a610d359f50aaeac8104b73883a84906d54e1f
2021-08-02 16:41:57 +00:00
drh
79cf2b7120 Refactor the way that DEFAULT expressions are stored on columns, in order
to save memory in the common case where the column has no DEFAULT clause.

FossilOrigin-Name: 8646547e54211d44c415663c33775c4268550f8332949c4731a4bb6ec9cc663a
2021-07-31 20:30:41 +00:00
drh
0fb78f0cca Get the "omit ORDER BY in FROM-clause subqueries" optimization working for the
core test cases.

FossilOrigin-Name: e31c5888659ffd4c6d8b68627123df3bbb84bb010b7766b0a74877bf3ba1e52b
2021-07-16 01:19:19 +00:00
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
dan
ef319309ea Merge latest changes from wal2 into this branch.
FossilOrigin-Name: 4efefb5938c1ec83ee367ae5cc4bba906729b4e8699fa81adc6ca3618c73eb03
2021-05-21 17:31:04 +00:00
drh
cd1499f47b Replace [0f0959c6f95046e8] with a new and better solution that also fixes the
CTE name resolution problem described in
[forum:/forumpost/8590e3f6dc|forum post 8590e3f6dc].
Test cases for both problems added.

FossilOrigin-Name: 5614279daff5007d6e047c5c1b3cc82ba80a5c91c529525b0fe68b79ee82dd2c
2021-05-20 00:44:04 +00:00
drh
1168f81092 When constructing the synthensized SELECT statement that is used to choose
the rows in an UPDATE FROM, make sure the first table is really the table
being updated, and not some common-table expression that happens to have the
same name.  [forum:/forumpost/a274248080|forum post a274248080].  More
changes associated with CTE name resolution are pending.

FossilOrigin-Name: 0f0959c6f95046e8e7887716e0a7de95da18d1e926ab1f919527083a56541db5
2021-05-19 21:55:56 +00:00
drh
2be1f2afe8 Remove an ALWAYS() that is actually reachable following an OOM on an
UPDATE FROM of a virtual table.
dbsqlfuzz aa03237ef7c4a028c7cdaf8bbcde2b62e2bcd36e

FossilOrigin-Name: 49eac38926b3391b185d20fae6588c213f7f020f028173d4a4aa3c7a62b94140
2021-04-09 22:20:20 +00:00
drh
6e5020e8da Also prohibit the use of rowid from a subquery. Add the
SQLITE_ALLOW_ROWID_IN_VIEW compile-time option to restore legacy behavior
in case somebody actually needs it.

FossilOrigin-Name: 14b1d56ef84b0e62b7f9c4e5f7f985ca10e770c8db59f54004ad892c2a2dcbfb
2021-04-07 15:45:01 +00:00
drh
1641e35ac4 Merge in recent enhancements.
FossilOrigin-Name: b0fc8ca14ec8ed3a42bf647b112d5fba640f2adc948485da795fc802b74b3106
2021-03-03 19:41:15 +00:00