Make an id field max(id)+1 rather than SERIAL

From: Rory Campbell-Lange <rory(at)campbell-lange(dot)net>
To: pgsql-novice(at)postgresql(dot)org
Subject: Make an id field max(id)+1 rather than SERIAL
Date: 2002-09-19 14:14:17
Message-ID: 20020919141417.GB6565@campbell-lange.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I have problems after exporting then importing data into newly created
databases that the sequence and the indexed serial fields get out of
alignment.

I wonder if it isn't better to always simply insert ids using some sort
of function or other procedure to calculate on each insert a new unique
id number.

Is this feasible?

Thanks for any help.
Rory

--
Rory Campbell-Lange
<rory(at)campbell-lange(dot)net>
<www.campbell-lange.net>

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Oliver Elphick 2002-09-19 16:59:43 Re: Make an id field max(id)+1 rather than SERIAL
Previous Message Ciprian Popovici 2002-09-19 10:39:46 Re: restricting similar rows