Re: Migration problem - serial fields

From: missive(at)frontiernet(dot)net (Lee Harr)
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Migration problem - serial fields
Date: 2002-03-05 00:57:50
Message-ID: slrna885rq.55.missive@whave.frontiernet.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> The snag I'm encountering is with Identity fields in SQL7. I
> discovered the equivalent in PG -- sequences/serial field. I would
> like to use serial if possible, but here's the problem: getting the
> existing records over while *keeping the existing values* for the
> Identity/sequence ID fields. They actually transfer over fine, but
> the next insert into the PG table generates a duplicate ID error.
> Obviously my transfer did not update the sequence used by the serial
> field -- it's still stuck at 1. However, I'm just not sure of the
> best course of action.
>

SELECT setval('your_seq_name', 654); -- set higher than highest record.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message PG 2002-03-05 01:22:46 Slow in VB Grid with PG
Previous Message Lee Harr 2002-03-05 00:54:29 Re: Conditional Statement