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

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: ALTER TABLE ADD COLUMN column SERIAL -- unexpected results
Дата
Msg-id Pine.LNX.4.30.0107171939300.678-100000@peter.localdomain
обсуждение исходный текст
Ответ на Re: ALTER TABLE ADD COLUMN column SERIAL -- unexpected results  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления: