how to best resync serial columns

From: "Brent Wood" <b(dot)wood(at)niwa(dot)co(dot)nz>
To:
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: how to best resync serial columns
Date: 2008-11-11 02:48:34
Message-ID: 4919A9530200007B00016BEC@gwia1.ham.niwa.co.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I have a number of tables with serial columns as a primary key.

I'm looking to add lots of records via copy, but should reset the serial counters to the appropriate value after this.

Is there a simple way to do this, or do I just update the last_value column in each seq table to the max(id) from the relevant table.

Thanks,

Brent Wood

Brent Wood
DBA/GIS consultant
NIWA, Wellington
New Zealand
NIWA is the trading name of the National Institute of Water & Atmospheric Research Ltd.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2008-11-11 03:12:43 Re: db_user_namespace, md5 and changing passwords
Previous Message Erik Jones 2008-11-11 02:17:44 Re: Upgrading Postgres question