diff options
| author | Manuel Weitzman <manuelweitzman@gmail.com> | 2020-05-10 12:25:06 -0400 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-05-21 10:51:10 +0200 |
| commit | a4e6030904df63b3f10aa0729b86dc6942b0458e (patch) | |
| tree | 7a84def5f8bd0e0376a471fa238f74f429e25478 /django/db/backends/base/operations.py | |
| parent | 0e893248b28e30bf562d29e6d5745ffad4b1a1eb (diff) | |
Fixed #30375 -- Added FOR NO KEY UPDATE support to QuerySet.select_for_update() on PostgreSQL.
Diffstat (limited to 'django/db/backends/base/operations.py')
| -rw-r--r-- | django/db/backends/base/operations.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/django/db/backends/base/operations.py b/django/db/backends/base/operations.py index 6d0f5c68b3..2e283a3193 100644 --- a/django/db/backends/base/operations.py +++ b/django/db/backends/base/operations.py @@ -207,11 +207,12 @@ class BaseDatabaseOperations: """ return [] - def for_update_sql(self, nowait=False, skip_locked=False, of=()): + def for_update_sql(self, nowait=False, skip_locked=False, of=(), no_key=False): """ Return the FOR UPDATE SQL clause to lock rows for an update operation. """ - return 'FOR UPDATE%s%s%s' % ( + return 'FOR%s UPDATE%s%s%s' % ( + ' NO KEY' if no_key else '', ' OF %s' % ', '.join(of) if of else '', ' NOWAIT' if nowait else '', ' SKIP LOCKED' if skip_locked else '', |
