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

Поиск
Список
Период
Сортировка
От Hannu Krosing
Тема Re: Happy column adding (was RE: [HACKERS] Happy column dropping)
Дата
Msg-id 388EB436.8AE7334F@tm.ee
обсуждение исходный текст
Ответ на RE: Happy column adding (was RE: [HACKERS] Happy column dropping)  ("Hiroshi Inoue" <Inoue@tpf.co.jp>)
Ответы RE: Happy column adding (was RE: [HACKERS] Happy column dropping)  ("Hiroshi Inoue" <Inoue@tpf.co.jp>)
Re: Happy column adding (was RE: [HACKERS] Happy column dropping)  (Don Baccus <dhogaza@pacifier.com>)
Список pgsql-hackers
Hiroshi Inoue wrote:
> 
> > However, heap_getattr still won't see the default since it simply
> > checks to see of the attribute number falls off the end of the
> > tuple and then returns null.
> >
> 
> Sorry,the following question might be already answered but too
> many postings for me.
> 
> 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.

But, considering the fact that DEFAULT can be something reaaly complex, like
function that does a lot of things, it may be better to have the constraints
checked at the end of transaction, like

BEGIN;
ALTER TABLE T1 ADD COLUMN C1 TEXT NOT NULL;
UPDATE T1 SET C1='MYDEFAULTVALUE';
COMMIT;

only IIRC we have quite poor support for DDL statements inside transactions.

---------------
Hannu


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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] --enable-debug
Следующее
От: Zeugswetter Andreas SB
Дата:
Сообщение: AW: AW: [HACKERS] Some notes on optimizer cost estimates