unsubscribe - Mailing list pgsql-sql

From lyman1@mindspring.com
Subject unsubscribe
Date
Msg-id 001b01bf5533$ce0e4d00$0201a8c0@win98p266
Whole thread Raw
List pgsql-sql
unsubscribe

-----Original Message-----
From: pgsql-sql-digest <owner-pgsql-sql-digest@hub.org>
To: pgsql-sql-digest@hub.org <pgsql-sql-digest@hub.org>
Date: Saturday, January 01, 2000 11:00 PM
Subject: pgsql-sql-digest V1 #453


>
>pgsql-sql-digest       Saturday, January 1 2000       Volume 01 : Number
453
>
>
>
>Index:
>
>timespan problem
>Re: [SQL] timespan problem
>
>----------------------------------------------------------------------
>
>Date: Sat, 1 Jan 2000 21:48:47 +0100 (CET)
>From: Tulassay Zsolt <zsolt@tek.bke.hu>
>Subject: timespan problem
>
>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@tek.bke.hu
>
>------------------------------
>
>Date: Sat, 01 Jan 2000 18:58:30 -0500
>From: Tom Lane <tgl@sss.pgh.pa.us>
>Subject: Re: [SQL] timespan problem
>
>Tulassay Zsolt <zsolt@tek.bke.hu> writes:
>> 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)
>
>Of course, both of the above are drastically wrong, since 74575 days
>should be upwards of 200 years.  The problem appears to be an internal
>overflow in timespan_in, since you can show wrong results just with:
>
>regression=> select '74565 days'::timespan;
>?column?
>- -------------------------------------
>@ 24854 days 17 hours 31 mins 44 secs
>(1 row)
>
>regression=> select '74566 days'::timespan;
>?column?
>- -----------------------------------------
>@ 24854 days 12 hours 56 mins 32 secs ago
>(1 row)
>
>Looking into it, the guilty party seems to be tm2timespan() which
>blithely assumes that it need not worry about overflow from its
>"time" field to its "month" field:
>
>    span->month = ((tm->tm_year * 12) + tm->tm_mon);
>    span->time = ((((((tm->tm_mday * 24) + tm->tm_hour) * 60) + tm->tm_min)
* 60) + tm->tm_sec);
>    span->time = JROUND(span->time + fsec);
>
>Thomas, you want to deal with this one?  Or is this code all going
>away in 7.0 anyway?
>
> regards, tom lane
>
>------------------------------
>
>End of pgsql-sql-digest V1 #453
>*******************************
>
>
>************



pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: [SQL] timespan problem
Next
From: Thomas Lockhart
Date:
Subject: Re: [SQL] timespan problem