timestamp and date behaviour with '-infinity'

From: Russell Smith <mr-russ(at)pws(dot)com(dot)au>
To: pgsql-general(at)postgresql(dot)org
Subject: timestamp and date behaviour with '-infinity'
Date: 2004-08-30 06:38:49
Message-ID: 200408301638.49939.mr-russ@pws.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Timestamps support infinity. However if appears dates do not.

When timestamps are cast to dates, there is no output. Is this an acceptable option or not?

Below are a number of examples showing what I am experiencing.

The last own shows how converting timestamps to dates and then ordering doesn't give you the
order you want. Maybe you should just order by the timestamp to begin with. However
Date does not understand infinity at all.

So as much as what I have said is confusing.

1. Is the output acceptable?
2. should there be infinity support for dates?
3. if not, how should -infinity timestamp converted to a date.
4. Am I missing the point here.

Regards

Russell Smith

church=# select '-infinity'::timestamp;
timestamp
-----------
-infinity
(1 row)

church=# select '-infinity'::timestamp::date;
date
------

(1 row)

church=# select '*' || '-infinity'::timestamp::date || '*';
?column?
----------

(1 row)

church=# select '*' || '-infinity'::timestamp::date::text || '*';
?column?
----------

(1 row)

church=# select '*' || '-infinity'::timestamp || '*';
?column?
-------------
*-infinity*
(1 row)

church=# select '*' || '-infinity'::timestamp::date || '*';
?column?
----------

(1 row)

church=# select '-infinity'::timestamp::date as a, '-inf' UNION select 'infinity'::timestamp::date as a, 'inf' ORDER BY a ASC;
a | ?column?
---+----------
| -inf
| inf
(2 rows)

church=# select '-infinity'::timestamp::date as a, '-inf' UNION select 'infinity'::timestamp::date as a, 'inf' ORDER BY a DESC;
a | ?column?
---+----------
| -inf
| inf
(2 rows)

church=# select '-infinity'::timestamp::date::timestamp;
timestamp
-----------

(1 row)

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2004-08-30 09:12:50 Re: pg_restore: error returned by PQputline
Previous Message Akash Garg 2004-08-30 04:56:28 weird error during pg_dump