triggers and NOTIFY - Mailing list pgsql-interfaces

From Steven Bradley
Subject triggers and NOTIFY
Date
Msg-id 3.0.5.32.19990701170310.0092ba80@poptop.llnl.gov
Whole thread Raw
List pgsql-interfaces
My Problem:
I would like to notify a front-end process when changes are made to a
particular table (table A) and would also like to communicate information
about the changes (ie: which record changed) to the "listening" front end
process via a second table (table B).

My Attempted Solution:
The front-end listening process issues a LISTEN and then calls pqWait() to
wait for a notification.  The way I'm issuing the NOTIFY is through a
trigger which fires when table A is modified.  When the trigger simply
issues the NOTIFY, the front-end process recieves the notification just
fine.  However, when I also try to INSERT a record into table B from within
the trigger (either before or after issuing the NOTIFY), the record gets
inserted into table B, but the front-end application does not recieve a
notification.

What's going on?  Any advice?


Example trigger/function:
 create function f_notify() returns opaque as ' begin
 insert into B values (...); notify wake_up; return NULL;
end;
' language 'plpgsql';


create trigger t_notify after update on A
for each row
execute procedure f_notify();



Thanks in advance...










I am trying to send a NOTIFY to a "listening" process and am using a table
to communicate information about the notific


Steven Bradley
Lawrence Livermore National Laboratory
PO Box 808
Livermore, California 94550
(925) 423-2101       sbradley@llnl.gov


pgsql-interfaces by date:

Previous
From: "S. Asif Hassan"
Date:
Subject: Re:
Next
From: Ari Halberstadt
Date:
Subject: erratic problems with jdbc driver