#35969: Changing output_field for GeneratedField leads to ProgrammingError with
Postgres 16.5+
-----------------------------+------------------------------------
Reporter: Ryan Schave | Owner: (none)
Type: Bug | Status: new
Component: Migrations | Version: 5.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+------------------------------------
Comment (by Simon Charette):
Just to make sure before we commit to a solution.
Does Posgres still allows for generated field alterations but disallow
that `USING` is not used? If that's the case it seems like a better
solution would be to have generated field alteration continue to be
supported simply not specify `USING` (which is effectively redundant with
the column type) instead of disabling the feature?
{{{#!diff
diff --git a/django/db/backends/postgresql/schema.py
b/django/db/backends/postgresql/schema.py
index 75bf331472..964009988c 100644
--- a/django/db/backends/postgresql/schema.py
+++ b/django/db/backends/postgresql/schema.py
@@ -120,6 +120,8 @@ def _create_like_index_sql(self, model, field):
return None
def _using_sql(self, new_field, old_field):
+ if new_field.generated:
+ return ""
using_sql = " USING %(column)s::%(type)s"
new_internal_type = new_field.get_internal_type()
old_internal_type = old_field.get_internal_type(
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35969#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/010701939289ee82-29079e01-f4f5-41e1-8b2e-c9d402d27de1-000000%40eu-central-1.amazonses.com.