bug in 7.0.3 related to triggers and field rename - Mailing list pgsql-bugs

From pgsql-bugs@postgresql.org
Subject bug in 7.0.3 related to triggers and field rename
Date
Msg-id 200104131124.f3DBONR41908@hub.org
Whole thread Raw
List pgsql-bugs
Giuseppe Sacco (eppesuigoccas@libero.it) reports a bug with a severity of 3
The lower the number the more severe it is.

Short Description
bug in 7.0.3 related to triggers and field rename

Long Description
Hi,
I probably found a bug in PostgreSQL 7.0.3 running on Debian GNU/Linux potato. Kernel 2.2.19.

The problem is that I created a foreign key from table two to table one. After that I renamed the field target of the
relation(on table one) expecting PostgreSQL to raise an error since the field is a target. Otherwise I espected an
automaticchange of the foreign key relation. 

Instead PostgreSQL accept the field rename but then (of course) the foreign key trigger gives an error.


Sample Code
elmer3=# create table one (id int4 not null primary key);
NOTICE:  CREATE TABLE/PRIMARY KEY will create implicit index 'one_pkey' for table 'one'
CREATE
elmer3=# create table two (one int4 not null);
CREATE
elmer3=# alter table two add foreign key(one) references one;
NOTICE:  ALTER TABLE ... ADD CONSTRAINT will create implicit trigger(s) for FOREIGN KEY check(s)
CREATE
elmer3=# alter table one rename id to newid;
ALTER
elmer3=# insert into one values (4);
INSERT 79419 1
elmer3=# insert into two values (5);
ERROR:  constraint <unnamed>: table one does not have an attribute id
elmer3=#


No file was uploaded with this report

pgsql-bugs by date:

Previous
From: Philip Warner
Date:
Subject: Re: table data not being restored after pg_dump
Next
From: Tom Lane
Date:
Subject: Re: error creating table that worked under 7.0.3