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

[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

Re: [GENERAL] resetting sequence to cur max value

2006-12-12 Thread Marc Mamin
; 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 I am migrating a system from

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 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 table) +

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 table.

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()? Given