Re: Why does the sequence skip a number with generate_series? - Mailing list pgsql-sql

From Stephan Szabo
Subject Re: Why does the sequence skip a number with generate_series?
Date
Msg-id 20071003175808.P16566@megazone.bigpanda.com
Whole thread Raw
In response to Why does the sequence skip a number with generate_series?  (Jeff Frost <jeff@frostconsultingllc.com>)
Responses Re: Why does the sequence skip a number with generate_series?
List pgsql-sql
On Tue, 2 Oct 2007, Jeff Frost wrote:

> I expected these numbers to be in sync, but was suprised to see that the
> sequence skips a values after every generate series.
>
> CREATE TABLE jefftest ( id serial, num int );
> INSERT INTO jefftest (num) values (generate_series(1,10));
> INSERT INTO jefftest (num) values (generate_series(11,20));
> INSERT INTO jefftest (num) values (generate_series(21,30));

It seems to do what you'd expect if you doINSERT INTO jefftest(num) select a from generate_series(1,10) as
foo(a);INSERTINTO jefftest(num) select a from generate_series(11,20) as foo(a);INSERT INTO jefftest(num) select a from
generate_series(21,30)as foo(a);
 

I tried a function that raises a notice and called it asselect f1(1), generate_series(1,10);
and got 11 notices so it looks like there's some kind of phantom involved.


pgsql-sql by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: field separator problem
Next
From: "Tena Sakai"
Date:
Subject: Re: field separator problem