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

2024-01-07 Thread Amul Sul
On Fri, Jan 5, 2024 at 12:28 AM Peter Eisentraut wrote: > On 25.12.23 13:10, Amul Sul wrote: > > > I have committed this patch set. > > I couple of notes: > > You had included the moving of the AT_PASS_ADD_COL enum in the first > patch. This is not a good style. Refactoring patches should not

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

2024-01-04 Thread Peter Eisentraut
On 25.12.23 13:10, Amul Sul wrote: > 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

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

2023-12-25 Thread Amul Sul
On Mon, Dec 18, 2023 at 3:01 PM Peter Eisentraut 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"

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

2023-12-18 Thread Peter Eisentraut
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

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

2023-12-11 Thread Amul Sul
On Tue, Nov 28, 2023 at 5:40 PM Peter Eisentraut wrote: > On 23.11.23 15:13, Amul Sul wrote: > > The exact sequencing of this seems to be tricky. It's clear that we > > need to do it earlier than at the end. I also think it should be > > strictly after AT_PASS_ALTER_TYPE so that

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

2023-11-28 Thread Peter Eisentraut
On 23.11.23 15:13, Amul Sul wrote: The exact sequencing of this seems to be tricky.  It's clear that we need to do it earlier than at the end.  I also think it should be strictly after AT_PASS_ALTER_TYPE so that the new expression can refer to the new type of a column.  It should

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

2023-11-23 Thread Amul Sul
On Mon, Nov 20, 2023 at 1:12 PM Peter Eisentraut wrote: > On 17.11.23 13:25, Amul Sul wrote: > > To fix this we should be doing something like ALTER COLUMN TYPE and the > pass > > should be AT_PASS_ALTER_TYPE (rename it or invent a new one near to > that) so > > that in ATRewriteCatalogs(), we

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

2023-11-19 Thread Peter Eisentraut
On 17.11.23 13:25, Amul Sul wrote: To fix this we should be doing something like ALTER COLUMN TYPE and the pass should be AT_PASS_ALTER_TYPE (rename it or invent a new one near to that) so that in ATRewriteCatalogs(), we would execute ATPostAlterTypeCleanup(). I simply tried that by doing blind

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

2023-11-17 Thread Amul Sul
On Thu, Nov 16, 2023 at 7:05 PM Amul Sul wrote: > On Thu, Nov 16, 2023 at 2:50 AM Peter Eisentraut > wrote: > >> On 15.11.23 13:26, Amul Sul wrote: >> > 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,

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

2023-11-16 Thread Amul Sul
On Thu, Nov 16, 2023 at 2:50 AM Peter Eisentraut wrote: > On 15.11.23 13:26, Amul Sul wrote: > > 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

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

2023-11-15 Thread Peter Eisentraut
On 15.11.23 13:26, Amul Sul wrote: 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. Hmm, I'm not sure if that is a good

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

2023-11-15 Thread Amul Sul
On Wed, Nov 15, 2023 at 5:09 PM Peter Eisentraut 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

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

2023-11-15 Thread Peter Eisentraut
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

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

2023-11-14 Thread Amul Sul
On Mon, Nov 13, 2023 at 9:09 PM Peter Eisentraut wrote: > On 13.11.23 14:07, Amul Sul wrote: > > Also, it seems to me that the SET EXPRESSION variant should just do > an > > update of the catalog table instead of a drop and re-insert. > > > > I am not sure if that is sufficient; we need

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

2023-11-13 Thread Peter Eisentraut
On 13.11.23 14:07, Amul Sul wrote: Also, it seems to me that the SET EXPRESSION variant should just do an update of the catalog table instead of a drop and re-insert. I am not sure if that is sufficient; we need to get rid of the dependencies of existing expressions on other columns

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

