changing referential integrety action on existing table

From: "Matthew Nuzum" <cobalt(at)bearfruit(dot)org>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: changing referential integrety action on existing table
Date: 2003-02-06 19:25:43
Message-ID: 006c01c2ce15$8a825eb0$6900a8c0@mattspc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I have a table that uses the NO ACTION action for it's referential
integrity. I'd like to change it to CASCADE for the ON DELETE event.
I'm using Postgres 7.2.

I noticed that in the output of my pg_dump I have some triggers that
look like:
CREATE CONSTRAINT TRIGGER "RI_ConstraintTriger_*"

Is it possible to use this syntax to change the constraints? The
documentation says it's not intended for general use and isn't very
detailed about it's use.

Here is an example from my dump file:
CREATE CONSTRAINT TRIGGER "RI_ConstraintTrigger_43755" AFTER DELETE ON
"packages" NOT DEFERRABLE INITIALLY IMMEDIATE FOR EACH ROW EXECUTE
PROCEDURE "RI_FKey_noaction_del" ('<unnamed>', 'components', 'packages',
'UNSPECIFIED', 'packageid', 'packageid');

Could I simply change the procedure mentioned from RI_FKey_noaction_del
to RI_FKey_cascade_del?

Do I have to do a DROP TRIGGER first?

I know I can just try it, but last time I got creative with this, it
cost me a couple hours trying to recreate things.

Matthew Nuzum
www.bearfruit.org
cobalt(at)bearfruit(dot)org

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Roberto Mello 2003-02-06 19:27:43 Re: get # of rows while doing SELECT with LIMIT at same time ?
Previous Message Lex Berezhny 2003-02-06 18:57:35 Re: Returning records from a function