Re: implementing an out-of-transaction trigger

From: "Iain" <iain(at)mst(dot)co(dot)jp>
To: "Mike Rylander" <mrylander(at)gmail(dot)com>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: implementing an out-of-transaction trigger
Date: 2004-09-16 02:02:25
Message-ID: 008c01c49b91$361e86f0$7201a8c0@mst1x5r347kymb
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi Mike,

Thanks, that's exactly what I was looking for.

A quick quote from the docs:

...if a NOTIFY is executed inside a transaction, the notify events are not
delivered until and unless the transaction is committed. ...if a listening
session receives a notification signal while it is within a transaction, the
notification event will not be delivered to its connected client until just
after the transaction is completed...
This is pretty good so far. Though, as far as I can tell, there is no way to
have the notify activate a pl/pgsql function directly. I'll still need to
write a client program to create a session and actually do the listening,
that is if I havn't missed anything else...

Thanks again,

Iain

----- Original Message -----
From: "Mike Rylander" <mrylander(at)gmail(dot)com>
To: "Iain" <iain(at)mst(dot)co(dot)jp>
Cc: <pgsql-sql(at)postgresql(dot)org>
Sent: Thursday, September 16, 2004 1:03 AM
Subject: Re: [SQL] implementing an out-of-transaction trigger

> >I've come across a situation where I'd like to use some kind of
> "out-of-transaction
> >trigger" to do some processing after changes to some tables, but
> without extending
> >the duration of the main transaction. Of course, it's important that
> the processing be
> >completed so it has to be, as far as possible, reliable and "safe". The
extra
> >processing should be completed within a reasonable time after the
original
> >transaction, but it needn't happen immediately.
>
> Check out
> http://www.postgresql.org/docs/7.4/static/sql-listen.html
> and
> http://www.postgresql.org/docs/7.4/static/sql-notify.html
>
> Then look at the Rules system for generating a NOTIFY:
> http://www.postgresql.org/docs/7.4/static/sql-createrule.html
>
> --miker
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Greg Stark 2004-09-16 03:57:39 Re: implementing an out-of-transaction trigger
Previous Message Mike Rylander 2004-09-15 16:03:11 Re: implementing an out-of-transaction trigger