Re: ALTER TABLE ADD COLUMN column SERIAL -- unexpected results

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: 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 results
Date: 2001-07-17 17:43:22
Message-ID: Pine.LNX.4.30.0107171939300.678-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane writes:

> Besides, it seems to me there are cases where you don't really
> *want* the DEFAULT value to be used to fill the column, but something
> else (or even want NULLs).

Then you could use

ALTER TABLE t1 ADD COLUMN cn text;
ALTER TABLE t1 ALTER COLUMN cn SET DEFAULT 'what you really wanted';

A subtle difference, but it's perfectly consistent. -- And it works
already.

--
Peter Eisentraut peter_e(at)gmx(dot)net http://funkturm.homeip.net/~peter

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Frank Ch. Eigler 2001-07-17 17:53:40 Re: Idea: recycle WAL segments, don't delete/recreate 'em
Previous Message Tom Lane 2001-07-17 17:33:52 Re: pg_depend