summaryrefslogtreecommitdiff
path: root/django/db/backends/postgresql/operations.py
diff options
context:
space:
mode:
authorRavindar Sharma <ravindar24sharma@gmail.com>2020-07-12 18:31:06 +0530
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-07-17 08:16:32 +0200
commit18d4eac7fce6dfab6149ec7aba72f3c765b5722c (patch)
tree237436f60bb001228f606217283b6601a7cee35e /django/db/backends/postgresql/operations.py
parent5ef6f626347f9ea13915f3cf5b8b045c5b42b102 (diff)
downloaddjango-18d4eac7fce6dfab6149ec7aba72f3c765b5722c.tar.gz
Fixed #31731 -- Removed unreachable code for resetting sequences of auto-created m2m tables in sequence_reset_sql().
Unreachable because f.remote_field.through is truthy for all m2m fields. Resetting sequences of auto-created m2m tables in sequence_reset_sql() is also unnecessary: - in sqlsequencereset since c39ec6dccb389fbb4047e44f5247e18bb76ae598 because auto-created tables are included in model_list, - in loaddata because there is no it need to reset sequences for models not loaded directly. - in create_default_site() because it doesn't have m2m fields.
Diffstat (limited to 'django/db/backends/postgresql/operations.py')
-rw-r--r--django/db/backends/postgresql/operations.py15
1 files changed, 0 insertions, 15 deletions
diff --git a/django/db/backends/postgresql/operations.py b/django/db/backends/postgresql/operations.py
index 51374cb3bb..a3442231af 100644
--- a/django/db/backends/postgresql/operations.py
+++ b/django/db/backends/postgresql/operations.py
@@ -185,21 +185,6 @@ class DatabaseOperations(BaseDatabaseOperations):
)
)
break # Only one AutoField is allowed per model, so don't bother continuing.
- for f in model._meta.many_to_many:
- if not f.remote_field.through:
- output.append(
- "%s setval(pg_get_serial_sequence('%s','%s'), "
- "coalesce(max(%s), 1), max(%s) %s null) %s %s;" % (
- style.SQL_KEYWORD('SELECT'),
- style.SQL_TABLE(qn(f.m2m_db_table())),
- style.SQL_FIELD('id'),
- style.SQL_FIELD(qn('id')),
- style.SQL_FIELD(qn('id')),
- style.SQL_KEYWORD('IS NOT'),
- style.SQL_KEYWORD('FROM'),
- style.SQL_TABLE(qn(f.m2m_db_table()))
- )
- )
return output
def prep_for_iexact_query(self, x):