1
0
mirror of https://github.com/django/django.git synced 2025-10-31 01:25:32 +00:00

Fixed #25393 -- Fixed MySQL crash when adding text/blob field with unhashable default.

This commit is contained in:
Ville Skyttä
2015-09-12 22:06:35 +03:00
committed by Tim Graham
parent b8b776aabe
commit 4d933ad418
4 changed files with 18 additions and 1 deletions

View File

@@ -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),