Opened 11 months ago

Closed 11 months ago

Last modified 10 months ago

#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 Mariusz Felisiak, 11 months ago

Resolution: wontfix
Status: newclosed
Type: UncategorizedCleanup/optimization

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.

comment:2 by Simon Charette, 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 add support for it in 17 through a non-standard SQL extension.

Version 0, edited 10 months ago by Simon Charette (next)
Note: See TracTickets for help on using tickets.
Back to Top