Re: RE: finding and removing a constraint...

From: Frank Joerdens <frank(at)joerdens(dot)de>
To: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
Cc: chris markiewicz <cmarkiew(at)commnav(dot)com>, "'PostgreSQL-general'" <pgsql-general(at)postgresql(dot)org>
Subject: Re: RE: finding and removing a constraint...
Date: 2001-03-20 22:00:40
Message-ID: 20010320230040.A22215@rakete.joerdens.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-announce pgsql-general

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

In response to

Responses

Browse pgsql-announce by date

  From Date Subject
Next Message Stephan Szabo 2001-03-20 22:18:23 Re: RE: finding and removing a constraint...
Previous Message Tom Lane 2001-03-20 21:42:46 Re: RE: finding and removing a constraint...

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2001-03-20 22:03:27 Re: Re: Migrating from MS SQL 7
Previous Message Tom Lane 2001-03-20 21:42:46 Re: RE: finding and removing a constraint...