On Wednesday, November 16, 2016 4:31 PM Okano Naoki wrote: > > But in any case it would be a serious mistake to do this without first > > implementing CREATE OR REPLACE TRIGGER. I think that's an entirely > > separate > > proposal and you would be well advised to treat it as such. > I see. There are more problems than I expected... > Let me start with 'OR REPLACE' clause. I tried to cretae a patch for CREATE OR REPLACE TRIGGER. An example of execution is shown below.
example)
1.define a new trigger
CREATE TRIGGER regular_trigger
AFTER UPDATE ON table_name
REFERENCING OLD TABLE AS oldtable_1 NEW TABLE AS newtable_1
FOR EACH STATEMENT
EXECUTE PROCEDURE func_1();
2.redinfe a trigger in single command
CREATE OR REPLACE TRIGGER regular_trigger
AFTER UPDATE OR DELETE ON table_name
REFERENCING OLD TABLE AS oldtable_2 NEW TABLE AS newtable_2
FOR EACH ROW
EXECUTE PROCEDURE func_2();
If the named trigger does not exist.
a new trigger is also created by using OR REPLACE clause.
A regular trigger cannot be replaced by a constraint trigger and vice varsa.
because a constraint trigger has a different role from regular triger.
Please give me feedback.
Regards,
Okano Naoki
Fujitsu
OR_REPLACE_for_CREATE_TRIGGER_v1.patch
Description: OR_REPLACE_for_CREATE_TRIGGER_v1.patch
-- Sent via pgsql-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
