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 08:37:20 +0200
commit2e8941b6f90e65ffad3f07083b8de59e8ed29767 (patch)
tree6670a9b68ad06460f22af02312db4c8a617aa08c /django/db/backends/postgresql/schema.py
parent6f3e3e87ab72eb64dcce8e646f8eea07be6c3b7e (diff)
downloaddjango-2e8941b6f90e65ffad3f07083b8de59e8ed29767.tar.gz
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.
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 fbc4a59dc4..7687c37fe7 100644
--- a/django/db/backends/postgresql/schema.py
+++ b/django/db/backends/postgresql/schema.py
@@ -27,7 +27,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.