pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bryce Nesbitt <bryce1@obviously.com>
To: pgsql-sql@postgresql.org
Subject: Is this a bug?  Deleting a column deletes the constraint.
Date: Wed, 11 Oct 2006 22:11:51 -0700
Message-ID: <452DCE97.2090706@obviously.com> (raw)

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/




view thread (6+ messages)  latest in thread

Message-ID: <452DCE97.2090706@obviously.com>
Permalink:  ../452DCE97.2090706@obviously.com/
Also on:    postgresql.org/message-id/452DCE97.2090706@obviously.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: bryce1@obviously.com
  Subject: Re: Is this a bug?  Deleting a column deletes the constraint.
  In-Reply-To: <452DCE97.2090706@obviously.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox