ALTER COLUMN to change GENERATED ALWAYS AS expression?

From: Philip Semanchuk <philip(at)americanefficient(dot)com>
To: PostgreSQL General <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: ALTER COLUMN to change GENERATED ALWAYS AS expression?
Date: 2023-02-06 17:04:48
Message-ID: 4C775CB6-D73C-42B6-A94E-40C495AAA521@americanefficient.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,
I have a column defined GENERATED ALWAYS AS {my_expression} STORED. I’d like to change the {my_expression} part. After reading the documentation for ALTER TABLE (https://www.postgresql.org/docs/current/sql-altertable.html) and trying a few things that resulted in syntax errors, there doesn’t seem to be a way to alter the column’s GENERATED expression in place. It seems like my only option is to drop and re-add the column. Is that correct?

Thanks
Philip

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sebastien Flaesch 2023-02-06 17:17:17 Get the sequence name corresponding to a GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY column
Previous Message Erik Wienhold 2023-02-06 13:59:11 Re: Understanding years part of Interval