Re: Alarm function in PL/pgSQL

From: Sim Zacks
Subject: Re: Alarm function in PL/pgSQL
Date: ,
Msg-id: 4E27F332.7040507@compulab.co.il
(view: Whole thread, Raw)
In response to: Re: Alarm function in PL/pgSQL  (Jon Smark)
List: pgsql-general

Tree view

Alarm function in PL/pgSQL  (Jon Smark, )
 Re: Alarm function in PL/pgSQL  (Merlin Moncure, )
  Re: Alarm function in PL/pgSQL  (Jon Smark, )
   Re: Alarm function in PL/pgSQL  (Darren Duncan, )
   Re: Alarm function in PL/pgSQL  (Craig Ringer, )
   Re: Alarm function in PL/pgSQL  (Sim Zacks, )

On 07/19/2011 01:35 AM, Jon Smark wrote:

> Hi,
>
>> 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.
> Thanks for the prompt reply.  Just to clarify: you are saying that the
> function that is called with a given periodicity must be so from *outside*
> PG, ie, from the client application, right?  I mean, there is no way
> strictly internal to PG to have a function be called every given number
> of seconds?
>
> Cheers,
> Jon
Hi Jon,

The generally accepted way of doing this is to have a cron job (outside
of the database) calling a function which checks a polling table for
things it should process. What you would do is put the time you want a
row processed at and then your cron job will call a function that
processes all rows that are overdue.
Pg Agent will do that same thing as a cron job, as Craig mentioned.

Sim



pgsql-general by date:

From: mdxxd
Date:
Subject: Re: Building an home computer for best Poker Tracker performance
From: Susan Cassidy
Date:
Subject: Re: SQL-ASCII database cleanup