GeneratedField alteration fail on SQLite due table remake data insertion
A migration where I added an index to a generated column resulted in a migrations that fails with
django.db.utils.OperationalError: cannot INSERT into generated column "effectivePrice"
Change History
(5)
Easy pickings: |
unset
|
Severity: |
Normal → Release blocker
|
Summary: |
db_index=True on a Generated Column generates failing migrations → GeneratedField alteration fail on SQLite due table remake data insertion
|
Triage Stage: |
Unreviewed → Accepted
|
Has patch: |
set
|
Owner: |
changed from nobody to Simon Charette
|
Status: |
new → assigned
|
Triage Stage: |
Accepted → Ready for checkin
|
Resolution: |
→ fixed
|
Status: |
assigned → closed
|
Thank you for your report, a traceback and a description of the backend you are using would have been appreciated.
This looks like a problem isolated to SQLite due to the way
_remake_table
doesn't exclude generated fields from itsINSERT INTO new_table SELECT ... FROM old_table
at table rename time (a necessary step since SQLite doesn't support most table alterations).django/db/backends/sqlite3/schema.py