Re: [PATCH] pg_sleep(interval)

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Kevin Grittner <kgrittn(at)ymail(dot)com>
Cc: Stephen Frost <sfrost(at)snowman(dot)net>, Vik Fearing <vik(dot)fearing(at)dalibo(dot)com>, Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] pg_sleep(interval)
Date: 2013-10-17 01:14:02
Message-ID: CA+TgmoZo6an7iHPTFLW8JO_h3fxS9r4H4k9_0QBHGpeY1z9qJg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Oct 16, 2013 at 4:34 PM, Kevin Grittner <kgrittn(at)ymail(dot)com> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>
>> Anyone who actually wants this in their environment can
>> add the overloaded function in their environment with a one-line SQL
>> function: pg_sleep(interval) as proposed here is just
>> pg_sleep(extract(epoch from now() + $1) - extract(epoch from now())).
>
> You're making it sound way harder than it is. Why not just:
>
> create function my_sleep(delay interval)
> returns void language sql
> as 'select pg_sleep(extract(epoch from $1))';
>
> ... or, of course, named to match the existing function.

Because that might or might not do the right thing if the interval is 1 month.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2013-10-17 01:41:20 libpgport vs libpgcommon
Previous Message Fabrízio de Royes Mello 2013-10-17 00:46:32 Re: FDW API / flow charts for the docs?