How does postgres remain the unique index unique?

Started by zhuangjifengalmost 22 years ago1 messageshackers
Jump to latest
#1zhuangjifeng
zhuangjifeng@263.net

<html><pre><PRE><HTML><PRE><PRE>Hello,<BR><!-- -->everyone,<BR><!-- --> I want to know how postgres remain its unique index unique after i have change it,For<BR><!-- -->example:<BR><!-- --> CREATE TABLE human(age INT,name CHAR(30));<BR><!-- -->then in pg_attribute catalog the unique index pg_attribute_relid_attnum_index will use the relid of<BR><!-- -->'human' and attnum of age to create a index tuple for attribute:age,which is a unique index tuple describing<BR><!-- -->age ,then i do:<BR><!-- --> ALTER TABLE human RENAME age TO birthdate;<BR><!-- -->in the unique index pg_attribute_relid_attnum_index will appear two index tuple which keys are relid of 'human'<BR><!-- -->and attnum:1 to describe age(In my mind,when insert or update a heap tuple,postgres only inserts a new index <BR><!-- -->tuple for it in its index relation if it has not delete or tag the old index tuple),but there is no error<BR><!-- -->happening!!!!So i am interested in the method of remianing the dynamic index unique very much.<BR><!-- --> would you please tell me how postgres completes it and the src of this?<BR><!-- -->thank:)<BR><!-- --> 庄继锋 <BR><!-- --> 2004-4-30</PRE></PRE>

==========================
263电子邮件-信赖邮自专业</PRE></pre></html>

==========================
263电子邮件-信赖邮自专业