From 843613add4d5e7493140fedd10c40c41706b68a8 Mon Sep 17 00:00:00 2001 From: Shai Berger Date: Fri, 25 Apr 2014 01:30:43 +0300 Subject: [PATCH] Fixed #22498 -- constraint name was not quoted in FK creation SQL --- django/db/backends/schema.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/django/db/backends/schema.py b/django/db/backends/schema.py index fe28be92bc..b3f58b48d6 100644 --- a/django/db/backends/schema.py +++ b/django/db/backends/schema.py @@ -419,11 +419,11 @@ class BaseDatabaseSchemaEditor(object): to_column = field.rel.to._meta.get_field(field.rel.field_name).column self.deferred_sql.append( self.sql_create_fk % { - "name": '%s_refs_%s_%x' % ( + "name": self.quote_name('%s_refs_%s_%x' % ( field.column, to_column, abs(hash((model._meta.db_table, to_table))) - ), + )), "table": self.quote_name(model._meta.db_table), "column": self.quote_name(field.column), "to_table": self.quote_name(to_table),