Re: ALTER TABLE ADD COLUMN column SERIAL -- unexpected results - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: ALTER TABLE ADD COLUMN column SERIAL -- unexpected results
Date
Msg-id Pine.LNX.4.30.0107171939300.678-100000@peter.localdomain
Whole thread Raw
In response to Re: ALTER TABLE ADD COLUMN column SERIAL -- unexpected results  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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@gmx.net   http://funkturm.homeip.net/~peter



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Idea: recycle WAL segments, don't delete/recreate 'em
Next
From: Bruce Momjian
Date:
Subject: Re: pg_depend