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

From Tom Lane
Subject Re: Migration problem - serial fields
Date
Msg-id 11808.1015523961@sss.pgh.pa.us
Whole thread Raw
In response to Migration problem - serial fields  (rick@planetdigital.com (Rick))
List pgsql-general
rick@planetdigital.com (Rick) writes:
> 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.

No, it wouldn't.  After you transfer the data, advance the sequence
with something like

SELECT setval('seqname', (SELECT max(serialcol) FROM table));

and then you're good to go.

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Temp Tables
Next
From: Neil Conway
Date:
Subject: Re: HELP!.. "semget(key=2, num=17, 03600) failed: No