RE: extension patch of CREATE OR REPLACE TRIGGER

From: "osumi(dot)takamichi(at)fujitsu(dot)com" <osumi(dot)takamichi(at)fujitsu(dot)com>
To: 'Dilip Kumar' <dilipbalaut(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>
Cc: "tsunakawa(dot)takay(at)fujitsu(dot)com" <tsunakawa(dot)takay(at)fujitsu(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Michael Paquier <michael(at)paquier(dot)xyz>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Surafel Temesgen <surafel3000(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: RE: extension patch of CREATE OR REPLACE TRIGGER
Date: 2020-11-09 03:27:55
Message-ID: OSBPR01MB48883C847E6E2C048FB22EF7EDEA0@OSBPR01MB4888.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Saturday, Nov 7, 2020 2:06 PM Dilip Kumar <dilipbalaut(at)gmail(dot)com> wrote:
> The patch looks fine to me however I feel that in the test case there are a lot
> of duplicate statement which can be reduced e.g.
> +-- 1. Overwrite existing regular trigger with regular trigger
> (without OR REPLACE)
> +create trigger my_trig
> + after insert on my_table
> + for each row execute procedure funcA(); create trigger my_trig
> + after insert on my_table
> + for each row execute procedure funcB(); -- should fail drop trigger
> +my_trig on my_table;
> +
> +-- 2. Overwrite existing regular trigger with regular trigger (with OR
> +REPLACE) create trigger my_trig
> + after insert on my_table
> + for each row execute procedure funcA(); insert into my_table values
> +(1); create or replace trigger my_trig
> + after insert on my_table
> + for each row execute procedure funcB(); -- OK insert into my_table
> +values (1); drop trigger my_trig on my_table;
>
> In this test, test 1 failed because it tried to change the trigger function without
> OR REPLACE, which is fine but now test 2 can continue from there, I mean we
> don't need to drop the trigger at end of the
> test1 and then test2 can try it with OR REPLACE syntax. This way we can
> reduce the extra statement execution which is not necessary.
OK. That makes sense.

Attached the revised version.
The tests in this patch should not include redundancy.
I checked the tests of trigger replacement for partition tables as well.

Here, I did not and will not delete the comments with numbering from 1 to 8 so that
other developers can check if the all cases are listed up or not easily.

Best,
Takamichi Osumi

Attachment Content-Type Size
CREATE_OR_REPLACE_TRIGGER_v18.patch application/octet-stream 28.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andy Fan 2020-11-09 03:28:59 Re: Hybrid Hash/Nested Loop joins and caching results from subplans
Previous Message Kyotaro Horiguchi 2020-11-09 02:48:51 Re: Some doubious code in pgstat.c