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

Re: Issues with generate_series using integer boundaries

From: Thom Brown <thom(at)linux(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PGSQL Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Issues with generate_series using integer boundaries
Date: 2011-02-01 02:17:17
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-generalpgsql-hackers
On 1 February 2011 01:05, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Thom Brown <thom(at)linux(dot)com> writes:
>> I've noticed that if I try to use generate_series to include the upper
>> boundary of int4, it never returns:
> I'll bet it's testing "currval > bound" without considering the
> possibility that incrementing currval caused an overflow wraparound.
> We fixed a similar problem years ago in plpgsql FOR-loops...

And here's another case:

SELECT x FROM generate_series(2147483643, 2147483644,5) AS a(x);

A step of 1 would work fine, but forcing it to exceed the boundary in
this way means it never returns.

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

In response to


pgsql-hackers by date

Next:From: Christopher HotchkissDate: 2011-02-01 02:26:00
Subject: Authentication Enhancement Proposal
Previous:From: Hitoshi HaradaDate: 2011-02-01 02:16:54
Subject: Re: Add ENCODING option to COPY

pgsql-general by date

Next:From: Scott MarloweDate: 2011-02-01 03:52:08
Subject: Re: Why does my DB size differ between Production and DR? (Postgres 8.4)
Previous:From: Tom LaneDate: 2011-02-01 01:05:25
Subject: Re: Issues with generate_series using integer boundaries

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