Skip site navigation (1) Skip section navigation (2)

"alter table rename" does not update constraints

From: Ulf Mehlig <umehlig(at)uni-bremen(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: "alter table rename" does not update constraints
Date: 2000-07-26 19:46:31
Message-ID: 14719.16407.401101.399975@pandora3.vmnet.localnet (view raw, whole thread or download thread mbox)
Lists: pgsql-general
Hi there,

I successfully renamed one of the columns of the primary key of one of
my tables (it is used in one of the foreign keys, too -- I think, this
is the problem). Unfortunately, the constraint (rule system?) wasn't
updated by "alter table" -- have a look:

  db=# create table blatt_schaeden (
               nummer smallint not null,
               datum date not null,
               typ smallint not null,
               klasse smallint,
               schaden smallint,
               primary key (nummer,datum,typ),
               foreign key (nummer) references blatt,
               foreign key (typ) references blatt_schadenstyp
  db=# alter table blatt_schaeden rename column nummer to blatt_nummer;
  db=# update blatt_schaeden set klasse = 0 where schaden=0;
  ERROR:  constraint <unnamed>: table blatt_schaeden does not have an attribute nummer

Do you consider this as a bug? There are similar items in the TODO
file, related to "alter table add" ...

Thanks for your attention,

postgreSQL 7.0.2, i386 Linux 2.2.15/Redhat-6.something

Ulf Mehlig    <ulf(dot)mehlig(at)zmt(dot)uni-bremen(dot)de>
              Center for Tropical Marine Ecology/ZMT, Bremen, Germany


pgsql-general by date

Next:From: Jan WieckDate: 2000-07-26 19:51:34
Subject: Re: Re: [GENERAL] Is Pg 7.0.x's Locking Mechanism BROKEN?
Previous:From: Jan WieckDate: 2000-07-26 19:31:12
Subject: Re: function language type?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group