[Django] #35061: Modifying GeneratedFields is not supported - not documented under model field reference for GeneratedField

130 views
Skip to first unread message

Django

unread,
Dec 24, 2023, 6:25:29 AM12/24/23
to django-...@googlegroups.com
#35061: Modifying GeneratedFields is not supported - not documented under model
field reference for GeneratedField
-----------------------------------------+------------------------
Reporter: ldeluigi | Owner: nobody
Type: Uncategorized | Status: new
Component: Documentation | Version: 5.0
Severity: Normal | Keywords: docs
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
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

--
Ticket URL: <https://code.djangoproject.com/ticket/35061>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Dec 24, 2023, 3:06:35 PM12/24/23
to django-...@googlegroups.com
#35061: Modifying GeneratedFields is not supported - not documented under model
field reference for GeneratedField
-------------------------------------+-------------------------------------
Reporter: ldeluigi | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Documentation | Version: 5.0
Severity: Normal | Resolution: wontfix

Keywords: docs | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* type: Uncategorized => Cleanup/optimization
* resolution: => wontfix


Comment:

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.

--
Ticket URL: <https://code.djangoproject.com/ticket/35061#comment:1>

Django

unread,
Jan 16, 2024, 12:19:46 PM1/16/24
to django-...@googlegroups.com
#35061: Modifying GeneratedFields is not supported - not documented under model
field reference for GeneratedField
-------------------------------------+-------------------------------------
Reporter: ldeluigi | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Documentation | Version: 5.0
Severity: Normal | Resolution: wontfix
Keywords: docs | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Simon Charette):

Not saying we should take any action or revisit supporting recreating
generated fields (making alter do an implicit remove + add) but
[https://www.depesz.com/2024/01/15/waiting-for-postgresql-17-alter-table-
command-to-change-generation-expression/ I found it interesting that
PostgreSQL was planning to add support for it in 17] through a non-
standard SQL extension.

--
Ticket URL: <https://code.djangoproject.com/ticket/35061#comment:2>

Reply all
Reply to author
Forward
0 new messages