https://docs.djangoproject.com/en/dev/ref/models/querysets/#select-for-
update
{{{
Currently, the postgresql, oracle, and mysql database backends support
select_for_update(). However, MySQL doesn’t support the nowait,
skip_locked, and of arguments.
Passing nowait=True, skip_locked=True, or of to select_for_update() using
database backends that do not support these options, such as MySQL, raises
a NotSupportedError. This prevents code from unexpectedly blocking.
}}}
However MySQL added support for nowait and skip locked since version 8, as
documented here:
https://dev.mysql.com/doc/refman/8.0/en/innodb-locking-reads.html
--
Ticket URL: <https://code.djangoproject.com/ticket/30928>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* keywords: mysql => mysql mariadb
* type: Bug => Cleanup/optimization
* stage: Unreviewed => Accepted
Comment:
Thanks, good catch. We should also update
[https://docs.djangoproject.com/en/2.2/ref/databases/#row-locking-with-
queryset-select-for-update row-locking-with-queryset-select-for-update]
and it will be good to mention MariaDB in the `select_for_update()`
[https://docs.djangoproject.com/en/dev/ref/models/querysets/#select-for-
update documentation]. Please remember that both don't support the `of`
argument.
--
Ticket URL: <https://code.djangoproject.com/ticket/30928#comment:1>
* owner: nobody => Kolawole Nafiu Erinoso
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/30928#comment:2>
Comment (by Kolawole Nafiu Erinoso):
The changes for the fix reside in this branch https://github.com/kola-
er/django/tree/ticket_30928_2_2.
Note that the changes do not include MariaDB because the documentation as
a whole specifically listed the supported database backends (PostgreSQL,
MySQL, Oracle and SQLite) without the mention of it even though it's a
variant of MySQL. In addition, there's an explicit omission of MariaDB
backend done within the codebase here
https://github.com/django/django/blob/stable/2.2.x/django/db/backends/mysql/features.py#L94
for the options.
--
Ticket URL: <https://code.djangoproject.com/ticket/30928#comment:3>
Comment (by Kolawole Nafiu Erinoso):
Here's the PR https://github.com/django/django/pull/12015 ready for
review.
--
Ticket URL: <https://code.djangoproject.com/ticket/30928#comment:4>
Comment (by CarlosMirdeSouza):
The PR is closed, please update the PR to an open one.
--
Ticket URL: <https://code.djangoproject.com/ticket/30928#comment:5>
Comment (by Kolawole Nafiu Erinoso):
Here's the new PR https://github.com/django/django/pull/12018 ready for
review.
--
Ticket URL: <https://code.djangoproject.com/ticket/30928#comment:6>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"a5b4a909f09955d164c3462ae32a45aa1fdd6f2d" a5b4a909]:
{{{
#!CommitTicketReference repository=""
revision="a5b4a909f09955d164c3462ae32a45aa1fdd6f2d"
[3.0.x] Fixed #30928 -- Clarified MySQL/MariaDB support of
QuerySet.select_for_update() options.
Thanks Par Andersson for reporting the issue.
Backport of d94d7b113c21d7a0fd802fadb1adbbec8155e880 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30928#comment:7>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"d94d7b113c21d7a0fd802fadb1adbbec8155e880" d94d7b11]:
{{{
#!CommitTicketReference repository=""
revision="d94d7b113c21d7a0fd802fadb1adbbec8155e880"
Fixed #30928 -- Clarified MySQL/MariaDB support of
QuerySet.select_for_update() options.
Thanks Par Andersson for reporting the issue.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30928#comment:8>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"22466f91dccf440fa8b0aff3610ed51dbb25403b" 22466f91]:
{{{
#!CommitTicketReference repository=""
revision="22466f91dccf440fa8b0aff3610ed51dbb25403b"
[2.2.x] Fixed #30928 -- Clarified MySQL/MariaDB support of
QuerySet.select_for_update() options.
Thanks Par Andersson for reporting the issue.
Backport of d94d7b113c21d7a0fd802fadb1adbbec8155e880 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30928#comment:9>