summaryrefslogtreecommitdiff
path: root/django/db/backends/postgresql/operations.py
diff options
context:
space:
mode:
authorДилян Палаузов <Dilyan.Palauzov@db.com>2018-01-03 18:52:12 -0500
committerTim Graham <timograham@gmail.com>2018-01-03 20:12:23 -0500
commitd7b2aa24f75434c2ce50100cfef3586071e0747a (patch)
tree9074eb7522888e744f948c52174f367a4281c200 /django/db/backends/postgresql/operations.py
parentc2d0f8c084456b5073252a91eeb09ab3d7453b18 (diff)
downloaddjango-d7b2aa24f75434c2ce50100cfef3586071e0747a.tar.gz
Fixed #28982 -- Simplified code with and/or.
Diffstat (limited to 'django/db/backends/postgresql/operations.py')
-rw-r--r--django/db/backends/postgresql/operations.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/django/db/backends/postgresql/operations.py b/django/db/backends/postgresql/operations.py
index 06a46f4303..3b71cd4f2c 100644
--- a/django/db/backends/postgresql/operations.py
+++ b/django/db/backends/postgresql/operations.py
@@ -131,11 +131,9 @@ class DatabaseOperations(BaseDatabaseOperations):
sql = []
for sequence_info in sequences:
table_name = sequence_info['table']
- column_name = sequence_info['column']
- if not column_name:
- # This will be the case if it's an m2m using an autogenerated
- # intermediate table (see BaseDatabaseIntrospection.sequence_list)
- column_name = 'id'
+ # 'id' will be the case if it's an m2m using an autogenerated
+ # intermediate table (see BaseDatabaseIntrospection.sequence_list).
+ column_name = sequence_info['column'] or 'id'
sql.append("%s setval(pg_get_serial_sequence('%s','%s'), 1, false);" % (
style.SQL_KEYWORD('SELECT'),
style.SQL_TABLE(self.quote_name(table_name)),