Re: Error when dropping table - Mailing list pgsql-admin

From Tom Lane
Subject Re: Error when dropping table
Date
Msg-id 5398.1088023097@sss.pgh.pa.us
Whole thread Raw
In response to Re: Error when dropping table  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Error when dropping table  ("Chris White (cjwhite)" <cjwhite@cisco.com>)
List pgsql-admin
Tom Lane <tgl@sss.pgh.pa.us> writes:
> "Chris White (cjwhite)" <cjwhite@cisco.com> writes:
>> On 7.4.2, I am trying to drop a table using the command
>> drop table vm_message cascade;
>> and I get the error message
>> relation "vm_message" has rel_triggers = 0

> I can't find any such error message in the 7.4 sources.

Oh, here it is --- should have checked the spelling of the pg_class
field:
        elog(ERROR, "relation \"%s\" has reltriggers = 0",
             RelationGetRelationName(rel));

The most likely bet is that a failed pg_restore left the relation's
triggers disabled.  You can fix this by doing what the restore should
have done:

UPDATE pg_catalog.pg_class SET reltriggers =
(SELECT count(*) FROM pg_catalog.pg_trigger where pg_class.oid = tgrelid)
FROM pg_catalog.pg_namespace
WHERE relnamespace = pg_namespace.oid AND nspname !~ '^pg_';

            regards, tom lane

pgsql-admin by date:

Previous
From: Tom Lane
Date:
Subject: Re: Error when dropping table
Next
From: "Chris White (cjwhite)"
Date:
Subject: Re: Error when dropping table