Different results when specifying DEFAULT values through ALTER TABLE

Поиск
Список
Период
Сортировка
От Thusitha Kodikara
Тема Different results when specifying DEFAULT values through ALTER TABLE
Дата
Msg-id 200604190653.k3J6rHVo000891@rly18b.srv.mailcontrol.com
обсуждение исходный текст
Ответы Re: Different results when specifying DEFAULT values through
Список pgsql-admin
Hi,

I observed the following on PostgreSQL 8.1.3 (on Windows 2000).

(1) alter table invoice add column active boolean default true;

This will add a new column "active" with a default clause as "true" and also sets the value "true" to all existing rows
ofthe table. 

BUT

(2) ALTER TABLE invoice  ADD COLUMN active boolean;
ALTER TABLE invoice  ALTER COLUMN active SET DEFAULT true;

Will result in only adding the column "active" with default clause as "true". It will NOT set the value "true" for
existingrows. 

Is there a particular reason for this difference in behaviour? (Or am I missing something in the syntax?)

Thanks and regards,

-Thusitha Kodikara
--



CONFIDENTIALITY NOTICE The information contained in this message is
confidential, intended only for the use of the individual or the entity
named as recipient. If the reader of this message is not that recipient,
you are notified that any dissemination, distribution or copy of this
message is strictly prohibited. If you have received this message in
error, please immediately notify us by telephone on the number above.
Your co-operation is appreciated.

В списке pgsql-admin по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: PGOPTS
Следующее
От: "koji osada"
Дата:
Сообщение: Migration from oracle