#35061 closed Cleanup/optimization (wontfix)
Modifying GeneratedFields is not supported - not documented under model field reference for GeneratedField
Reported by: | ldeluigi | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 5.0 |
Severity: | Normal | Keywords: | docs |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When I attempted to migrate an alteration of a db-persisted GeneratedField, I got the ValueError:
Modifying GeneratedFields is not supported - the field XYZ must be removed and re-added with the new definition.
I couldn't find help nor hint for that in the documentation, especially under the model field reference for GeneratedField.
I'd like to see that documented, if possible with help for workarounds
Change History (2)
comment:1 by , 11 months ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Type: | Uncategorized → Cleanup/optimization |
comment:2 by , 10 months ago
Not saying we should take any action or revisit supporting recreating generated fields (making alter do an implicit remove + add) but I found it interesting that PostgreSQL was planning to syntactic sugar for it in 17 through a non-standard SQL extension.
Thanks for this ticket, however, raised exception is clear and it contains a hint: "must be removed and re-added". Modifying
GeneratedFields
is not possible in most cases, and even if it's, it still has many db-specific restrictions. This is not something that we want to support and workaround doesn't exists. It's not worth documenting.