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: Robert Haas <robertmhaas(at)gmail(dot)com>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(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-11-15 12:26:12
Message-ID: CAAJ_b94TFmQEcA2WGNymsZp4ZHc7G=0W3qLvQ3_OJzniA7qA=Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Nov 15, 2023 at 5:09 PM Peter Eisentraut <peter(at)eisentraut(dot)org>
wrote:

> On 14.11.23 11:40, Amul Sul wrote:
> > Please have a look at the attached version, updating the syntax to have
> "AS"
> > after EXPRESSION and other changes suggested previously.
>
> The code structure looks good to me now.
>

Thank you for your review.

>
> Question: Why are you using AT_PASS_ADD_OTHERCONSTR? I don't know if
> it's right or wrong, but if you have a specific reason, it would be good
> to know.
>

I referred to ALTER COLUMN DEFAULT and used that.

> I think ATExecSetExpression() needs to lock pg_attribute? Did you lose
> that during the refactoring?
>

I have removed that intentionally since we were not updating anything in
pg_attribute like ALTER DROP EXPRESSION.

>
> Tiny comment: The error message in ATExecSetExpression() does not need
> to mention "stored", since it would be also applicable to virtual
> generated columns in the future.
>

I had to have the same thought, but later decided when we do that
virtual column thing, we could simply change that. I am fine to do that
change
now as well, let me know your thought.

> Documentation additions in alter_table.sgml should use one-space indent
> consistently. Also, "This form replaces expression" is missing a "the"?
>

Ok, will fix that.

Regards,
Amul

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2023-11-15 12:53:13 Re: Fix documentation for pg_stat_statements JIT deform_counter
Previous Message Matthias van de Meent 2023-11-15 12:14:44 Re: RFC: Pluggable TOAST