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

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
Cc: Amul Sul <sulamul(at)gmail(dot)com>, 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-06 13:13:57
Message-ID: fbc544ee-5c16-dff2-0f74-bcffb0a0aa1d@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 06.10.23 14:57, Ashutosh Bapat wrote:
> On Fri, Oct 6, 2023 at 6:06 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.
>
> Should we treat it the same fashion as ALTER COLUMN ... TYPE which
> rewrites the column values? Of course that rewrites the whole table,
> but logically they are comparable.

I don't know. What are the semantics of that command with respect to
triggers and logical decoding?

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2023-10-06 13:44:40 Re: Allow tests to pass in OpenSSL FIPS mode
Previous Message Peter Eisentraut 2023-10-06 13:11:50 Add const to values and nulls arguments