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

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: "Brent R(dot) Matzelle" <bmatzelle(at)yahoo(dot)com>
Cc: "'PostgreSQL-general'" <pgsql-general(at)postgresql(dot)org>
Subject: Re: RE: finding and removing a constraint...
Date: 2001-03-21 16:46:35
Message-ID: Pine.BSF.4.21.0103210844430.35067-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Stephan Szabo
sszabo(at)bigpanda(dot)com

On Wed, 21 Mar 2001, Brent R. Matzelle wrote:

> 3/20/2001 6:18:23 AM, Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> wrote:
> >> 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.
> >
> >You should be able to, you just have to use the *real* trigger name (first
> >column in pg_trigger, will look like RI_ConstraintTrigger_<oid> or
> >something like that) and make sure to "" it because it's a quoted mixed
> >case name.
>
> It might be even easier to just delete according to the oid.
>
> select oid, * from pg_trigger;
> delete from pg_trigger where oid = 49469 /* Numbers are easier */;

Because he has two fk constraints on the table, plus, two of the
triggers are on the referenced table not the referencing table and
deleting from pg_trigger is unsafe unless you also set reltriggers in
pg_class, it really is generally better to use drop trigger. :)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Feite Brekeveld 2001-03-21 17:20:21 to_timestamp question
Previous Message Brent R. Matzelle 2001-03-21 16:33:45 Re: Hope it is not too offtopic