orphaned trigger - Mailing list pgsql-bugs

From Jonathan Ellis
Subject orphaned trigger
Date
Msg-id 008901c0de4d$d6f1e900$5a050a0a@devjellis
Whole thread Raw
In response to 7.1 Upgrade Failure  ("Schroeder, Steve" <schroeder@LATHAM.com>)
Responses Re: orphaned trigger  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
List pgsql-bugs
This is in 7.1.1:

I was playing around with a table called user_comments and then dropped it.
One of its columns referenced the user_id column of another table, users.
Now whenever I try to update users, I get results like this:
bf2-new=# update users set last_visit=sysdate() where user_id=4; ERROR:
Relation 'user_comments' does not exist

Somehow a constraint trigger that should have been dropped wasn't.

I looked at the dump file and this is the only reference to user_comments:

CREATE CONSTRAINT TRIGGER "<unnamed>" AFTER UPDATE ON "users" NOT DEFERRABLE
INITIALLY IMMEDIATE FOR EACH ROW EXECUTE PROCEDURE "RI_FKey_noaction_upd"
('<unnamed>', 'user_comments', 'users', 'UNSPECIFIED', 'user_id',
'user_id');

but I am not out of the woods here because it won't let me drop it:

bf2-new=# drop trigger RI_ConstraintTrigger_44349 on users; ERROR:
DropTrigger: there is no trigger ri_constrainttrigger_44349 on relation
users

It's in pg_trigger all right -- and with tgrelid = (select relfilenode from
pg_class where relname = 'users') -- but it won't drop.  Would manually
removing it from pg_trigger cause Bad Things to happen?

-Jonathan

pgsql-bugs by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Installation problem on MacOSX
Next
From: Stephan Szabo
Date:
Subject: Re: orphaned trigger