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

Peter Eisentraut <peter@eisentraut.org>

From: Peter Eisentraut <peter@eisentraut.org>
To: Amul Sul <sulamul@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>, Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>, Vaibhav Dalvi <vaibhav.dalvi@enterprisedb.com>, pgsql-hackers@postgresql.org
Date: 2023-11-15T11:39:30Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. ALTER TABLE command to change generation expression

  2. Refactor: separate function to find all objects depending on a column

  3. Turn AT_PASS_* macros into an enum

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.

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 think ATExecSetExpression() needs to lock pg_attribute?  Did you lose 
that during the refactoring?

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.

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