Re: [HACKERS] Issues with generate_series using integer boundaries

From: Itagaki Takahiro <itagaki(dot)takahiro(at)gmail(dot)com>
To: Thom Brown <thom(at)linux(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PGSQL Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Re: [HACKERS] Issues with generate_series using integer boundaries
Date: 2011-02-07 09:04:15
Message-ID: AANLkTinObbtKgvGoVT_Pcgf_2Mr4ZdO2dwPZjizBQTXP@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Fri, Feb 4, 2011 at 21:32, Thom Brown <thom(at)linux(dot)com> wrote:
> The issue is that generate_series will not return if the series hits
> either the upper or lower boundary during increment, or goes beyond
> it.  The attached patch fixes this behaviour, but should probably be
> done a better way.  The first 3 examples above will not return.

There are same bug in int8 and timestamp[tz] versions.
We also need fix for them.
=# SELECT x FROM generate_series(9223372036854775807::int8,
9223372036854775807::int8) AS a(x);
=# SELECT x FROM generate_series('infinity'::timestamp, 'infinity', '1
sec') AS a(x);
=# SELECT x FROM generate_series('infinity'::timestamptz, 'infinity',
'1 sec') AS a(x);

> postgres=# SELECT x FROM generate_series(1, 9,-1) AS a(x);
> postgres=# SELECT x FROM generate_series(1, 9,3) AS a(x);
They work as expected in 9.1dev.

--
Itagaki Takahiro

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thom Brown 2011-02-07 11:38:09 Re: [HACKERS] Issues with generate_series using integer boundaries
Previous Message Wouter D'Haeseleer 2011-02-07 08:57:17 Re: Question about switchover with PG9 replication

Browse pgsql-hackers by date

  From Date Subject
Next Message Dimitri Fontaine 2011-02-07 09:18:12 Re: A different approach to extension NO USER DATA feature
Previous Message Heikki Linnakangas 2011-02-07 08:37:37 Re: review: FDW API