Re: ALTER COLUMN to change GENERATED ALWAYS AS expression?

Поиск
Список
Период
Сортировка
От Philip Semanchuk
Тема Re: ALTER COLUMN to change GENERATED ALWAYS AS expression?
Дата
Msg-id B728C50A-9EF1-4E13-82D8-B6CEAFC51B1F@americanefficient.com
обсуждение исходный текст
Ответ на Re: ALTER COLUMN to change GENERATED ALWAYS AS expression?  (Laurenz Albe <laurenz.albe@cybertec.at>)
Ответы Re: ALTER COLUMN to change GENERATED ALWAYS AS expression?  (Adrian Klaver <adrian.klaver@aklaver.com>)
Список pgsql-general

> On Feb 7, 2023, at 3:30 AM, Laurenz Albe <laurenz.albe@cybertec.at> wrote:
>
> On Mon, 2023-02-06 at 12:04 -0500, Philip Semanchuk wrote:
>> 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?
>
> I think that is correct.  But changing the expression would mean rewriting the column
> anyway.  The only downside is that a dropped column remains in the table, and no even
> a VACUUM (FULL) will get rid of it.

Thanks for the confirmation. I hadn’t realized that the column would remain in the table even after a DROP + VACUUM
FULL.I’m curious — its presence as a deleted column doesn't  affect performance in any meaningful way, does it?  

In this case we have the option of dropping and re-creating the table entirely, and that's probably what I'll do.

Cheers
Philip


В списке pgsql-general по дате отправления:

Предыдущее
От: Giovanni Biscontini
Дата:
Сообщение: Re: PostgreSQL
Следующее
От: Laurenz Albe
Дата:
Сообщение: Re: PostgreSQL