Re: Help with ADD COLUMN

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Philip Warner <pjw(at)rhyme(dot)com(dot)au>
Cc: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Help with ADD COLUMN
Date: 2002-11-24 17:35:39
Message-ID: 26914.1038159339@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Philip Warner <pjw(at)rhyme(dot)com(dot)au> writes:
> At 03:48 PM 23/11/2002 -0800, Christopher Kings-Lynne wrote:
>> I assume that's the correct behaviour? If they specify a default, the
>> column should be auto-filled with that default, right?

> Good question.

No, it's perfectly clear in the spec:

1) The column defined by the <column definition> is added to T.

2) Let C be the column added to T. Every value in C is the default
value for C.

The reason we currently reject DEFAULT in an ADD COLUMN is precisely
that the spec requires the semantics we don't have implemented.
(On the other hand, ALTER COLUMN SET DEFAULT is easy because it's not
supposed to affect existing table rows.)

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2002-11-24 20:10:15 7.3RC2 please
Previous Message Hannu Krosing 2002-11-24 16:14:01 Re: Help with ADD COLUMN