2023-11-13 Thread Amul Sul
On Mon, Nov 13, 2023 at 1:40 PM Peter Eisentraut wrote: > On 09.11.23 13:00, Amul Sul wrote: > > On Tue, Nov 7, 2023 at 8:21 PM Peter Eisentraut > > wrote: > > > > On 25.10.23 08:12, Amul Sul wrote: > > > Here is the rebase version for the latest master >

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

2023-11-13 Thread Peter Eisentraut
On 09.11.23 13:00, Amul Sul wrote: On Tue, Nov 7, 2023 at 8:21 PM Peter Eisentraut > wrote: On 25.10.23 08:12, Amul Sul wrote: > Here is the rebase version for the latest master head(673a17e3120). > > I haven't done any other changes related to

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

2023-11-09 Thread Maxim Orlov
On Thu, 9 Nov 2023 at 15:01, Amul Sul wrote: > > Here is the updated version patch. Did minor changes to documents and > tests. > Overall patch looks good to me. Since Peter did withdraw his comment on triggers and no open problems are present, we can make this patch RfC, shall we? It would be

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

2023-11-09 Thread Amul Sul
On Tue, Nov 7, 2023 at 8:21 PM Peter Eisentraut wrote: > On 25.10.23 08:12, Amul Sul wrote: > > Here is the rebase version for the latest master head(673a17e3120). > > > > I haven't done any other changes related to the ON UPDATE trigger since > that > > seems non-trivial; need a bit of work to

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

2023-11-07 Thread Peter Eisentraut
On 25.10.23 08:12, Amul Sul wrote: Here is the rebase version for the latest master head(673a17e3120). I haven't done any other changes related to the ON UPDATE trigger since that seems non-trivial; need a bit of work to add trigger support in ATRewriteTable(). Also, I am not sure yet, if we

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

2023-10-25 Thread Amul Sul
Here is the rebase version for the latest master head(673a17e3120). I haven't done any other changes related to the ON UPDATE trigger since that seems non-trivial; need a bit of work to add trigger support in ATRewriteTable(). Also, I am not sure yet, if we were doing these changes, and the

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

2023-10-16 Thread Robert Haas
On Fri, Oct 6, 2023 at 9:14 AM Peter Eisentraut wrote: > > 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

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

2023-10-09 Thread Amul Sul
On Fri, Oct 6, 2023 at 6:03 PM Peter Eisentraut 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:

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

2023-10-06 Thread Peter Eisentraut
On 06.10.23 14:57, Ashutosh Bapat wrote: On Fri, Oct 6, 2023 at 6:06 PM Peter Eisentraut 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.

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

2023-10-06 Thread Ashutosh Bapat
On Fri, Oct 6, 2023 at 6:06 PM Peter Eisentraut 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:

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

2023-10-06 Thread Peter Eisentraut
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

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

2023-09-18 Thread Amul Sul
On Thu, Sep 14, 2023 at 7:23 PM Ashutosh Bapat wrote: > Hi Amul, > I share others opinion that this feature is useful. > > >> On Fri, 25 Aug 2023 at 03:06, Vik Fearing > wrote: > >>> > >>> > >>> I don't like this part of the patch at all. Not only is the > >>> documentation only half baked,

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

2023-09-14 Thread Ashutosh Bapat
Hi Amul, I share others opinion that this feature is useful. >> On Fri, 25 Aug 2023 at 03:06, Vik Fearing wrote: >>> >>> >>> I don't like this part of the patch at all. Not only is the >>> documentation only half baked, but the entire concept of the two >>> commands is different. Especially

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

2023-09-14 Thread Amul Sul
On Wed, Sep 13, 2023 at 2:28 PM Maxim Orlov wrote: > Hi! > > I'm pretty much like the idea of the patch. Looks like an overlook in SQL > standard for me. > Anyway, patch apply with no conflicts and implements described > functionality. > > Thank you for looking at this. > On Fri, 25 Aug 2023

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

