#30800 closed Bug (fixed)
Altering field crashes for fields with custom db_type() on PostgreSQL.
| Reported by: | Mariusz Felisiak | Owned by: | Mariusz Felisiak |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | 3.0 |
| Severity: | Release blocker | Keywords: | |
| Cc: | Hasan Ramezani | Triage Stage: | Accepted |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Altering field crashes for fields with a custom db_type() on PostgreSQL, e.g. ArrayField:
def db_type(self, connection):
size = self.size or ''
return '%s[%s]' % (self.base_field.db_type(connection), size)
Regression in 1378d665a1c85897d951f2ca9618b848fdbba2e7.
File "django/django/db/backends/postgresql/schema.py", line 72, in _alter_column_type_sql
if self._field_data_type(old_field) != self._field_data_type(new_field):
File "django/django/db/backends/postgresql/schema.py", line 45, in _field_data_type
return self.connection.data_types[field.get_internal_type()]
KeyError: 'ArrayField'
Note:
See TracTickets
for help on using tickets.
PR