Re: [HACKERS] Adding the optional clause 'AS' in CREATE TRIGGER

Поиск
Список
Период
Сортировка
От Okano, Naoki
Тема Re: [HACKERS] Adding the optional clause 'AS' in CREATE TRIGGER
Дата
Msg-id 0B4917A40C80E34BBEC4BE1A7A9AB7E27A631D@g01jpexmbkw05
обсуждение исходный текст
Ответ на Re: Adding the optional clause 'AS' in CREATE TRIGGER  ("Okano, Naoki" <okano.naoki@jp.fujitsu.com>)
Ответы Re: [HACKERS] Adding the optional clause 'AS' in CREATE TRIGGER  (Robert Haas <robertmhaas@gmail.com>)
Re: [HACKERS] Adding the optional clause 'AS' in CREATE TRIGGER  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Список pgsql-hackers
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

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Fabien COELHO
Дата:
Сообщение: Re: \if, \elseif, \else, \endif (was Re: [HACKERS] PSQL commands:\quit_if, \quit_unless)
Следующее
От: "Ideriha, Takeshi"
Дата:
Сообщение: Re: [WIP] RE: [HACKERS] DECLARE STATEMENT setting up a connectionin ECPG