Re: infinity interval

From: "Richard Broersma" <richard(dot)broersma(at)gmail(dot)com>
To: "Gerhard Heift" <ml-postgresql-20081012-3518(at)gheift(dot)de>
Cc: "PostgreSQL General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: infinity interval
Date: 2008-12-21 01:26:29
Message-ID: 396486430812201726q100cd10fu4a14d1468dd46251@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Dec 20, 2008 at 3:52 PM, Gerhard Heift
<ml-postgresql-20081012-3518(at)gheift(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Martin Gainty 2008-12-21 01:27:45 Re: infinity interval
Previous Message Gerhard Heift 2008-12-20 23:52:04 infinity interval