Re: For each statement trigger and update table - Mailing list pgsql-sql

From Rene Romero Benavides
Subject Re: For each statement trigger and update table
Date
Msg-id CANaGW08w6yEZk-BiEmfG7O6dvV3gt_hmrwnB56oxyy7a0agSyg@mail.gmail.com
Whole thread Raw
In response to Re: For each statement trigger and update table  (Rene Romero Benavides <rene.romero.b@gmail.com>)
Responses Re: For each statement trigger and update table
Re: For each statement trigger and update table
List pgsql-sql
Mike, please include to the mailing list as well, so others can help you out too. Why do you need the trigger to be FOR EACH STATEMENT? so I can understand your use case, even if it's simple stuff, please share with us your code. 

On Fri, Jan 3, 2020 at 6:06 PM Rene Romero Benavides <rene.romero.b@gmail.com> wrote:
Oh, so you're defining transition relations (REFERENCING NEW TABLE, OLD TABLE ) as in here?
CREATE TRIGGER paired_items_update   AFTER UPDATE ON paired_items   REFERENCING NEW TABLE AS newtab OLD TABLE AS oldtab   FOR EACH ROW   EXECUTE FUNCTION check_matching_pairs();

On Fri, Jan 3, 2020 at 5:55 PM Mike Martin <mike@redtux.plus.com> wrote:
According to the docs, not possible to use a transition table and column list together 

On Fri, 3 Jan 2020, 23:39 Rene Romero Benavides, <rene.romero.b@gmail.com> wrote:
>  I can give code when I get home, but it's pretty simple stuff 
please do so, along with your trigger definition. Are you aware that you can define your update trigger to fire on a specific column?

For UPDATE events, it is possible to specify a list of columns using this syntax:

UPDATE OF column_name1 [, column_name2 ... ]


On Fri, Jan 3, 2020 at 5:21 PM Mike Martin <mike@redtux.plus.com> wrote:
Not sure if this is possible
Basically I want to have a trigger which updates an array column in the same table when a column is updated
This works as a row level trigger, but not as per statement
I have hit the recursive issue (where update fires update trigger which fires etc)
According to the docs I cannot use columns and relative tables together

So any suggestions? I can give code when I get home, but it's pretty simple stuff 


--
El genio es 1% inspiración y 99% transpiración.
Thomas Alva Edison
http://pglearn.blogspot.mx/



--
El genio es 1% inspiración y 99% transpiración.
Thomas Alva Edison
http://pglearn.blogspot.mx/



--
El genio es 1% inspiración y 99% transpiración.
Thomas Alva Edison
http://pglearn.blogspot.mx/

pgsql-sql by date:

Previous
From: Rene Romero Benavides
Date:
Subject: Re: For each statement trigger and update table
Next
From: Mike Martin
Date:
Subject: Re: For each statement trigger and update table