Re: Altering table error - Mailing list pgsql-novice

From Nabil Sayegh
Subject Re: Altering table error
Date
Msg-id 1053950134.7807.16.camel@billy
Whole thread Raw
In response to Altering table error  (Josep Sànchez i Mesegué <jsmesegue@transpujol.com>)
Responses Re: Altering table error
List pgsql-novice
Am Mon, 2003-05-19 um 11.43 schrieb Josep Sànchez i Mesegué:
> | provesmasis-# ERROR:  Adding columns with defaults is not implemented.
> | provesmasis-#         Add the column, then use ALTER TABLE SET DEFAULT.
>
> What am I doing wrong?

serial is a 'macro'
It is an integer with an auto-increment value.
The auto-increment is implemented as a
default nextval('HERE_COMES_A_SEQUENCE_seq'::text)

But: Alter table with defaults is not implemented.

So you have to
1. add an int column cap_id (instead of serial).
2. create a sequence
3. alter the table again and SET DEFAULT nextval('YOUR_SEQ_seq'::text);

BTW: What version of postgresql are you using ?

HTH
--
 e-Trolley Sayegh & John, Nabil Sayegh
 Tel.: 0700 etrolley /// 0700 38765539
 Fax.: +49 69 8299381-8
 PGP : www.e-trolley.de


pgsql-novice by date:

Previous
From: "A.Bhuvaneswaran"
Date:
Subject: Re: psql without password
Next
From: "Mohan A"
Date:
Subject: Language Support