aboutsummaryrefslogtreecommitdiff
path: root/src/delete.c
AgeCommit message (Collapse)AuthorLines
2026-10-14Fix indexes on typeless generated columns that pull from REAL columns sodrh-1/+4
that they correctly return REAL values. [bugs:/info/2026-10-14T17:34:30Z|Bug 2026-10-14T17:34:30Z]. FossilOrigin-Name: 7408f90ecc2dd26aceb52f92de78b8e1521cb5a294d3231fd32a903afe1db41d
2026-04-22Enable the optimization on this branch for indexes on expressions only.dan-1/+5
FossilOrigin-Name: 3576b6930436b3149c5033476f70518e9b4adeaeec2538a68b7dc599eb854c47
2026-04-22Detect and omit cases where an index key is being replaced with an identical ↵dan-3/+2
key. FossilOrigin-Name: 7a01caf0d0864a462eb81b7643dcf89048f4ae56a29d762f0cfc38066218504f
2026-03-17Fix compiler warning an inefficiency introduced by previous commit.dan-1/+1
FossilOrigin-Name: 03058d73d3a88ab30e874b4231cc5b263b874a577f8bf5189a452d7376e25a47
2026-03-17Change the sqlite3VdbeFindDeleteKey() routine so that all index fields that ↵dan-2/+4
are not expressions or virtual columns must match the table for the delete to succeed. FossilOrigin-Name: eccd9fcfa7e34ddcdeb671544c6afac7aa0d4665c5e1df7c8e53c41387ed0386
2026-03-16Fix a problem with the find-delete-key method on this branch.dan-2/+2
FossilOrigin-Name: 6f49b5ecad5d924999d045a1ade93d95e731182be1781aefa5bc763b6202e9c3
2026-01-23More code simplifications.drh-1/+0
FossilOrigin-Name: 3d76732a45333f6f3e21667bb018a859d20815243d276fad0dc126d3c667d4aa
2025-12-22Add the SQLITE_PREPARE_FROM_DDL flag to sqlite3_prepare_v3(). Use this to ↵dan-1/+1
prevent fts3/4 tables in non-trusted schemas from calling unsafe SQL functions. FossilOrigin-Name: 26f39ac806a5582fab1497e38a4ce68dad2b79df8c8aade43c4e21eed7576931
2024-09-20New assert()s to help verify union access. No logic changes. Testing anddrh-0/+1
validation code only. FossilOrigin-Name: b7b64c53f5d7f6b405ee3f1f1be1d84230aa79db5a502c8ad78d3e524f4384fb
2024-08-20Fix minor comment issues.drh-2/+2
FossilOrigin-Name: c1bbed19f4348ec31c3cb4723eaa8f1554bb58ef4de7feb3a0f39612785f13d5
2024-08-20Tighter checking of access constraints on union members in SrcItem.drh-1/+1
Improved invariant checking. FossilOrigin-Name: fd72d3400a8fe5747f494eee81654698acee350bb95b9db269e87d857af03492
2024-08-20Fix some stray SrcItem field name fixes.drh-4/+4
FossilOrigin-Name: bc5f5ce59e1e4323422bda7d002310923f927a03b4fd42749bf04f6c9853956b
2024-08-17Give unique names to fields in the SrcItem object, to facilitate analysis ofdrh-2/+2
how those fields are used using "grep". FossilOrigin-Name: 9f5aeef3cbc2c95267c8f7bf60d5c66971a76789669fb0e8f853273ff6f616f2
2024-08-17Reduce the size of the SrcItem object by combining fields into a union.drh-1/+2
FossilOrigin-Name: a4c59ac3c6ec979c25b544d29e47b8e39f6439c098eed8f84b3bd506c9adf047
2023-07-31Add bit to sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS) that willdrh-1/+2
disable the one-pass optimizating in DELETE and UPDATE. FossilOrigin-Name: 22f6dd5cd32ed9e7b932fdba98aa8652fde999df79f4995d3d8ac1acf430cf53
2023-06-20Avoid unnecessary calls to sqlite3DeleteTable() with NULL pointers.drh-1/+1
FossilOrigin-Name: 4a35f391995a88757d7b46f52bf241f523ee2a6a7b6726df00cddaec8cee7080
2023-06-20Avoid unnecessary calls to sqlite3CodeRowTrigger().drh-3/+5
FossilOrigin-Name: 27c174dbd0e7ba029d13fb005fc950ac99eb6aee31903ee3acfc88c262d13f6a
2023-06-16Address various harmless compiler warnings fromdrh-1/+1
[forum:/forumpost/d526da8ee4|forum post d526da8ee4]. FossilOrigin-Name: 365caf2f97e8f15842f52536e8d05d359e9d6e863182e020ce14a9a9f27ee057
2023-06-07Fix straggler misspellings and tidy the custom dictionary. Also include ↵larrybr-1/+1
pickups from [forum:/info/c61fb09afd|forum post c61fb09afd]. FossilOrigin-Name: 8c291d99946eb32b20b743921202f9c7cfb716268ff526817b27adbb7942e40b
2023-06-07Add a C-source spell-checking facility. make misspell (on Nix)larrybr-44/+44
FossilOrigin-Name: 26c1bb4bd9e9f56613c3aa87407a7f562fd4ebde5bfd6dece02078001d9a45f8
2023-05-17New assert() statements to verify that Expr.iColumn is never used as andrh-2/+8
array index when its value is negative. FossilOrigin-Name: 6084c5fb6d3fcedf35cd6c597a44ec7bf8b4a2576c7b277e5342d2a7905318e7
2023-05-17Avoid an assert() failure that could occur in ↵dan-0/+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-3/+5
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-15Disallow the one-pass optimization for DELETE if the WHERE clause containsdrh-1/+1
a subquery. Fix for the problem reported by [forum:/forumpost/e61252062c9d286d|forum post e61252062c9d286d]. This fix is more restrictive than necessary. It could be relaxed if the subquery does not involve the table that is the subject of the DELETE. FossilOrigin-Name: 73f0036f045bf37193b6e87ae45b578c5831614c530488257c69666178da3aa5
2022-08-22Add the new internal interface sqlite3DbNNFreeNN(db,ptr) where both thedrh-1/+1
db and ptr parameters are guaranteed to be non-NULL. Use this where appropriate to save more than 2 million CPU cycles on the standard performance test. FossilOrigin-Name: e5eaa80e81fdf86f2875a912b880272b8d099b82b08e945a7988c5dd0fe9d6b5
2022-08-20Enhance the enforcement of SQLITE_VTAB_DIRECTONLY so that it applies todrh-6/+32
DML statements within triggers. Do not allow DML stratements against virtual tables within triggers unless either the virtual table is SQLITE_VTAB_INNOCUOUS or PRAGMA trusted_schema is ON. FossilOrigin-Name: 9433ea4070f52135be64569057f439e7bdb4b3f425d87167c9ebda50011210c1
2022-07-25Small performance increase and size reduction by splitting out thedrh-2/+3
sqlite3VdbeGetLastOp() from sqlite3VdbeGetOp(). FossilOrigin-Name: 92ac01d41d46ab73e189b1e5596ea63e5edb5b15639c5d7bdb981b95366c069b
2022-04-07Improved technique for parsing the ON and USING clauses of a join is fasterdrh-2/+2
and uses less memory. FossilOrigin-Name: 158156a3e3d50042cafc75dea3aaaa68b1f2efb9c3d178518ea6e68e32e0d21c
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/+6
to deliverable code. FossilOrigin-Name: fbd288ff3d4ea47cd324b5952e7754a465901844f2d950f0860d4488d5b6eb9f
2022-01-27Give the virtual table xBestIndex method access to (some) OFFSET and LIMITdrh-1/+1
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/+11
a RETURNING clause. See [forum:/forumpost/793beaf322|forum post 793beaf322]. FossilOrigin-Name: a818ba2ed635b91e279dde44236fc7446a33db2b46c9409b67021248c01bf4e5
2021-10-07New assert() statements to protect the u1 and u2 unions of SrcList.drh-0/+1
FossilOrigin-Name: 9b91fbcfcc14048f7d0755d47d9b7f9212fa2eaa6f3c04f417fa16c3a47943bf
2021-08-03Fix the build for SQLITE_ENABLE_UPDATE_DELETE_LIMIT.drh-2/+2
FossilOrigin-Name: 5150d2da06ab3c7e3bea1865413cd21c64d5cefb91d3d874e9dd0bf51aea754b
2021-08-02Refactor the Table object to reduce its memory footprint.drh-4/+4
FossilOrigin-Name: bbb6759bcf6e01d36dfc787a82a610d359f50aaeac8104b73883a84906d54e1f
2021-06-14An index on the expression "likely(X)" should store the true value of X,drh-7/+9
even if X is a real number with no fractional part. The optimization of storing some REAL indexed values as INT (see [10d851353c2abead]) should be omitted for index columns that are expressions. [forum:/forumpost/3b940c437a|Forum post 3b940c437a]. FossilOrigin-Name: 791473bc6677c2ae76f558082a4b43ca1eaf9895b76624d5b55d58f2af898ff3
2021-06-03Fix the truncate optimization so that PRAGMA count_changes and changes()drh-0/+3
return correct values even for a WITHOUT ROWID table. [forum:/forumpost/07dedbf9a1|Forum post 07dedbf9a1]. FossilOrigin-Name: 820ae3b117c2d8c117c0c5a4e440a7d06886772516c7fc0a84606388f91be195
2021-02-25Fix a problem with UPDATE and DELETE statements that use both INDEXED BY and ↵dan-1/+3
LIMIT clauses in SQLITE_ENABLE_UPDATE_DELETE_LIMIT builds. FossilOrigin-Name: cc2b4b38668bd32ebd8cf2e0d244eef2a6c7e0a1ee0a34c9c43eaf25c9cc09ae
2021-02-21Materialize any CTE that is used more than once.drh-1/+5
FossilOrigin-Name: ba59159fbe6b83fb6d79fbfee22d983768b0ebbaac7e99d2ac66c810e5e04100
2021-02-21Rename the "struct SrcList_item" object to the more succinct "SrcItem".drh-1/+1
This is a symbolic change only. The logic is unmodified. FossilOrigin-Name: bfd5bf2c73110fcb36db9ba2a949ff516131fbd3e89325f88fe9f5c2b4ed87b2
2021-02-20Performance improvement in resolving the INDEXED BY index name for the commondrh-3/+3
case where there is no INDEXED BY clause. FossilOrigin-Name: 554b286ac208168bde91c6c6034cc7087410def76fce650b519661b2ee2c61b7
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-10-03Do not apply affinities when creating entries for automatic indexes on ↵dan-4/+0
views. Fix for [95302bdb]. FossilOrigin-Name: df12f097224ebc9473d9e2a8933bd7efed6490d09af2c012c9b59a7892369b7f
2020-08-14For UPDATE and DELETE, use OP_DeferredSeek always. If the seek must laterdrh-8/+5
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-13Merge latest trunk changes with this branch.dan-1/+2
FossilOrigin-Name: 5ee3c27e20d12a126fb773b428bb864102b949a5b26a8d5c523753dcedf4be10
2020-06-19Further refactoring of the schema table name.drh-1/+1
FossilOrigin-Name: 9536fa0ae0c1ae6e2e98d2fa11e5acda7f3c9b8ca5061b6f7f8cae63a11d936b
2020-05-05Earlier detection of index corruption caused by missing index entries.drh-0/+1
FossilOrigin-Name: f339f31f9e9a856b576f99c5230fdf6d60fdc2873e48cb5aa0a4ab1d04e3c930