Re: extension patch of CREATE OR REPLACE TRIGGER
Dilip Kumar <dilipbalaut@gmail.com>
From: Dilip Kumar <dilipbalaut@gmail.com>
To: Peter Smith <smithpb2250@gmail.com>
Cc: "osumi.takamichi@fujitsu.com" <osumi.takamichi@fujitsu.com>, "tsunakawa.takay@fujitsu.com" <tsunakawa.takay@fujitsu.com>,
Tom Lane <tgl@sss.pgh.pa.us>, Michael Paquier <michael@paquier.xyz>, Thomas Munro <thomas.munro@gmail.com>, Surafel Temesgen <surafel3000@gmail.com>,
pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2020-11-07T05:05:58Z
Lists: 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
Commits
-
Provide the OR REPLACE option for CREATE TRIGGER.
- 92bf7e2d0274 14.0 landed