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?