Re: Alarm function in PL/pgSQL - Mailing list pgsql-general

From Merlin Moncure
Subject Re: Alarm function in PL/pgSQL
Date
Msg-id CAHyXU0w8uLihMPK9iPmjRGvEfY18vpva_u3UCFrkZxzF_HKWSg@mail.gmail.com
Whole thread Raw
In response to Alarm function in PL/pgSQL  (Jon Smark <jon.smark@yahoo.com>)
Responses Re: Alarm function in PL/pgSQL  (Jon Smark <jon.smark@yahoo.com>)
List pgsql-general
On Mon, Jul 18, 2011 at 4:38 PM, Jon Smark <jon.smark@yahoo.com> wrote:
> Hi,
>
> Is it possible to set an alarm within a PL/pgSQL function?  By "alarm"
> I mean a function which is invoked some defined time in the future,
> even after the original function has terminated and returned a value
> to the client.
>
> I want an invocation of function FOO to set a "state" column of a given
> table row to "temporary".  After a predefined period (say, one hour),
> function BAR should then automatically be invoked; this latter function
> would among other things change the "state" column to "permanent".

I don't think this is really possible with postgres PLs generally.
Typically what you have to do is have a function that is called on an
interval that checks for alarms and runs them.

merlin

pgsql-general by date:

Previous
From: John R Pierce
Date:
Subject: Re: pg_upgrade does not translate tablespace location to new cluster
Next
From: Martín Marqués
Date:
Subject: How to sum monetary variables