Re: Alter column / array

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Rolf Lüttecke <rolf(dot)luettecke(at)michael-telecom(dot)de>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Alter column / array
Date: 2001-10-11 18:07:37
Message-ID: Pine.BSF.4.21.0110111105060.92439-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Thu, 11 Oct 2001, [iso-8859-1] Rolf Lttecke 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?

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Peter Eisentraut 2001-10-11 20:03:28 Re: Permission Denied When i am Trying to take Backup
Previous Message Herbert Rabago Ambos 2001-10-11 17:51:17 Re: Wanted: way to limit logging