diff options
| author | Hannes Ljungberg <hannes@5monkeys.se> | 2021-10-04 10:20:34 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-10-04 10:21:08 +0200 |
| commit | 816e80930251497635b97a772cc832edf09cdede (patch) | |
| tree | 1682b37b0f51a8330811e6de16953ae1ee0d9494 /docs | |
| parent | 7fa946c76b25ec84752d0ddf6d4afb0cfdc25c93 (diff) | |
[4.0.x] Fixed #32888 -- Doc'd that select_for_update() only locks tables with selected columns.
Backport of d400b08a8baa697905daadd47a6ba12336e93336 from main
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/models/querysets.txt | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt index 6a4ec0fb05..fa11555271 100644 --- a/docs/ref/models/querysets.txt +++ b/docs/ref/models/querysets.txt @@ -1775,6 +1775,12 @@ to refer to the queryset's model. Restaurant.objects.select_for_update(of=('self', 'place_ptr')) +.. admonition:: Using ``select_for_update(of=(...))`` with specified fields + + If you want to lock models and specify selected fields, e.g. using + :meth:`values`, you must select at least one field from each model in the + ``of`` argument. Models without selected fields will not be locked. + On PostgreSQL only, you can pass ``no_key=True`` in order to acquire a weaker lock, that still allows creating rows that merely reference locked rows (through a foreign key, for example) while the lock is in place. The |
