pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: jeff sacksteder <jsacksteder@gmail.com>
To: pgsql-sql@postgresql.org
Subject: alter sequence + subqueries
Date: Fri, 16 Sep 2005 18:36:48 -0400
Message-ID: <51c8a7be050916153613795e1a@mail.gmail.com> (raw)

The postgres-specific sql extension 'ALTER SEQUENCE' does not appear to 
support subqueries.

I have inserted some data into a table, including values in the primary key. 
I want to reset the associated sequence so that any further records to be 
inserted into that table resume numbering correctly. The statement I 
attempted was:

ALTER SEQUENCE foo_id_seq 
RESTART WITH (SELECT max(id) FROM foo);

Is this syntax correct and supported?

view thread (3+ messages)  latest in thread

Message-ID: <51c8a7be050916153613795e1a@mail.gmail.com>
Permalink:  ../51c8a7be050916153613795e1a@mail.gmail.com/
Also on:    postgresql.org/message-id/51c8a7be050916153613795e1a@mail.gmail.com

 · 

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: jsacksteder@gmail.com
  Subject: Re: alter sequence + subqueries
  In-Reply-To: <51c8a7be050916153613795e1a@mail.gmail.com>

* 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