pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jasen Betts <jasen@xnet.co.nz>
To: pgsql-sql@postgresql.org
Subject: Re: updating a sequence
Date: 16 Nov 2011 18:49:08 GMT
Message-ID: <ja10j4$gv$1@reversiblemaps.ath.cx> (raw)
References: <201111150806.30911.johnf@jfcomputer.com>
	<CABvLTWGNa470FXAR=zXu_PeFJ9GtQ-MPAcDfq=Bq7vPVuF2drA@mail.gmail.com>
	<201111151628.23731.johnf@jfcomputer.com>
	<CAEV0TzApAcAtTZYqHGGexBfvps__v9oTwEQ5dGrtEqHPEYeW3w@mail.gmail.com>
	<CAOR=d=3fahvFCn80mQLwK4Pnru7u1DiV5ZTD3oyxe7S+sSpXjA@mail.gmail.com>

On 2011-11-16, Scott Marlowe <scott.marlowe@gmail.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




view thread (10+ messages)

Message-ID: <ja10j4$gv$1@reversiblemaps.ath.cx>
Permalink:  ../ja10j4$gv$1@reversiblemaps.ath.cx/
Also on:    postgresql.org/message-id/ja10j4$gv$1@reversiblemaps.ath.cx

 · 

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: jasen@xnet.co.nz
  Subject: Re: updating a sequence
  In-Reply-To: <ja10j4$gv$1@reversiblemaps.ath.cx>

* 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