Re: adding columns with defaults is not implemented

From: "Marcelo" <marcelo(at)humano2(dot)com>
To: "Scott Marlowe" <smarlowe(at)g2switchworks(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: adding columns with defaults is not implemented
Date: 2005-06-02 21:47:27
Message-ID: 017e01c567bc$ab798e70$500aa8c0@humano2.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Hi,
Thanks for your reply, but I have some doubts.

Are yoy sugesting I create the column as an Integer then change it to
Serial? in Pgsql 7 you cant change a column type.

If I create the column as an int then add a default value, how can I make
this default value increment with each insert?

Thanks again for your help.
Marcelo

----- Original Message -----
From: "Scott Marlowe" <smarlowe(at)g2switchworks(dot)com>
To: "Marcelo" <marcelo(at)humano2(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Sent: Thursday, June 02, 2005 4:43 PM
Subject: Re: [GENERAL] adding columns with defaults is not implemented

> On Thu, 2005-06-02 at 15:29, Marcelo wrote:
> > Hello,
> > Using Postgres 7.4, I am trying to perform an "alter table
> > temptable add column "myCol" serial"
> >
> > It gives the following msg
> > ERROR: adding columns with defaults is not implemented
> >
> > You cannot add a column that is serial in a table which already has
> > data in postgres 7.
> >
> > Is there a way I can create a serial column on a table which already
> > has data? Or is the only solution upgrading to postgres 8 ?
>
> You can add a default after you add the column with a separate alter
> table statement...
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruno Wolff III 2005-06-02 22:02:14 Re: SQL call to get pid of current connection
Previous Message David Parker 2005-06-02 21:04:22 SQL call to get pid of current connection