Search Postgresql Archives

Re: Issues with generate_series using integer boundaries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1 February 2011 00:15, Thom Brown <thom@xxxxxxxxx> wrote:
> 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?

Actually, those lower bound errors aren't related to generate_series,
but I'd still like to know why -2147483648::int4 is out of range.

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

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux