aboutsummaryrefslogtreecommitdiff
path: root/src/update.c
AgeCommit message (Collapse)AuthorLines
7 daysDisable the before-trigger-read optimization if the trigger uses adrh-0/+14
generated column. [bugs:/info/2026-11-06T00:28:57Z|Bug 2026-11-06T00:28:57Z] FossilOrigin-Name: 1d6070c287e3d6fa20aa018279a5014275664070b4dd18b7af164294c26489da
2026-10-19Correct the handling of SQLITE_IGNORE returns from authorizer callsdrh-4/+8
for UPDATE on the rowid or INTEGER PRIMARY KEY. See the test cases in TH3 for details. FossilOrigin-Name: 606005419f60bd14eec71ee87a770051c8c551273c9a7567d830283eeb1058e8
2026-10-05Correctly rollback "OR REPLACE" changes following a "datatype mismatch" error.drh-0/+1
[bugs:/info/2026-10-05T07:15:40Z|Bug 2026-10-05T07:15:40Z]. FossilOrigin-Name: 028f3f96a0af9fc71f1c191bbd44e0b7c3884d0571931b2808e4cdd1bb2f5081
2026-08-31Fix a harmless compiler warning.drh-3/+2
FossilOrigin-Name: 40530cf21d1a0ad5e7e0a1023857de8c3a87a7177eba7d526cbfd08af3c80eab
2026-08-29Remove a redundant OP_RealAffinity inserted by recent changes todrh-5/+0
sqlite3ColumnDefault(). FossilOrigin-Name: c7a987a4f7b4c937073536b714235e18295cc2c3bd8df8dfa4d8ba770ab6038d
2026-08-27Performance optimizations and code simplifications.drh-14/+30
FossilOrigin-Name: cbf2e796e02b23df9d51b59e047673fe0bdecd6497e678507b5bbc5c136dad7d
2026-08-26Split the sqlite3ColumnExpr() routine out into two routines, one that worksdrh-2/+3
as before and the second sqlite3ColumnExprAuth() to deal with the authenticator in places where that is needed. FossilOrigin-Name: 51a1149bdcbe142b8eb92c2b817d3973bf88aaa73859e0c475505aa201da920b
2026-08-26An attempt to make the authorizer effective at preventing the use ofdrh-2/+2
some functions within the DEFAULT clause of a table. FossilOrigin-Name: 321e41b09179acba59958bdd6b07e4b7d915b9c0dfca143e4914b3690692c201
2025-02-08Use the sqlite3ColumnIndex() routine to look up a column in a table, ratherdrh-25/+19
than using a custom loop. Performance improvement, size reduction, and complexity decrease. FossilOrigin-Name: 351dbbc2bf0b23efdc625ddaa5dc2239cf2990addf071a04bd41612b341de8c8
2024-08-17Give unique names to fields in the SrcItem object, to facilitate analysis ofdrh-3/+3
how those fields are used using "grep". FossilOrigin-Name: 9f5aeef3cbc2c95267c8f7bf60d5c66971a76789669fb0e8f853273ff6f616f2
2024-04-05When compiling with SQLITE_ALLOW_ROWID_IN_VIEW, if the RETURNING clause ofdrh-0/+3
an UPDATE of a view specifies a rowid, then return NULL for the value of that rowid. dbsqlfuzz 7863696e9e5ec10b29bcf5ab2681cd6c82a78a4a. FossilOrigin-Name: c7896e88850669e18e89d44c4169d4f4a5d4b904bea6ccb2ac64f93b6d348a42
2023-08-14Fix harmless compiler warnings reported by MSVC.drh-3/+3
FossilOrigin-Name: 391e21bb6e0b2f4632972b6617a3a18192f88deb29eee5bc060846468e624b21
2023-08-07Changes so that sqlite3_vtab_nochange() works with "UPDATE ... FROM...". Use ↵dan-1/+3
this to allow UPDATE on a contentless fts5 table if new values are supplied for all indexed columns. FossilOrigin-Name: 16cd2161e312cf97129011fc829079db8f762b822b2f4fabf7ff6742c071302f
2023-08-01Restore part of the UPDATE one-pass optimization that was removed bydrh-1/+1
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-06-20Avoid unnecessary calls to sqlite3CodeRowTrigger().drh-2/+4
FossilOrigin-Name: 27c174dbd0e7ba029d13fb005fc950ac99eb6aee31903ee3acfc88c262d13f6a
2023-06-16Address various harmless compiler warnings fromdrh-1/+3
[forum:/forumpost/d526da8ee4|forum post d526da8ee4]. FossilOrigin-Name: 365caf2f97e8f15842f52536e8d05d359e9d6e863182e020ce14a9a9f27ee057
2023-06-07Fix straggler misspellings and tidy the custom dictionary. Also include ↵larrybr-54/+54
pickups from [forum:/info/c61fb09afd|forum post c61fb09afd]. FossilOrigin-Name: 8c291d99946eb32b20b743921202f9c7cfb716268ff526817b27adbb7942e40b
2023-05-17Avoid an assert() failure that could occur in ↵dan-1/+1
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-03-28Fix multiple problems with RETURNING on a DML statement against a view,drh-1/+1
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-16Do not use the one-pass optimization on an UPDATE if there is a subquerydrh-5/+15
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
2022-12-09Remove the SQLITE_PREPARE_SAFEOPT flag. The name is obsolete and it is at thedrh-2/+2
wrong level. Instead use the SF_UpdateFrom flags on the Select object. FossilOrigin-Name: 78723a9a7e72b42d28fc5645661da17f20cedcf864819b861800ad9340007be1
2022-12-06Simplified experimental changes to promote the use of co-routines. Lessdrh-0/+1
cruft than the coroutines-exp1 branch, but still does not work. Checked in as a work-in-progress. FossilOrigin-Name: e2318a30bf6ad2aeb4c4cb29661bc24ff78eb51bf07decc4b8da1ecac0015ef0
2022-10-10Code clean-up for the integrity_check enhancement.drh-1/+1
FossilOrigin-Name: a140173102febe9ef8064ee9b95bee489db54caba149e577d69e4d75161bf390
2022-10-10An attempt to enhance PRAGMA integrity check so that it does data typedrh-3/+6
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-06-15Dbsqlfuzz discovered a case where a bytecode branch is in fact taken, so changedrh-1/+1
the designator from VdbeCoverageNeverTaken() to VdbeCoverage(). Test case in TH3. FossilOrigin-Name: 988a2a759f2b9da0e287e65306039b7a3e2b5aac3d31fe15cbb30d30ea6caf71
2022-04-06Attempt to show triggers in the TreeView output from DELETE, INSERT, anddrh-7/+8
UPDATE statements. FossilOrigin-Name: b0939d6f4d94b45dce53ace6295508a67d574cc72bd6977623bf77065b3c4e64
2022-04-06Rename debugging defines and variables from SELECTTRACE to TREETRACE (anddrh-2/+2
similar) since the functionality has how expanded to include data structures beyond SELECT statements. Should not affect deliverable builds. FossilOrigin-Name: 393fa32e188a017f431372b54037cb31e885030542f00d0bfd59da9d9db5c014
2022-04-06Add additional tree display routines for DELETE and UPDATE. No changesdrh-0/+7
to deliverable code. FossilOrigin-Name: fbd288ff3d4ea47cd324b5952e7754a465901844f2d950f0860d4488d5b6eb9f
2022-01-27Give the virtual table xBestIndex method access to (some) OFFSET and LIMITdrh-2/+4
clauses. FossilOrigin-Name: 74fa5757ee0a8499bcd6546dac1a3ecc6048ba9cff9e3e574e28e6e82e894a3d
2022-01-24Remove many redundant checks for sqlite3.mallocFailed now that any OOM shoulddrh-1/+3
cause Parse.nErr to be non-zero. FossilOrigin-Name: 1f7fa46126ea33ed30e93186aff3df51068aeb4be6f79a102bfe8c4e44941d71
2021-12-01Check for foreign key constraint errors prior to returning the results fromdrh-3/+1
a RETURNING clause. See [forum:/forumpost/793beaf322|forum post 793beaf322]. FossilOrigin-Name: a818ba2ed635b91e279dde44236fc7446a33db2b46c9409b67021248c01bf4e5
2021-08-02Refactor field names in the Column object, zCnName and zCnColl, to make themdrh-4/+7
unique and thus easier to find amid all the other code. FossilOrigin-Name: 8b781dcaf68e0cf12a844708c82eee00193e340195cbca915d077e4846983bf3
2021-08-02Refactor the Table object to reduce its memory footprint.drh-3/+3
FossilOrigin-Name: bbb6759bcf6e01d36dfc787a82a610d359f50aaeac8104b73883a84906d54e1f
2021-07-31Refactor the way that DEFAULT expressions are stored on columns, in orderdrh-3/+6
to save memory in the common case where the column has no DEFAULT clause. FossilOrigin-Name: 8646547e54211d44c415663c33775c4268550f8332949c4731a4bb6ec9cc663a
2021-07-16Get the "omit ORDER BY in FROM-clause subqueries" optimization working for thedrh-0/+1
core test cases. FossilOrigin-Name: e31c5888659ffd4c6d8b68627123df3bbb84bb010b7766b0a74877bf3ba1e52b
2021-07-05Allow sub-queries in the FROM clause of an UPDATE...FROM statement to access ↵dan-1/+1
the object being updated without using an alias, as is required in the parent query. FossilOrigin-Name: 740cb43025449b7d7b47a97ad00885e54b7701cbcb14f4a50c7523022e3936d5
2021-05-20Replace [0f0959c6f95046e8] with a new and better solution that also fixes thedrh-4/+1
CTE name resolution problem described in [forum:/forumpost/8590e3f6dc|forum post 8590e3f6dc]. Test cases for both problems added. FossilOrigin-Name: 5614279daff5007d6e047c5c1b3cc82ba80a5c91c529525b0fe68b79ee82dd2c
2021-05-19When constructing the synthensized SELECT statement that is used to choosedrh-0/+4
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-04-09Remove an ALWAYS() that is actually reachable following an OOM on andrh-1/+2
UPDATE FROM of a virtual table. dbsqlfuzz aa03237ef7c4a028c7cdaf8bbcde2b62e2bcd36e FossilOrigin-Name: 49eac38926b3391b185d20fae6588c213f7f020f028173d4a4aa3c7a62b94140
2021-04-07Also prohibit the use of rowid from a subquery. Add thedrh-1/+6
SQLITE_ALLOW_ROWID_IN_VIEW compile-time option to restore legacy behavior in case somebody actually needs it. FossilOrigin-Name: 14b1d56ef84b0e62b7f9c4e5f7f985ca10e770c8db59f54004ad892c2a2dcbfb
2021-01-31New opcode OP_ChngCntRow used to output the result of PRAGMA change_count.drh-1/+1
Only this new opcode, and not OP_ResultRow, checks for foreign key errors. Faster performance, and now also works with RETURNING. FossilOrigin-Name: 154fc2b15465c7c92a1af0a93851421aec42a81bab54840a9701f2c78068e14e
2021-01-29RETURNING works even if "PRAGMA count_changes=ON" is set.drh-0/+1
FossilOrigin-Name: a9122d97577b239704cdee1a90a3b0dbff8bdf9dea2324d7315bd47238dcc8eb
2020-11-17Claw back most of the performance lost in the previous commit.drh-6/+3
FossilOrigin-Name: df8ce2675b070fcdc338918e7652a26ffc90439fe399ceac206fadf8a93a681f
2020-11-14Modify UPDATE so that two-pass updates on a rowid table use an ephemeraldrh-7/+12
table to store rowids rather than a RowSet. This uses less memory, though it is slower. FossilOrigin-Name: 4673096dd8c5ed7aed098ff518a6d01d35c40fad991b89fddd91c19a727a4308
2020-10-12Fix UPDATE FROM statements on virtual tables that are declared WITHOUT ROWID.dan-5/+19
FossilOrigin-Name: bcb0bc6a7b7006f07adb7266b1fecca39bf85a0adea6d78a341623a3546f2c2a
2020-08-14For UPDATE and DELETE, use OP_DeferredSeek always. If the seek must laterdrh-1/+1
be resolved, add the OP_FinishSeek opcode after all WHERE clause terms have been processed. This obviates the need for the WHERE_SEEK_TABLE and WHERE_SEEK_UNIQ_TABLE flags to sqlite3WhereBegin() and the ensuing complication, and it allows the covering index optimization to be used further into WHERE clause processing. FossilOrigin-Name: a495f60d315e34b1a1bc5fb1336e05047add52c8fb2710b577c97b10a5e734f6
2020-07-18More harmless compiler warning fixes.drh-4/+7
FossilOrigin-Name: 4c0d208c455abb983217a6dfea7634f677f8360fb57857e1421334fe7a5a23e2
2020-07-18Fix a harmless compiler warning.drh-1/+1
FossilOrigin-Name: 5a0b0c6e11146e200c3417903232e6932102b02d7bf128bac4b7cd74c257acd1
2020-07-17Add ALWAYS() around a conditional that is always true.drh-2/+1
FossilOrigin-Name: 270e17bba1d35f8c300844e75b2aa15f79a1ab62e40bc5e6bc9694902f8f7dde
2020-07-17Make it an error to repeat the target object/alias of an UPDATE statement in ↵dan-1/+1
its FROM clause. FossilOrigin-Name: d90a37e930c66afe95165955ae47efde08f52c8ce16c4fb239da0233335db050