Note that MySQL supports DELETE w/ LIMIT too

This commit is contained in:
Klaas van Schelven
2024-10-09 09:58:47 +02:00
parent 782bb81b82
commit c56611bc82

View File

@@ -272,8 +272,8 @@ def evict_for_irrelevance(
def delete_with_limit(qs, limit):
# Django does not support this out of the box (i.e. it does not support LIMIT in DELETE queries). Sqlite does in
# fact support it (whereas many other DBs do not), so we reach down into Django's internals to get this done.
# Django does not support this out of the box (i.e. it does not support LIMIT in DELETE queries). Both Sqlite and
# MySQL do in fact support it (whereas many other DBs do not), so we just reach down into Django's internals.
sql, params = SQLDeleteCompiler(qs.query, connection, 'default').as_sql()
limited_sql = sql + " LIMIT %s"
limited_params = params + (limit,)