django
django copied to clipboard
Fixed #10088 -- Added QuerySet.select_for_share().
Initial work to address ticket-10088.
Alternative to #15939 and #16172.
Thought I'd get this out there as I've been sitting on it for a couple of years. I've rebased it.
- Adds support for
nowait
,skip_locked
,of
andkey
options-
Note that
select_for_update()
hasno_key
, butselect_for_share()
haskey
-
Note that
- Adds support for
LOCK IN SHARE MODE
for MariaDB ~and MySQL < 8.0.1~ (Django 5.0 will support MySQL 8.0.11+) - Implements support of
for_share_after_from
likefor_update_after_from
used by MSSQL backend - Shared documentation for
select_for_share()
andselect_for_update()
as very similar - Shared tests for
select_for_share()
andselect_for_update()
as very similar
The patch is quite mature, but there is still some work to be done:
- [ ] Properly implement the "blocking" tests using other thread for
FOR SHARE
case - [x] Determine what to do about
subTest()
not supportingskipTest()
- Have split into separate test modules with some preliminary refactoring to make things more maintainable.
- [x] Review whether anything has been missed. I've rebased this but it was written a long time ago...
I've marked this as a draft because of needing to think about the testing issues, but it's ready for a first round of review.
Have pushed progress so far. Still some tidying up to be done, fixing some tests, etc.
So no review required yet.
buildbot, test on oracle.