triggers and NOTIFY

From: Steven Bradley <sbradley(at)llnl(dot)gov>
To: pgsql-interfaces(at)postgreSQL(dot)org
Subject: triggers and NOTIFY
Date: 1999-07-02 00:03:10
Message-ID: 3.0.5.32.19990701170310.0092ba80@poptop.llnl.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)llnl(dot)gov

Browse pgsql-interfaces by date

  From Date Subject
Next Message Ari Halberstadt 1999-07-02 03:36:53 erratic problems with jdbc driver
Previous Message S. Asif Hassan 1999-07-01 21:51:43 Re: