Re: How to specify infinity for intervals ?

From: Michael Glaesemann <grzm(at)myrealbox(dot)com>
To: Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to specify infinity for intervals ?
Date: 2006-02-21 22:59:06
Message-ID: 2B036DC9-EA32-4E6F-948B-5B88DD3228CA@myrealbox.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Feb 22, 2006, at 1:51 , Karsten Hilbert wrote:

> I specifically wanted to avoid that by
> something like 'infinite'::interval in some way or other
> such that I could always do
>
> "... where now < date_of_birth + max_age ..."
>
> and not need an
>
> "... or max_age is null ..."
>
> in all the places.

I'd wrap it in an SQL function (untested):

create function ok_to_vaccinate(date, interval)
returns boolean
language sql as'
select current_timestamp < $1 + $2 or $2 is null
';

Michael Glaesemann
grzm myrealbox com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruno Wolff III 2006-02-22 03:12:45 Re: How to specify infinity for intervals ?
Previous Message Sanjay Arora 2006-02-21 22:24:02 Attn. PostgreSQL.org webmasters: Site Link not working