timespan problem

From: Tulassay Zsolt <zsolt(at)tek(dot)bke(dot)hu>
To: pgsql-sql(at)hub(dot)org
Subject: timespan problem
Date: 2000-01-01 20:48:47
Message-ID: Pine.LNX.4.10.10001012142220.17313-100000@tek.bke.hu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


hi,
i ran into a strange result using the timespan type. No,
it's not related to y2k, but i don't know whether it is a
bug or i just used wrong typecasting.
here it is:

forum=> select datetime(now()) as ido;
ido
----------------------------
Sat Jan 01 21:35:32 2000 CET
(1 row)

forum=> select datetime(now())+'74565 days'::timespan as ido;
ido
------------------------
Thu Jan 19 14:07:30 2068
(1 row)

forum=> select datetime(now())+'74566 days'::timespan as ido;
ido
----------------------------
Tue Dec 15 08:39:21 1931 CET
(1 row)

forum=> select datetime(now())+'70 years'::timespan as ido;
ido
------------------------
Wed Jan 01 20:36:01 2070
(1 row)

forum=>

I don't see anything wrong in the third query, but the result
is a bit surprising... and notice the error in the second query
too: the time fields don't match.

I'm using version 6.5.2 on Red Hat Linux 6.0

Zsolt Tulassay
zsolt(at)tek(dot)bke(dot)hu

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2000-01-01 23:58:30 Re: [SQL] timespan problem
Previous Message Werner Fraga 1999-12-31 20:18:18 datetime fields have '60' in seconds field