From: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> |
---|---|
To: | Jeff Frost <jeff(at)frostconsultingllc(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Why does the sequence skip a number with generate_series? |
Date: | 2007-10-04 01:06:22 |
Message-ID: | 20071003175808.P16566@megazone.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers 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 do
INSERT INTO jefftest(num) select a from generate_series(1,10) as foo(a);
INSERT INTO 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 as
select f1(1), generate_series(1,10);
and got 11 notices so it looks like there's some kind of phantom involved.
From | Date | Subject | |
---|---|---|---|
Next Message | Ron Mayer | 2007-10-04 01:37:18 | Re: Use of "postmaster" |
Previous Message | Brendan Jurd | 2007-10-03 23:54:12 | Re: [HACKERS] Use of "postmaster" |
From | Date | Subject | |
---|---|---|---|
Next Message | Tena Sakai | 2007-10-04 02:25:04 | Re: field separator problem |
Previous Message | Michael Fuhr | 2007-10-04 00:54:10 | Re: field separator problem |