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));
id | num
----+-----
1 | 1
2 | 2
3 | 3
4 | 4
5 | 5
6 | 6
7 | 7
8 | 8
9 | 9
10 | 10
12 | 11
13 | 12
14 | 13
15 | 14
16 | 15
17 | 16
18 | 17
19 | 18
20 | 19
21 | 20
23 | 21
24 | 22
25 | 23
26 | 24
27 | 25
28 | 26
29 | 27
30 | 28
31 | 29
32 | 30
But, if I just use single inserts, the sequence increments by one like I
expect:
jefftest=# INSERT INTO jefftest (num) VALUES (1);
INSERT 0 1
jefftest=# INSERT INTO jefftest (num) VALUES (2);
INSERT 0 1
jefftest=# INSERT INTO jefftest (num) VALUES (3);
INSERT 0 1
jefftest=# INSERT INTO jefftest (num) VALUES (4);
INSERT 0 1
jefftest=# INSERT INTO jefftest (num) VALUES (5);
INSERT 0 1
jefftest=# select * from jefftest;
id | num
----+-----
1 | 1
2 | 2
3 | 3
4 | 4
5 | 5
(5 rows)
Obviously, this doesn't hurt anything, I'm just curious why it skips one after
every generate_series insert?
--
Jeff Frost, Owner <jeff(at)frostconsultingllc(dot)com>
Frost Consulting, LLC http://www.frostconsultingllc.com/
Phone: 650-780-7908 FAX: 650-649-1954
Responses
pgsql-hackers by date
| Next: | From: Alvaro Herrera | Date: 2007-10-03 01:07:54 |
| Subject: Re: Re: [COMMITTERS] pgsql: Fix free space map tocorrectly track the total amount of FSM |
| Previous: | From: Decibel! | Date: 2007-10-03 00:17:39 |
| Subject: Re: [HACKERS] Re: pgsql: Fix free space map to correctly track the total amount of FSM |
pgsql-sql by date
| Next: | From: Tom Lane | Date: 2007-10-03 03:48:09 |
| Subject: Re: Finding broken regex'es |
| Previous: | From: Erik Jones | Date: 2007-10-02 21:36:55 |
| Subject: Re: Finding broken regex'es |