Different results when specifying DEFAULT values through ALTER TABLE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 of the 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 existing rows.

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.


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux