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

From: Hannu Krosing <hannu(at)tm(dot)ee>
To: Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp>
Cc: Don Baccus <dhogaza(at)pacifier(dot)com>, PostgreSQL Development <pgsql-hackers(at)postgreSQL(dot)org>, Peter Eisentraut <peter_e(at)gmx(dot)net>
Subject: Re: Happy column adding (was RE: [HACKERS] Happy column dropping)
Date: 2000-01-26 08:45:42
Message-ID: 388EB436.8AE7334F@tm.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Zeugswetter Andreas SB 2000-01-26 08:51:40 AW: AW: [HACKERS] Some notes on optimizer cost estimates
Previous Message Bruce Momjian 2000-01-26 06:04:12 Re: [HACKERS] --enable-debug