(maybe offtopic) mod_perl/DBI/PostgreSQL

2003-08-14 Thread Bruce Tennant
I just noticed an oddity in my application. I setup a table in SQL witha serial, not null, primary key column. Then I have a routine that inserts into the table (not setting the key column). If I do the insert from the psql utitilty the sequence stays consistant (inc by 1) w/each new row added.

Re: (maybe offtopic) mod_perl/DBI/PostgreSQL

2003-08-14 Thread greg
Do you have any code that might do a select to determine the value of the sequence used? Example: INSERT blah blah blah; SELECT currval(sequence_name); or somethign like that? If so, the SELECT may be incrementing the counter and that would explain the jump by 2 your seeing. There is a

Re: (maybe offtopic) mod_perl/DBI/PostgreSQL

2003-08-14 Thread Bruce Tennant
Yeah, actually here is the code snippets I use. Table def: CREATE SEQUENCE s_league_lid minvalue 1; CREATE TABLE t_League ( /* lid integer DEFAULT nextval('s_league_lid') PRIMARY KEY,*/ lid SERIAL PRIMARY KEY NOT NULL, name VARCHAR(20) UNIQUE NOT NULL, numdiv integer, draft integer, last_wvr