Is this a bug? Deleting a column deletes the constraint.

From: Bryce Nesbitt <bryce1(at)obviously(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Is this a bug? Deleting a column deletes the constraint.
Date: 2006-10-12 05:11:51
Message-ID: 452DCE97.2090706@obviously.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2006-10-12 05:25:48 Re: Is this a bug? Deleting a column deletes the constraint.
Previous Message Stuart McGraw 2006-10-12 04:15:58 Re: slow view