executing a procedure with delay

Started by Ottavio Campanaover 18 years ago3 messagesgeneral
Jump to latest
#1Ottavio Campana
ottavio@campana.vi.it

I'd like to execute a stored procedure in postgresql one minute after a
table has been modified. In case there are two changes in less than one
minute, I want to reset the time that has to be waited before running
the procedure.

I think I need to use a trigger, but I don't know how...

Can you help me please?

--
Non c'e' piu' forza nella normalita', c'e' solo monotonia.

#2Pavel Stehule
pavel.stehule@gmail.com
In reply to: Ottavio Campana (#1)
Re: executing a procedure with delay

Hello

you can use pg_sleep function. But using it in trigger is ugly,
because transaction stay in open state. Look to orafce on intersession
communication. Maybe you can use it.

http://www.pgsql.cz/index.php/Oracle_functionality_%28en%29

Regards
Pavel Stehule

Show quoted text

On 12/12/2007, Ottavio Campana <ottavio@campana.vi.it> wrote:

I'd like to execute a stored procedure in postgresql one minute after a
table has been modified. In case there are two changes in less than one
minute, I want to reset the time that has to be waited before running
the procedure.

I think I need to use a trigger, but I don't know how...

Can you help me please?

--
Non c'e' piu' forza nella normalita', c'e' solo monotonia.

#3A. Kretschmer
andreas.kretschmer@schollglas.com
In reply to: Pavel Stehule (#2)
Re: executing a procedure with delay

am Wed, dem 12.12.2007, um 14:43:55 +0100 mailte Pavel Stehule folgendes:

Hello

you can use pg_sleep function. But using it in trigger is ugly,
because transaction stay in open state. Look to orafce on intersession
communication. Maybe you can use it.

other solution (vaguely): LISTEN/NOFIFY and an external prozess.

Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net