From: | "Owen Jacobson" <ojacobson(at)osl(dot)com> |
---|---|
To: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: alter table |
Date: | 2006-02-15 19:31:17 |
Message-ID: | 144D12D7DD4EC04F99241498BB4EEDCC220791@nelson.osl.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Andreas Kretschmer wrote:
>
> Maciej Piekielniak <piechcio(at)isb(dot)com(dot)pl> schrieb:
>
> > Hello Andreas,
> >
> > Wednesday, February 15, 2006, 7:54:28 PM, you wrote:
> > AK> test=# alter table xyz alter column id set default
> nextval('xyz_seq'), alter column foo set default '';
> >
> > PGAdmin-SQL:
> >
> > alter table xyz alter column id set default
> nextval('xyz_seq'), alter column foo set default '';
> >
> > ERROR: syntax error at or near "," at character 63
>
> Hmm.
>
> test=# select version();
> version
> --------------------------------------------------------------
> ------------------------------------------------
> PostgreSQL 8.1.2 on i486-pc-linux-gnu, compiled by GCC cc
> (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
From | Date | Subject | |
---|---|---|---|
Next Message | Maciej Piekielniak | 2006-02-15 19:45:00 | Re: alter table |
Previous Message | Maciej Piekielniak | 2006-02-15 19:30:26 | Re: alter table |