On Tue, Feb 7, 2017 at 3:11 AM, Okano, Naoki <okano.naoki@jp.fujitsu.com> wrote:
> 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.
You should add this to the next CommitFest so it doesn't get missed.
https://commitfest.postgresql.org/
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company