From: | Leif Biberg Kristensen <leif(at)solumslekt(dot)org> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Subselects not allowed? |
Date: | 2011-06-12 08:22:28 |
Message-ID: | 201106121022.28759.leif@solumslekt.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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/
From | Date | Subject | |
---|---|---|---|
Next Message | Andreas Kretschmer | 2011-06-12 08:37:20 | Re: Subselects not allowed? |
Previous Message | C. Bensend | 2011-06-11 22:18:21 | Re: Returning a set of dates |