alter sequence + subqueries

From: jeff sacksteder <jsacksteder(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: alter sequence + subqueries
Date: 2005-09-16 22:36:48
Message-ID: 51c8a7be050916153613795e1a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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?

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Kenneth Dombrowski 2005-09-16 23:04:39 plpgsql function not accepting NULL value
Previous Message Daryl Richter 2005-09-16 16:16:59 Re: showing multiple REFERENCE details of id fields in single