2023-09-13 Thread Maxim Orlov
Hi! I'm pretty much like the idea of the patch. Looks like an overlook in SQL standard for me. Anyway, patch apply with no conflicts and implements described functionality. On Fri, 25 Aug 2023 at 03:06, Vik Fearing wrote: > > I don't like this part of the patch at all. Not only is the >

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

2023-08-28 Thread Amul Sul
On Fri, Aug 25, 2023 at 5:35 AM Vik Fearing wrote: > On 8/2/23 12:35, Amul Sul wrote: > > Hi, > > > > Currently, we have an option to drop the expression of stored generated > > columns > > as: > > > > ALTER [ COLUMN ] column_name DROP EXPRESSION [ IF EXISTS ] > > > > But don't have support to

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

2023-08-28 Thread Amul Sul
On Thu, Aug 24, 2023 at 9:36 AM Vaibhav Dalvi < vaibhav.da...@enterprisedb.com> wrote: > Hi Amul, > > > On Wed, Aug 2, 2023 at 4:06 PM Amul Sul wrote: > >> Hi, >> >> Currently, we have an option to drop the expression of stored generated >> columns >> as: >> >> ALTER [ COLUMN ] column_name DROP

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

2023-08-24 Thread Vik Fearing
On 8/2/23 12:35, Amul Sul wrote: Hi, Currently, we have an option to drop the expression of stored generated columns as: ALTER [ COLUMN ] column_name DROP EXPRESSION [ IF EXISTS ] But don't have support to update that expression. The attached patch provides that as: ALTER [ COLUMN ]

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

2023-08-23 Thread Vaibhav Dalvi
Hi Amul, On Wed, Aug 2, 2023 at 4:06 PM Amul Sul wrote: > Hi, > > Currently, we have an option to drop the expression of stored generated > columns > as: > > ALTER [ COLUMN ] column_name DROP EXPRESSION [ IF EXISTS ] > > But don't have support to update that expression. The attached patch >

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

2023-08-22 Thread Vik Fearing
On 8/2/23 12:35, Amul Sul wrote: Hi, Currently, we have an option to drop the expression of stored generated columns as: ALTER [ COLUMN ] column_name DROP EXPRESSION [ IF EXISTS ] But don't have support to update that expression. The attached patch provides that as: ALTER [ COLUMN ]

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

2023-08-22 Thread ajitpostgres awekar
The following review has been posted through the commitfest application: make installcheck-world: tested, passed Implements feature: tested, passed Spec compliant: tested, passed Documentation:tested, passed Hi Amul, Patch changes look fine. Below are some of my

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

2023-08-03 Thread jian he
On Thu, Aug 3, 2023 at 1:23 PM Amul Sul wrote: > > > That is not expected & acceptable. But, somehow, I am not able to reproduce > this behavior. Could you please retry this experiment by adding "table_schema" > in your output query? > > Thank you. > > Regards, > Amul > sorry. my mistake. I

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

2023-08-02 Thread Amul Sul
On Wed, Aug 2, 2023 at 9:16 PM jian he wrote: > On Wed, Aug 2, 2023 at 6:36 PM Amul Sul wrote: > > > > Hi, > > > > Currently, we have an option to drop the expression of stored generated > columns > > as: > > > > ALTER [ COLUMN ] column_name DROP EXPRESSION [ IF EXISTS ] > > > > But don't have

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

2023-08-02 Thread jian he
On Wed, Aug 2, 2023 at 6:36 PM Amul Sul wrote: > > Hi, > > Currently, we have an option to drop the expression of stored generated > columns > as: > > ALTER [ COLUMN ] column_name DROP EXPRESSION [ IF EXISTS ] > > But don't have support to update that expression. The attached patch provides >

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

2023-08-02 Thread Amul Sul
Hi, Currently, we have an option to drop the expression of stored generated columns as: ALTER [ COLUMN ] column_name DROP EXPRESSION [ IF EXISTS ] But don't have support to update that expression. The attached patch provides that as: ALTER [ COLUMN ] column_name SET EXPRESSION expression Note