summaryrefslogtreecommitdiff
path: root/django/db/backends/postgresql/schema.py
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2020-06-23 23:43:22 -0400
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-06-24 09:00:22 +0200
commit453a5bf3024ed385f95f2f9a5378d8fc03baffc2 (patch)
tree8d9c15becafce0c1fe5c9f146a2ed4319af800e7 /django/db/backends/postgresql/schema.py
parentf22f660a33f507d3a3b3aa2bff7734df1dfea6f8 (diff)
[3.0.x] Fixed #31735 -- Fixed migrations crash on namespaced inline FK addition on PostgreSQL.
The namespace of the constraint must be included when making the constraint immediate. Regression in 22ce5d0031bd795ade081394043833e82046016c. Thanks Rodrigo Estevao for the report. Backport of 2e8941b6f90e65ffad3f07083b8de59e8ed29767 from master
Diffstat (limited to 'django/db/backends/postgresql/schema.py')
-rw-r--r--django/db/backends/postgresql/schema.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/django/db/backends/postgresql/schema.py b/django/db/backends/postgresql/schema.py
index 62e0bf95fd..233eb10eb3 100644
--- a/django/db/backends/postgresql/schema.py
+++ b/django/db/backends/postgresql/schema.py
@@ -23,7 +23,7 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
# transaction.
sql_create_column_inline_fk = (
'CONSTRAINT %(name)s REFERENCES %(to_table)s(%(to_column)s)%(deferrable)s'
- '; SET CONSTRAINTS %(name)s IMMEDIATE'
+ '; SET CONSTRAINTS %(namespace)s%(name)s IMMEDIATE'
)
# Setting the constraint to IMMEDIATE runs any deferred checks to allow
# dropping it in the same transaction.