On Saturday 11. June 2011 22.09.09 Leif Biberg Kristensen wrote: > I've written a blog post which I hope may be helpful to others in a similar > situation: > > <http://solumslekt.org/blog/?p=321> > > Thanks to Guillaume Lelarge, Tom Lane, and Andreas Kretschmer. You guys are > great.
And even better, in the first comment to the blog post, I was advised about the SETVAL() function which does exactly what I wanted in the first place. CREATE SEQUENCE persons_person_id_seq; SELECT SETVAL('persons_person_id_seq', MAX(person_id)) FROM persons; ALTER TABLE persons ALTER COLUMN person_id SET DEFAULT NEXTVAL('persons_person_id_seq'); ALTER SEQUENCE persons_person_id_seq OWNED BY persons.person_id; regards, Leif http://code.google.com/p/yggdrasil-genealogy/ -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql