Re: Migration problem - serial fields - Mailing list pgsql-general

From missive@frontiernet.net (Lee Harr)
Subject Re: Migration problem - serial fields
Date
Msg-id slrna885rq.55.missive@whave.frontiernet.net
Whole thread Raw
List 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.


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Changes to NOW() in 7.2?
Next
From: "PG"
Date:
Subject: Slow in VB Grid with PG