Re: [GENERAL] resetting sequence to cur max value

2006-12-13 Thread Berend Tober
Tom Lane wrote: Michael Fuhr <[EMAIL PROTECTED]> writes: On Tue, Dec 12, 2006 at 12:19:56PM -0500, Tom Lane wrote: Usually you do something like select setval('seq_name', (select max(idcol) from table) + 1); after loading data into the table. Is "+ 1" necessary with the t

Re: [GENERAL] resetting sequence to cur max value

2006-12-12 Thread Tom Lane
Michael Fuhr <[EMAIL PROTECTED]> writes: > On Tue, Dec 12, 2006 at 12:19:56PM -0500, Tom Lane wrote: >> Usually you do something like >> select setval('seq_name', (select max(idcol) from table) + 1); >> after loading data into the table. > Is "+ 1" necessary with the two-parameter form of setval

Re: [GENERAL] resetting sequence to cur max value

2006-12-12 Thread Michael Fuhr
On Tue, Dec 12, 2006 at 12:19:56PM -0500, Tom Lane wrote: > [EMAIL PROTECTED] writes: > > Is there a way to set it up so it knows to skip past existing ids? > > Usually you do something like > > select setval('seq_name', (select max(idcol) from table) + 1); > > after loading data into the

Re: [GENERAL] resetting sequence to cur max value

2006-12-12 Thread developer
Awesome. Thanks tom. By the way I am still trying to find a yum install for 8.2 for centos...anyone? > [EMAIL PROTECTED] writes: >> Is there a way to set it up so it knows to skip past existing ids? > > Usually you do something like > > select setval('seq_name', (select max(idcol) from tab

Re: [GENERAL] resetting sequence to cur max value

2006-12-12 Thread Tom Lane
[EMAIL PROTECTED] writes: > Is there a way to set it up so it knows to skip past existing ids? Usually you do something like select setval('seq_name', (select max(idcol) from table) + 1); after loading data into the table. regards, tom lane -

Re: [GENERAL] resetting sequence to cur max value

2006-12-12 Thread Marc Mamin
h '||rec.m; End loop; END; Return 0; ... Cheers, marc -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Tuesday, December 12, 2006 5:39 PM To: pgsql-general@postgresql.org Subject: [GENERAL] resetting sequence to cur max value

[GENERAL] resetting sequence to cur max value

2006-12-12 Thread developer
I am migrating a system from hsqldb to postgresql. I have a bunch of installs of this system live so moving the data is a headache. I was using identities in hsqldb and now I am using sequences. I was able to move all my data over however I am having an issue with the sequences. I default them