From: Florian Weimer <fweimer@bfk.de>
To: Leif Biberg Kristensen <leif@solumslekt.org>
Cc: pgsql-sql@postgresql.org
Subject: Re: Subselects not allowed?
Date: Tue, 14 Jun 2011 14:00:33 +0000
Message-ID: <82pqmgwm0u.fsf@mid.bfk.de> (raw)
In-Reply-To: <201106121022.28759.leif@solumslekt.org>
References: <201106111701.54145.leif@solumslekt.org>
<201106112209.09813.leif@solumslekt.org>
<201106121022.28759.leif@solumslekt.org>
* Leif Biberg Kristensen:
> 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;
I think you should acquire an exclusive lock on the table, too.
--
Florian Weimer <fweimer@bfk.de>
BFK edv-consulting GmbH http://www.bfk.de/
Kriegsstraße 100 tel: +49-721-96201-1
D-76133 Karlsruhe fax: +49-721-96201-99
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: fweimer@bfk.de, leif@solumslekt.org
Subject: Re: Subselects not allowed?
In-Reply-To: <82pqmgwm0u.fsf@mid.bfk.de>
* 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