Skip site navigation (1) Skip section navigation (2)

Issues with generate_series using integer boundaries

From: Thom Brown <thom(at)linux(dot)com>
To: PGSQL Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Issues with generate_series using integer boundaries
Date: 2011-02-01 00:15:06
Message-ID: AANLkTim2LF=Hwv_9i80du=wNLeWoskPdbJ-DFtTNPkDK@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-hackers
Hi,

I've noticed that if I try to use generate_series to include the upper
boundary of int4, it never returns:

SELECT x FROM generate_series(2147483643::int4, 2147483647::int4) AS a(x);

But the same query with int8 returns instantly:

SELECT x FROM generate_series(2147483643::int8, 2147483647::int8) AS a(x);

However, the int8 version of generate_series has the same problem.
This never returns:

SELECT x FROM generate_series(9223372036854775803::int8,
9223372036854775807::int8) AS a(x);

Another issue happens when using the lower boundaries:

postgres=# SELECT x FROM generate_series(-2147483648::int4,
-2147483644::int4) AS a(x);
ERROR:  integer out of range
postgres=# SELECT x FROM generate_series(-9223372036854775808::int8,
-9223372036854775804::int8) AS a(x);
ERROR:  bigint out of range

I've recreated this on 9.0.1 and 9.1devel on a 64-bit platform.

Bug?

-- 
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935

Responses

pgsql-hackers by date

Next:From: Robert HaasDate: 2011-02-01 00:16:55
Subject: Re: Error code for "terminating connection due to conflict with recovery"
Previous:From: Josh BerkusDate: 2011-02-01 00:13:42
Subject: Re: Error code for "terminating connection due to conflict with recovery"

pgsql-general by date

Next:From: Jeff RossDate: 2011-02-01 00:28:16
Subject: Re: Almost full pg_xlog/
Previous:From: Tom LaneDate: 2011-02-01 00:14:01
Subject: Re: Almost full pg_xlog/

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group