Re: Happy column adding (was RE: [HACKERS] Happy column dropping)

Поиск
Список
Период
Сортировка
От Don Baccus
Тема Re: Happy column adding (was RE: [HACKERS] Happy column dropping)
Дата
Msg-id 3.0.1.32.20000126100750.00fa6340@mail.pacifier.com
обсуждение исходный текст
Ответ на Re: Happy column adding (was RE: [HACKERS] Happy column dropping)  (Hannu Krosing <hannu@tm.ee>)
Список pgsql-hackers
At 10:45 AM 1/26/00 +0200, Hannu Krosing wrote:

>> Do we have to refer default value for already inserted rows ?
>> Doesn't 'default' have its meaning only when rows are about to be
>> inserted ?
>
>I think the case was about adding a NOT NULL column and setting current NULL 
>columns to DEFAULT seemed like a natural thing to do.

etc...

It depends on whether we want to be SQL92 compliant.  The SQL92 standard
seems to make it clear that "add column ... default" is supposed to 
set the column in ALL the rows in the table to that value.

I think it's actually much more useful this way.  If you set a default
value, it is normal to write application code that depends on its 
existence.  If you're going to write your application to work with
the column set to NULL, then you probably don't need the default
anyway.

And...if you don't want to pay the penalty of having to set default
values for all the rows when you add a column with a default value,
you can always add the column without the default value and use a
trigger to set new rows to a default value.  This would give the
functionality you want, no?



- Don Baccus, Portland OR <dhogaza@pacifier.com> Nature photos, on-line guides, Pacific Northwest Rare Bird Alert
Serviceand other goodies at http://donb.photo.net.
 


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Don Baccus
Дата:
Сообщение: Re: AW: AW: [HACKERS] Some notes on optimizer cost estimates
Следующее
От: "Ricardo Coelho"
Дата:
Сообщение: Re: OIDS (Re: [HACKERS] Well, then you keep your darn columns)