Re: extension patch of CREATE OR REPLACE TRIGGER - Mailing list pgsql-hackers

From Dilip Kumar
Subject Re: extension patch of CREATE OR REPLACE TRIGGER
Date
Msg-id CAFiTN-vvh8XaDeO9QapGL9E6MffYW6eP7HctEL+tkMpBN8aUxA@mail.gmail.com
Whole thread Raw
In response to Re: extension patch of CREATE OR REPLACE TRIGGER  (Peter Smith <smithpb2250@gmail.com>)
Responses RE: extension patch of CREATE OR REPLACE TRIGGER
List pgsql-hackers
On Sat, Nov 7, 2020 at 10:00 AM Peter Smith <smithpb2250@gmail.com> wrote:
>
> Hello Osumi-san.
>
> I have checked the latest v17 patch w.r.t. to my previous comments.
>
> The v17 patch applies cleanly.
>
> make check is successful.
>
> The regenerated docs look OK.
>
> I have no further review comments, so have flagged this v17 as "ready
> for committer" - https://commitfest.postgresql.org/30/2307/
>

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.

-- 
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Peter Smith
Date:
Subject: Re: extension patch of CREATE OR REPLACE TRIGGER
Next
From: Michael Paquier
Date:
Subject: Re: PG13: message style changes