Thread

  1. bug in 7.0.3 related to triggers and field rename

    PostgreSQL Bugs List <pgsql-bugs@postgresql.org> — 2001-04-13T11:24:23Z

    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 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'
    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