Re: [GENERAL] Issues with generate_series using integer boundaries

2011-02-08 Thread Glenn Maynard
On Mon, Jan 31, 2011 at 7:36 PM, Tom Lane wrote: > Thom Brown writes: > > 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. > > :: binds tighter than - (and everything else too). Write > (-2147483648)::int

Re: [GENERAL] Issues with generate_series using integer boundaries

2011-02-04 Thread Thom Brown
On 3 February 2011 13:58, Thom Brown wrote: > On 3 February 2011 13:32, Thom Brown wrote: >> Actually, further testing indicates this causes other problems: >> >> postgres=# SELECT x FROM generate_series(1, 9,-1) AS a(x); >>  x >> --- >>  1 >> (1 row) >> >> Should return no rows. >> >> postgres=#

Re: [GENERAL] Issues with generate_series using integer boundaries

2011-02-03 Thread Thom Brown
On 3 February 2011 14:37, David Johnston wrote: > The proposed generate_series(1,9,-1) behavior seems unusual. I haven't proposed this behaviour as it already occurs. I just include it for testing to ensure no other part of generate series is affected by such changes. Whether or not that is des

Re: [GENERAL] Issues with generate_series using integer boundaries

2011-02-03 Thread David Johnston
:58 AM To: Alban Hertroys Cc: Tom Lane; PGSQL Mailing List Subject: Re: [GENERAL] Issues with generate_series using integer boundaries On 3 February 2011 13:32, Thom Brown wrote: > Actually, further testing indicates this causes other problems: > > postgres=# SELECT x FROM generate_series

Re: [GENERAL] Issues with generate_series using integer boundaries

2011-02-03 Thread Thom Brown
On 3 February 2011 13:32, Thom Brown wrote: > Actually, further testing indicates this causes other problems: > > postgres=# SELECT x FROM generate_series(1, 9,-1) AS a(x); >  x > --- >  1 > (1 row) > > Should return no rows. > > postgres=# SELECT x FROM generate_series(1, 9,3) AS a(x); >  x > ---

Re: [GENERAL] Issues with generate_series using integer boundaries

2011-02-03 Thread Thom Brown
On 3 February 2011 11:34, Thom Brown wrote: > On 3 February 2011 11:31, Thom Brown wrote: >> On 1 February 2011 23:08, Thom Brown wrote: >>> On 1 February 2011 21:32, Alban Hertroys >>> wrote: On 1 Feb 2011, at 21:26, Thom Brown wrote: > On 1 February 2011 01:05, Tom Lane wrote:

Re: [GENERAL] Issues with generate_series using integer boundaries

2011-02-03 Thread Thom Brown
On 3 February 2011 11:31, Thom Brown wrote: > On 1 February 2011 23:08, Thom Brown wrote: >> On 1 February 2011 21:32, Alban Hertroys >> wrote: >>> On 1 Feb 2011, at 21:26, Thom Brown wrote: >>> On 1 February 2011 01:05, Tom Lane wrote: > Thom Brown writes: >> I've noticed that if

Re: [GENERAL] Issues with generate_series using integer boundaries

2011-02-03 Thread Thom Brown
On 1 February 2011 23:08, Thom Brown wrote: > On 1 February 2011 21:32, Alban Hertroys > wrote: >> On 1 Feb 2011, at 21:26, Thom Brown wrote: >> >>> On 1 February 2011 01:05, Tom Lane wrote: Thom Brown writes: > I've noticed that if I try to use generate_series to include the upper >>>

Re: [GENERAL] Issues with generate_series using integer boundaries

2011-02-01 Thread Thom Brown
On 1 February 2011 21:32, Alban Hertroys wrote: > On 1 Feb 2011, at 21:26, Thom Brown wrote: > >> On 1 February 2011 01:05, Tom Lane wrote: >>> Thom Brown 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

Re: [GENERAL] Issues with generate_series using integer boundaries

2011-02-01 Thread Alban Hertroys
On 1 Feb 2011, at 21:26, Thom Brown wrote: > On 1 February 2011 01:05, Tom Lane wrote: >> Thom Brown 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 >

Re: [GENERAL] Issues with generate_series using integer boundaries

2011-02-01 Thread Thom Brown
On 1 February 2011 01:05, Tom Lane wrote: > Thom Brown 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 ove

Re: [GENERAL] Issues with generate_series using integer boundaries

2011-01-31 Thread Thom Brown
On 1 February 2011 01:05, Tom Lane wrote: > Thom Brown 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 ove

Re: [GENERAL] Issues with generate_series using integer boundaries

2011-01-31 Thread Tom Lane
Thom Brown 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 a

Re: [GENERAL] Issues with generate_series using integer boundaries

2011-01-31 Thread Thom Brown
On 1 February 2011 00:41, Thom Brown wrote: > On 1 February 2011 00:36, Tom Lane wrote: >> Thom Brown writes: >>> 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. >> >> :: binds tighter than - (and everyth

Re: [GENERAL] Issues with generate_series using integer boundaries

2011-01-31 Thread Thom Brown
On 1 February 2011 00:36, Tom Lane wrote: > Thom Brown writes: >> 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. > > :: binds tighter than - (and everything else too).  Write > (-2147483648)::int4 instead.

Re: [GENERAL] Issues with generate_series using integer boundaries

2011-01-31 Thread Tom Lane
Thom Brown writes: > 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. :: binds tighter than - (and everything else too). Write (-2147483648)::int4 instead. regards, tom lane -- Sen

Re: [GENERAL] Issues with generate_series using integer boundaries

2011-01-31 Thread Thom Brown
On 1 February 2011 00:15, Thom Brown 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: > >