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

bug in 7.0.3 related to triggers and field rename

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: bug in 7.0.3 related to triggers and field rename
Date: 2001-04-13 11:24:23
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugs
Giuseppe Sacco (eppesuigoccas(at)libero(dot)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
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 automatic change 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'
elmer3=# create table two (one int4 not null);
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)
elmer3=# alter table one rename id to newid;
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

No file was uploaded with this report

pgsql-bugs by date

Next:From: Tom LaneDate: 2001-04-13 15:59:58
Subject: Re: error creating table that worked under 7.0.3
Previous:From: Antonio SindonaDate: 2001-04-13 11:08:01
Subject: Compiling PG 7.0.3 undex HP-UX 10.20

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