Re: Altering table error

From: Nabil Sayegh <postgresql(at)e-trolley(dot)de>
To: Josep Sànchez i Mesegué <jsmesegue(at)transpujol(dot)com>
Cc: pgsql-novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Altering table error
Date: 2003-05-26 11:55:35
Message-ID: 1053950134.7807.16.camel@billy
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Mohan A 2003-05-26 12:15:21 Language Support
Previous Message A.Bhuvaneswaran 2003-05-26 05:06:41 Re: psql without password