Re: Alarm function in PL/pgSQL

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Jon Smark <jon(dot)smark(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Alarm function in PL/pgSQL
Date: 2011-07-18 21:48:18
Message-ID: CAHyXU0w8uLihMPK9iPmjRGvEfY18vpva_u3UCFrkZxzF_HKWSg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Jul 18, 2011 at 4:38 PM, Jon Smark <jon(dot)smark(at)yahoo(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message MS Rao 2011-07-18 21:58:14 Programmer ( Postgres), Milwaukee - offsite-Remote - onsite
Previous Message John R Pierce 2011-07-18 21:42:56 Re: pg_upgrade does not translate tablespace location to new cluster