On Tue, Mar 20, 2001 at 01:41:22PM -0800, Stephan Szabo wrote:
> On Tue, 20 Mar 2001, chris markiewicz wrote:
>
> > okay, i screwed up. i dropped some triggers from a table. now that table
> > is not accessible to me.
> >
> > can't drop it...can't select...can't pg_dump.
> >
> > message is error: RelationBuildTriggers: 2 record(s) not found for rel
> > accessor_group
> >
> > or a pg_dump results in: getTables(): relation 'accessor_group': 6 Triggers
> > were expected, but got 4.
> >
> > is there any way that i can re-insert them?
> >
> > if i'm screwed, then how do i drop this table?
>
> Okay... (you should really use drop trigger, not deleting from
> pg_trigger).
The problem is that the syntax
create table SomeTable (
SomeColumn int4 references OtherTable ( SomeColumn ),
. . .
creates an <unnamed> trigger which you can't drop with drop trigger
because it doesn't have a name. What you suggest does work for me, i.e.
deleting from pg_trigger and then adjusting the trigger count in
pg_class but it is quite cumbersome.
The lesson here seems to be: Either have you schema so well thought
through that you don't need to mess with triggers created in the above
fashion once you have them in place, or make sure that all the FK
references you create are named.
Regards, Frank