summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorHannes Ljungberg <hannes@5monkeys.se>2021-10-04 10:20:34 +0200
committerGitHub <noreply@github.com>2021-10-04 10:20:34 +0200
commitd400b08a8baa697905daadd47a6ba12336e93336 (patch)
tree4a89c40317f6e035c79fdabdc70ebe4eb8c2aa5e /docs
parenta3185a670169eb67f1ce5c774fe7af555f80163b (diff)
Fixed #32888 -- Doc'd that select_for_update() only locks tables with selected columns.
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/models/querysets.txt6
1 files changed, 6 insertions, 0 deletions
diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt
index f5bc3b8cb6..01929bc256 100644
--- a/docs/ref/models/querysets.txt
+++ b/docs/ref/models/querysets.txt
@@ -1773,6 +1773,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