Re: infinity interval - Mailing list pgsql-general

From Richard Broersma
Subject Re: infinity interval
Date
Msg-id 396486430812201726q100cd10fu4a14d1468dd46251@mail.gmail.com
Whole thread Raw
In response to infinity interval  (Gerhard Heift <ml-postgresql-20081012-3518@gheift.de>)
List pgsql-general
On Sat, Dec 20, 2008 at 3:52 PM, Gerhard Heift
<ml-postgresql-20081012-3518@gheift.de> wrote:

> how can I store an infinity value into an interval?

I don't think you can:

postgres=# select INTERVAL '1 week' + 'infinity'::timestamp;
 ?column?
----------
 infinity
(1 row)

postgres=# select INTERVAL 'infinity' + now();
ERROR:  invalid input syntax for type interval: "infinity"

Also notice the limits that the Interval datatype supports.
http://www.postgresql.org/docs/8.3/interactive/datatype-datetime.html

> I want to store
> offsets to a timestamp, and for some cases i need +infinity and
> -infinity as result.

You might need to rethink your design to two timestamps, or use a null
represent to concept of infinite duration since postgresql doesn't
currently support this.

--
Regards,
Richard Broersma Jr.

Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug

pgsql-general by date:

Previous
From: Gerhard Heift
Date:
Subject: infinity interval
Next
From: Martin Gainty
Date:
Subject: Re: infinity interval