X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AC93DD91D8 for ; Fri, 16 Sep 2005 19:36:53 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 94092-01 for ; Fri, 16 Sep 2005 22:36:45 +0000 (GMT) Received: from xproxy.gmail.com (xproxy.gmail.com [66.249.82.205]) by svr1.postgresql.org (Postfix) with ESMTP id 0E604D9177 for ; Fri, 16 Sep 2005 19:36:46 -0300 (ADT) Received: by xproxy.gmail.com with SMTP id i27so355528wxd for ; Fri, 16 Sep 2005 15:36:48 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type; b=aO6Q1GNrKWdtaD9DRmMzi7CIB10qGpGEBD0+HdyyTX64YAy2EuqrBROa8hEk3LYps1Semmfb5mJTBJOczQ//zLbmiFyBmqD/DOcBS3bNzcx7tWDiDrPnwqiViB1VfqRU37fxhNi7i7ZvC2Za3zOi01cjsn2pO/Tzkf2t7epbWPI= Received: by 10.70.8.15 with SMTP id 15mr385880wxh; Fri, 16 Sep 2005 15:36:48 -0700 (PDT) Received: by 10.70.87.19 with HTTP; Fri, 16 Sep 2005 15:36:48 -0700 (PDT) Message-ID: <51c8a7be050916153613795e1a@mail.gmail.com> Date: Fri, 16 Sep 2005 18:36:48 -0400 From: jeff sacksteder Reply-To: jsacksteder@gmail.com To: pgsql-sql@postgresql.org Subject: alter sequence + subqueries Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_16864_26659165.1126910208540" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.32 required=5 tests=[HTML_10_20=0.295, HTML_MESSAGE=0.001, RCVD_BY_IP=0.024] X-Spam-Level: X-Archive-Number: 200509/165 X-Sequence-Number: 22712 ------=_Part_16864_26659165.1126910208540 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline The postgres-specific sql extension 'ALTER SEQUENCE' does not appear to=20 support subqueries. I have inserted some data into a table, including values in the primary key= .=20 I want to reset the associated sequence so that any further records to be= =20 inserted into that table resume numbering correctly. The statement I=20 attempted was: ALTER SEQUENCE foo_id_seq=20 RESTART WITH (SELECT max(id) FROM foo); Is this syntax correct and supported? ------=_Part_16864_26659165.1126910208540 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline The postgres-specific sql extension 'ALTER SEQUENCE' does not appear to sup= port 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?

 
------=_Part_16864_26659165.1126910208540--