#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):

 In summary what Postgres 16.5 changed is that you longer can specify
 `USING` on `ALTER COLUMN` for generated columns

 {{{#!sql
 ALTER TABLE "test_gfcof_pony"
 ALTER COLUMN "modified_pink" TYPE numeric(16, 2) USING
 "modified_pink"::numeric(16, 2);
 }}}

 Which makes sense as `USING` is redundant with `TYPE` and could result in
 mismatches.

 Well the solution appears to simply not specifying `USING` when dealing
 with `GeneratedField` alterations as suggested in comment:2

 {{{#!sql
 ALTER TABLE "test_gfcof_pony"
 ALTER COLUMN "modified_pink" TYPE numeric(16, 2);
 }}}
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35969#comment:6>
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/0107019392aa4f55-55f7ae50-2961-4bbb-920e-9c8ac3991155-000000%40eu-central-1.amazonses.com.

Reply via email to