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-12-18T09:31:03Z
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 →
-
ALTER TABLE command to change generation expression
- 5d06e99a3cfc 17.0 landed
-
Refactor: separate function to find all objects depending on a column
- d4e66a39eb96 17.0 landed
-
Turn AT_PASS_* macros into an enum
- cea89c93a102 17.0 landed
On 11.12.23 13:22, Amul Sul wrote: > > create table t1 (a int, b int generated always as (a + 1) stored); > alter table t1 add column c int, alter column b set expression as (a > + c); > ERROR: 42703: column "c" does not exist > > I think intuitively, this ought to work. Maybe just moving the new > pass > after AT_PASS_ADD_COL would do it. > > > I think we can't support that (like alter type) since we need to place > this new > pass before AT_PASS_OLD_INDEX & AT_PASS_OLD_CONSTR to re-add indexes and > constraints for the validation. Could we have AT_PASS_ADD_COL before AT_PASS_OLD_*? So overall it would be ... AT_PASS_ALTER_TYPE, AT_PASS_ADD_COL, // moved AT_PASS_SET_EXPRESSION, // new AT_PASS_OLD_INDEX, AT_PASS_OLD_CONSTR, AT_PASS_ADD_CONSTR, ... This appears to not break any existing tests.