Re: Alter column / array - Mailing list pgsql-admin

From Stephan Szabo
Subject Re: Alter column / array
Date
Msg-id Pine.BSF.4.21.0110111105060.92439-100000@megazone23.bigpanda.com
Whole thread Raw
In response to Alter column / array  (Rolf Lüttecke <rolf.luettecke@michael-telecom.de>)
List pgsql-admin
On Thu, 11 Oct 2001, [iso-8859-1] Rolf L�ttecke wrote:

> Hi list,
>
> I can't find out why the following command give different results:
>
> database-# CREATE TABLE "test1" (dev_id int, dev_slots integer[] DEFAULT
> '{0,0,0,0,0}');
> CREATE
>
> If you display (\d test1) the table-structure all looks good - even the
> DEFAULTs.
>
> ...but if you have an existing table and want to add a column of type array,
> it doesn't
> work:
>
> database-# CREATE TABLE "test2" (dev_id int);
> CREATE
> database-# ALTER TABLE "test2" ADD COLUMN dev_slots integer[] DEFAULT
> '{0,0,0,0,0}');
> ALTER
>
> If you now display the table-structure, the DEFAULT-statement is not listed
> and
> UPDATE-commands on the ARRAY do strange things.

If I remember correctly, defaults are currently ignored on add
column.  I think you can use alter table alter column to add the default.

And, what do you mean by updates doing strange things?


pgsql-admin by date:

Previous
From: Dong B Calmada
Date:
Subject: how to create function/procedure for commenting multiple objects (e.g., columns)
Next
From: Tom Lane
Date:
Subject: Re: how to create function/procedure for commenting multiple objects (e.g., columns)