From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgp(at)gmx(dot)it |
Cc: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #17970: FEATURE REQUEST-allow re-adding GENERATED ALWAYS AS constraint to existing columns after removing it |
Date: | 2023-06-13 15:12:51 |
Message-ID: | 1636674.1686669171@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
PG Bug reporting form <noreply(at)postgresql(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | PG Bug reporting form | 2023-06-13 16:00:01 | BUG #17972: Assert failed in pull_varattnos_walker() for view with subquery and security qual |
Previous Message | David G. Johnston | 2023-06-13 14:45:51 | Re: BUG #17970: FEATURE REQUEST-allow re-adding GENERATED ALWAYS AS constraint to existing columns after removing it |