Re: Subselects not allowed?

From: Florian Weimer <fweimer(at)bfk(dot)de>
To: Leif Biberg Kristensen <leif(at)solumslekt(dot)org>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Subselects not allowed?
Date: 2011-06-14 14:00:33
Message-ID: 82pqmgwm0u.fsf@mid.bfk.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

* 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(at)bfk(dot)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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message sara vanan 2011-06-14 17:37:18 Sqlite to postgres database conversion.swedish chararacter issue
Previous Message INDER 2011-06-14 07:17:32 Storage of Indian Language text in postgresql through PHP