diff options
author | Ville Skyttä <ville.skytta@iki.fi> | 2015-09-12 22:06:35 +0300 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2015-09-14 12:25:08 -0400 |
commit | 4d933ad4181a511f3ced98edba4e17aff054e0e2 (patch) | |
tree | 25cda0af854de4c497182a1993123ec3745e6bf6 /django/db/backends/mysql/schema.py | |
parent | b8b776aabe9afcd771f5c49afd2b41b44cae65a4 (diff) | |
download | django-4d933ad4181a511f3ced98edba4e17aff054e0e2.tar.gz |
Fixed #25393 -- Fixed MySQL crash when adding text/blob field with unhashable default.
Diffstat (limited to 'django/db/backends/mysql/schema.py')
-rw-r--r-- | django/db/backends/mysql/schema.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/django/db/backends/mysql/schema.py b/django/db/backends/mysql/schema.py index e803a4452c..ef4ccf51db 100644 --- a/django/db/backends/mysql/schema.py +++ b/django/db/backends/mysql/schema.py @@ -50,7 +50,8 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): super(DatabaseSchemaEditor, self).add_field(model, field) # Simulate the effect of a one-off default. - if self.skip_default(field) and field.default not in {None, NOT_PROVIDED}: + # field.default may be unhashable, so a set isn't used for "in" check. + if self.skip_default(field) and field.default not in (None, NOT_PROVIDED): effective_default = self.effective_default(field) self.execute('UPDATE %(table)s SET %(column)s = %%s' % { 'table': self.quote_name(model._meta.db_table), |