X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id C1C849DCA09 for ; Wed, 15 Feb 2006 15:31:19 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 00526-06 for ; Wed, 15 Feb 2006 15:31:19 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from nelson.osl.com (216-21-133-120.ip.van.radiant.net [216.21.133.120]) by postgresql.org (Postfix) with ESMTP id 75C719DCA2D for ; Wed, 15 Feb 2006 15:31:17 -0400 (AST) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Subject: Re: alter table Date: Wed, 15 Feb 2006 11:31:17 -0800 Message-ID: <144D12D7DD4EC04F99241498BB4EEDCC220791@nelson.osl.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [SQL] alter table Thread-Index: AcYyZgOQxCuiUWN6Re2Mq2j9y6f9CwAAB8iw From: "Owen Jacobson" To: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.11 required=5 tests=[AWL=0.110] X-Spam-Score: 0.11 X-Spam-Level: X-Archive-Number: 200602/179 X-Sequence-Number: 24189 Andreas Kretschmer wrote: >=20 > Maciej Piekielniak schrieb: >=20 > > Hello Andreas, > >=20 > > Wednesday, February 15, 2006, 7:54:28 PM, you wrote: > > AK> test=3D# alter table xyz alter column id set default=20 > nextval('xyz_seq'), alter column foo set default ''; > >=20 > > PGAdmin-SQL: > >=20 > > alter table xyz alter column id set default=20 > nextval('xyz_seq'), alter column foo set default ''; > >=20 > > ERROR: syntax error at or near "," at character 63 >=20 > Hmm. >=20 > test=3D# select version(); > version > -------------------------------------------------------------- > ------------------------------------------------ > PostgreSQL 8.1.2 on i486-pc-linux-gnu, compiled by GCC cc=20 > (GCC) 4.0.3 20060104 (prerelease) (Debian 4.0.2-6) > (1 row) Note that prior to 8.0 PostgreSQL does not support multiple ALTER = actions in a single query. To get an equivalent effect, wrap separate = ALTER TABLE queries in a transaction: BEGIN; alter table xyz alter column id set default nextval('xyz_seq'); alter table xyz alter column foo set default ''; COMMIT; Also, are you sure you want '' as a column default, and not ALTER COLUMN = foo DROP DEFAULT? -Owen