Page MenuHomePhabricator

Add options parameter to Database::delete()
Closed, DeclinedPublicFeature

Description

Per the other queries, it'd be nice to be able to do options on delete.

For the resource loader maintenance script to do cleanupRemovedModules, there is a "LIMIT $limit", which can't be accommodated via $db->delete()

You need to do db->$query() etc.

Not a big deal, just not got time/inclination to look at/do this now for all databases etc


Version: unspecified
Severity: enhancement

Details

Reference
bz26682

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:19 PM
bzimport set Reference to bz26682.
bzimport added a subscriber: Unknown Object (MLST).

// $dbw->delete() doesn't support LIMIT :(

  • Bug 52868 has been marked as a duplicate of this bug. ***

In Postgres you'll have to do the trick with DELETE FROM table WHERE ctid IN (SELECT ctid FROM table WHERE ... LIMIT n) - ewwww.

SQLite and Oracle support LIMIT in DELETE.

Related: bug 52777 and bug 52778.

Change 131890 had a related patch set uploaded by Withoutaname:
Expand Database.php delete() function parameter list

https://gerrit.wikimedia.org/r/131890

Change 131890 abandoned by Withoutaname:
Expand Database.php delete() function parameter list

https://gerrit.wikimedia.org/r/131890

Krinkle renamed this task from Add options parameter to delete() to Add options parameter to Database::delete().Dec 10 2014, 2:11 PM
Krinkle added a project: Technical-Debt.
Krinkle set Security to None.
Krinkle removed a subscriber: Unknown Object (MLST).
Aklapper changed the subtype of this task from "Task" to "Feature Request".Feb 4 2022, 12:24 PM
Krinkle subscribed.

As I understand it we don't want to support this for replication safety reasons. Deletion statements should not be limited in this way, but rather select by primary key in batches, and then delete those in chunks.

The mentioned script (cleanupRemovedModules) no longer needs this afaik.