| 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-12-25 12:10:09 |
| Message-ID: | CAAJ_b944uerJG+hsXYtBvULoddRFfXGB7i2C2VQ6Bcd7R6E4BQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Mon, Dec 18, 2023 at 3:01 PM Peter Eisentraut <peter(at)eisentraut(dot)org>
wrote:
> 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.
>
(Sorry, for the delay)
Agree. I did that change in 0001 patch.
Regards,
Amul
| Attachment | Content-Type | Size |
|---|---|---|
| v7-0001-Code-refactor-convert-macro-listing-to-enum.patch | application/octet-stream | 3.8 KB |
| v7-0002-Code-refactor-separate-function-to-find-all-depen.patch | application/octet-stream | 21.0 KB |
| v7-0003-Allow-to-change-generated-column-expression.patch | application/octet-stream | 38.9 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Nazir Bilal Yavuz | 2023-12-25 13:09:34 | Re: Show WAL write and fsync stats in pg_stat_io |
| Previous Message | Ayush Vatsa | 2023-12-25 11:40:40 | Re: Proposal to include --exclude-extension Flag in pg_dump |