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

From: "Hiroshi Inoue" <Inoue(at)tpf(dot)co(dot)jp>
To: "Hannu Krosing" <hannu(at)tm(dot)ee>
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 13:08:44
Message-ID: NDBBIJLOILGIKBGDINDFIEFOCCAA.Inoue@tpf.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> -----Original Message-----
> From: Hiroshi Inoue [mailto:Inoue(at)tpf(dot)co(dot)jp]
> > 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;
>
> Isn't 'iNITIALLY DEFERRED' needed ?
> ALTER TABLE T1 ADD COLUMN C1 TEXT NOT NULL INITIALLY DEFERRED;
>
> > UPDATE T1 SET C1='MYDEFAULTVALUE';
> > COMMIT;
> >
>
> It seems more reasonable than standard.
> But is it worth breaking SQL standard ?
>

Seems I was wrong. It's not so good.
Current spec to reject NOT NULL/DEFAULT for new column
isn't so bad and ADD CONSTRAINT feature is much more
important. How about the following ?

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

Regards.

Hiroshi Inoue
Inoue(at)tpf(dot)co(dot)jp

Browse pgsql-hackers by date

  From Date Subject
Next Message Jose Soares 2000-01-26 13:24:14 Re: Happy column adding (was RE: [HACKERS] Happy column dropping)
Previous Message Zeugswetter Andreas SB 2000-01-26 12:25:55 AW: AW: AW: [HACKERS] Some notes on optimizer cost estimates