Is this a bug? Deleting a column deletes the constraint. - Mailing list pgsql-sql

From Bryce Nesbitt
Subject Is this a bug? Deleting a column deletes the constraint.
Date
Msg-id 452DCE97.2090706@obviously.com
Whole thread Raw
Responses Re: Is this a bug? Deleting a column deletes the constraint.  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
I got bit by this to be sure, but is it a bug?  I guess I'd hoped for a
warning at the critical step (see "poof" below):

create table tester (one int, two int, three int);
alter table only tester add constraint no_dupes unique (one, two, three);
insert into tester values(1,2,3);
insert into tester values(1,2,4);
insert into tester values(1,2,3);      -- this gets denied by the constraint
alter table tester add column new_three varchar(8);
alter table tester rename column three to old_three;
\d tester;                                    -- the constraint moves to
the new column name
alter table tester rename column new_three to three;
\d tester;                                    -- the constraint remains
alter table tester drop column old_three;
\d tester;                                    -- poof, the constraint is
gone with no warning

-- 
----
Visit http://www.obviously.com/



pgsql-sql by date:

Previous
From: "Stuart McGraw"
Date:
Subject: Re: slow view
Next
From: Tom Lane
Date:
Subject: Re: Is this a bug? Deleting a column deletes the constraint.