Re: Subselects not allowed? - Mailing list pgsql-sql

From Leif Biberg Kristensen
Subject Re: Subselects not allowed?
Date
Msg-id 201106121022.28759.leif@solumslekt.org
Whole thread Raw
In response to Re: Subselects not allowed?  (Leif Biberg Kristensen <leif@solumslekt.org>)
Responses Re: Subselects not allowed?  (Andreas Kretschmer <akretschmer@spamfence.net>)
Re: Subselects not allowed?  (Florian Weimer <fweimer@bfk.de>)
List pgsql-sql
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/


pgsql-sql by date:

Previous
From: "C. Bensend"
Date:
Subject: Re: Returning a set of dates
Next
From: Andreas Kretschmer
Date:
Subject: Re: Subselects not allowed?