Re: ALTER TABLE ADD COLUMN column SERIAL -- unexpected

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp>, Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Rod Taylor <rbt(at)barchord(dot)com>, Hackers List <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ALTER TABLE ADD COLUMN column SERIAL -- unexpected
Date: 2001-11-28 20:47:21
Message-ID: Pine.LNX.4.30.0111281502350.636-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian writes:

> o ALTER TABLE ADD COLUMN column SET DEFAULT should fill existing
> rows with DEFAULT value or allow NULLs in existing rows
>
> My guess is that we will have to do spec behavior by default, and add a
> flag to allow NULLs in existing rows.

May I point you to the already existing set of commands that do exactly
what you want:

ALTER TABLE t1 ADD COLUMN name type;
ALTER TABLE t1 ALTER COLUMN name SET DEFAULT foo;

There's no reason to muck around with the spec here.

--
Peter Eisentraut peter_e(at)gmx(dot)net

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2001-11-28 20:48:02 Re: FW: [ppa-dev] Severe bug in debian - phppgadmin opens
Previous Message Doug McNaught 2001-11-28 20:44:29 Re: FW: [ppa-dev] Severe bug in debian - phppgadmin opens