Re: BUG #17970: FEATURE REQUEST-allow re-adding GENERATED ALWAYS AS constraint to existing columns after removing it

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #17970: FEATURE REQUEST-allow re-adding GENERATED ALWAYS AS constraint to existing columns after removing it
Дата
Msg-id 1636674.1686669171@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #17970: FEATURE REQUEST-allow re-adding GENERATED ALWAYS AS constraint to existing columns after removing it  (PG Bug reporting form <noreply@postgresql.org>)
Список pgsql-bugs
PG Bug reporting form <noreply@postgresql.org> writes:
> From what I know, it is possible to transform a GENERATED ALWAYS AS ..
> STORED column into a normal one, by using:
> ALTER TABLE items ALTER COLUMN transformed_id DROP EXPRESSION;
> But the reverse (i.e. re-adding the "GENERATED ALWAYS AS .. STORED" part to
> an existing column) is not possible.

Just drop the column and re-add it.  The system would have to recompute
all the entries anyway, so I can't get excited about offering a shortcut.

> I think this is a contradiction, because, by modifying the underlying
> function, I am able to insert incoherent values in the generated column,

As David mentioned, that is not considered a supported thing.  We cannot
enforce it (look up the "halting problem" sometime), but if you change
an immutable function's behavior then ensuing problems are your fault
not Postgres'.

            regards, tom lane



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

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: BUG #17970: FEATURE REQUEST-allow re-adding GENERATED ALWAYS AS constraint to existing columns after removing it
Следующее
От: PG Bug reporting form
Дата:
Сообщение: BUG #17972: Assert failed in pull_varattnos_walker() for view with subquery and security qual