2147483642::abstime is null, 2147483644::abstime is null

Started by Filip Jirsákabout 21 years ago5 messagesgeneral
Jump to latest
#1Filip Jirsák
Filip.Jirsak@gymnacel.cz

Hi,
why this statement:
SELECT 2147483647::abstime, 2147483646::abstime, 2147483645::abstime,
2147483644::abstime, 2147483643::abstime, 2147483642::abstime,
2147483641::abstime, 2147483640::abstime, 2147483639::abstime;

returns null form2147483646 and 2147483645? Is this feature or bug?
(Server version is 7.4.5).

Thanks.
Filip Jirs�k

#2Scott Marlowe
smarlowe@g2switchworks.com
In reply to: Filip Jirsák (#1)
Re: 2147483642::abstime is null, 2147483644::abstime is

On Fri, 2005-03-04 at 08:25, Filip Jirsák wrote:

Hi,
why this statement:
SELECT 2147483647::abstime, 2147483646::abstime, 2147483645::abstime,
2147483644::abstime, 2147483643::abstime, 2147483642::abstime,
2147483641::abstime, 2147483640::abstime, 2147483639::abstime;

returns null form2147483646 and 2147483645? Is this feature or bug?
(Server version is 7.4.5).

I'm running 7.4.7 on FC2, and i get this:

test=# SELECT 2147483647::abstime, 2147483646::abstime,
2147483645::abstime,
test-# 2147483644::abstime, 2147483643::abstime, 2147483642::abstime,
test-# 2147483641::abstime, 2147483640::abstime, 2147483639::abstime;
abstime | abstime | abstime | abstime
| abstime | abstime | abstime
| abstime | abstime
------------------------+---------+------------------------+----------+------------------------+------------------------+------------------------+------------------------+------------------------
2038-01-18 21:14:07-06 | invalid | 2038-01-18 21:14:05-06 | infinity |
2038-01-18 21:14:03-06 | 2038-01-18 21:14:02-06 | 2038-01-18 21:14:01-06
| 2038-01-18 21:14:00-06 | 2038-01-18 21:13:59-06
(1 row)

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Filip Jirsák (#1)
Re: 2147483642::abstime is null, 2147483644::abstime is null

=?ISO-8859-2?Q?Filip_Jirs=E1k?= <Filip.Jirsak@gymnacel.cz> writes:

why this statement:
SELECT 2147483647::abstime, 2147483646::abstime, 2147483645::abstime,
2147483644::abstime, 2147483643::abstime, 2147483642::abstime,
2147483641::abstime, 2147483640::abstime, 2147483639::abstime;

returns null form2147483646 and 2147483645?

It doesn't. It returns "invalid" and "infinity".

regards, tom lane

#4Dr. Stephane Schildknecht
sschildknecht@linagora.com
In reply to: Tom Lane (#3)
Re: 2147483642::abstime is null, 2147483644::abstime is

Tom Lane wrote:

=?ISO-8859-2?Q?Filip_Jirs=E1k?= <Filip.Jirsak@gymnacel.cz> writes:

why this statement:
SELECT 2147483647::abstime, 2147483646::abstime, 2147483645::abstime,
2147483644::abstime, 2147483643::abstime, 2147483642::abstime,
2147483641::abstime, 2147483640::abstime, 2147483639::abstime;

returns null form2147483646 and 2147483645?

It doesn't. It returns "invalid" and "infinity".

Is there a reason for this ?

St�phane

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Dr. Stephane Schildknecht (#4)
Re: 2147483642::abstime is null, 2147483644::abstime is null

"Dr. Stephane Schildknecht" <sschildknecht@linagora.com> writes:

Tom Lane wrote:

It doesn't. It returns "invalid" and "infinity".

Is there a reason for this ?

I suppose the "invalid" value is a legacy thing, but "infinity"
certainly strikes me as useful. We have that in the regular
timestamp type as well.

If you're asking why those particular encoded values, I dunno.
Certainly it seems like "infinity" needs to be larger than all
normal values so you don't have to special-case it in comparisons.

regards, tom lane