Re: ALTER COLUMN ... SET EXPRESSION to alter stored generated column's expression

From: Amul Sul <sulamul(at)gmail(dot)com>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: Vaibhav Dalvi <vaibhav(dot)dalvi(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: ALTER COLUMN ... SET EXPRESSION to alter stored generated column's expression
Date: 2023-10-09 13:26:58
Message-ID: CAAJ_b95Mz9w_eTi6MO9R2jOMcMCo-91iLjP9t1iRw7Q_g_V5vw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Oct 6, 2023 at 6:03 PM Peter Eisentraut <peter(at)eisentraut(dot)org>
wrote:

> On 28.08.23 11:54, Amul Sul wrote:
> > Thanks for the review comments, I have fixed those in the attached
> > version. In
> > addition to that, extended syntax to have the STORE keyword as suggested
> by
> > Vik.
>
> An additional comment: When you change the generation expression, you
> need to run ON UPDATE triggers on all rows, if there are any triggers
> defined. That is because someone could have triggers defined on the
> column to either check for valid values or propagate values somewhere
> else, and if the expression changes, that is kind of like an UPDATE.
>
> Similarly, I think we should consider how logical decoding should handle
> this operation. I'd imagine it should generate UPDATE events on all
> rows. A test case in test_decoding would be useful.
>

If I am not mistaken, the existing table rewrite facilities for ALTER TABLE
don't have support to run triggers or generate an event for each row,
right?

Do you expect to write a new code to handle this rewriting?

Regards,
Amul

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Lakhin 2023-10-09 14:00:00 Re: A failure in 031_recovery_conflict.pl on Debian/s390x
Previous Message Michał Kłeczek 2023-10-09 13:09:01 Re: Draft LIMIT pushdown to Append and MergeAppend patch