From: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
---|---|
To: | jeff sacksteder <jsacksteder(at)gmail(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: alter sequence + subqueries |
Date: | 2005-09-16 23:19:08 |
Message-ID: | 20050916231908.GE9069@surnet.cl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Fri, Sep 16, 2005 at 06:36:48PM -0400, jeff sacksteder wrote:
> 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?
No, but you could call the setval() function instead ...
--
Alvaro Herrera -- Valdivia, Chile Architect, www.EnterpriseDB.com
Officer Krupke, what are we to do?
Gee, officer Krupke, Krup you! (West Side Story, "Gee, Officer Krupke")
From | Date | Subject | |
---|---|---|---|
Next Message | Kenneth Dombrowski | 2005-09-16 23:27:10 | Re: plpgsql function not accepting NULL value |
Previous Message | Michael Fuhr | 2005-09-16 23:18:35 | Re: plpgsql function not accepting NULL value |