pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Leif Biberg Kristensen <leif@solumslekt.org>
To: pgsql-sql@postgresql.org
Subject: Re: Subselects not allowed?
Date: Sun, 12 Jun 2011 10:22:28 +0200
Message-ID: <201106121022.28759.leif@solumslekt.org> (raw)
In-Reply-To: <201106112209.09813.leif@solumslekt.org>
References: <201106111701.54145.leif@solumslekt.org>
	<201106112209.09813.leif@solumslekt.org>

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/



view thread (10+ messages)  latest in thread

Message-ID: <201106121022.28759.leif@solumslekt.org>
Permalink:  ../201106121022.28759.leif@solumslekt.org/
Also on:    postgresql.org/message-id/201106121022.28759.leif@solumslekt.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: leif@solumslekt.org
  Subject: Re: Subselects not allowed?
  In-Reply-To: <201106121022.28759.leif@solumslekt.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox