Opened 10 years ago
Closed 10 years ago
#25128 closed Bug (fixed)
SQLite SchemaEditor crashes when adding a ForeignObject field
| Reported by: | Tim Graham | Owned by: | Tim Graham |
|---|---|---|---|
| Component: | Migrations | Version: | 1.8 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Adding a ForeignObject field to an existing model will fail like this on SQLite:
======================================================================
ERROR: test_add_foreign_object (schema.tests.SchemaTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/tim/code/django/tests/schema/tests.py", line 1518, in test_add_foreign_object
editor.add_field(BookForeignObj, new_field)
File "/home/tim/code/django/django/db/backends/sqlite3/schema.py", line 221, in add_field
self._remake_table(model, create_fields=[field])
File "/home/tim/code/django/django/db/backends/sqlite3/schema.py", line 187, in _remake_table
', '.join(self.quote_name(x) for x, y in field_maps),
File "/home/tim/code/django/django/db/backends/sqlite3/schema.py", line 187, in <genexpr>
', '.join(self.quote_name(x) for x, y in field_maps),
File "/home/tim/code/django/django/db/backends/base/schema.py", line 113, in quote_name
return self.connection.ops.quote_name(name)
File "/home/tim/code/django/django/db/backends/sqlite3/operations.py", line 107, in quote_name
if name.startswith('"') and name.endswith('"'):
AttributeError: 'NoneType' object has no attribute 'startswith'
Note:
See TracTickets
for help on using tickets.
PR