rename column and trigger on column

From: Chris Sutton <chris(at)ifloor(dot)com>
To: <pgsql-bugs(at)postgresql(dot)org>
Subject: rename column and trigger on column
Date: 2002-02-15 17:42:48
Message-ID: Pine.LNX.4.33.0202150932020.29156-100000@zev.ifloor.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

create table ref_table (
id serial primary key
ref_name varchar);

create table data_table (
a int4 references ref_table);

which of course creates 3 triggers.

If you do:

alter table data_table rename column a to b;

The trigger on data_table still looks for column named "a" so sometime in
the future you will probably get:

ERROR: constraint <unnamed>: table data_table does not
have an attribute a

Possible solutions, along with telling the db admin to pay attention ;)

1. Check for triggers on column before allowing rename and if they
exist, give a warning of the trigger that needs to be recreated

2. Rebuild the trigger automatically

3. Delete the trigger

Browse pgsql-bugs by date

  From Date Subject
Next Message Ed Erdman 2002-02-15 20:19:58 Postgres 7.1 problem
Previous Message Torres Abarca Jaime 2002-02-15 16:40:49 Compiling error