Re: updating a sequence

From: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: updating a sequence
Date: 2011-11-16 18:49:08
Message-ID: ja10j4$gv$1@reversiblemaps.ath.cx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 2011-11-16, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com> wrote:

> You need to wrap a subselect in ():
>
> select setval('foo', (select max(some_id) from some_table));

I prefer to do it in once select like this:

select setval('foo', max(some_id)) from some_table;

--
⚂⚃ 100% natural

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Jasmin Dizdarevic 2011-11-22 07:39:09 Change in 9.1?
Previous Message John Fabiani 2011-11-16 15:20:02 Re: updating a sequence