diff --git a/django/core/db/backends/postgresql.py b/django/core/db/backends/postgresql.py index c2eb072cdb..f70e8366f1 100644 --- a/django/core/db/backends/postgresql.py +++ b/django/core/db/backends/postgresql.py @@ -67,7 +67,7 @@ def dictfetchall(cursor): return cursor.dictfetchall() def get_last_insert_id(cursor, table_name, pk_name): - cursor.execute("SELECT CURRVAL('%s_%s_seq')" % (table_name, pk_name)) + cursor.execute("SELECT CURRVAL('\"%s_%s_seq\"')" % (table_name, pk_name)) return cursor.fetchone()[0] def get_date_extract_sql(lookup_type, table_name):