Re: How do I drop or change a foreign key?

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: wsheldah(at)lexmark(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How do I drop or change a foreign key?
Date: 2001-08-23 16:22:42
Message-ID: Pine.BSF.4.21.0108230921350.17322-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Thu, 23 Aug 2001 wsheldah(at)lexmark(dot)com wrote:

>
>
> After I created my tables, I went back and added foreign keys to them. Now I
> need to change one of the foreign keys to 'ON DELETE CASCADE' behaviour so that
> related records are automatically deleted, rather than causing an error when a
> record in the parent table is deleted. I know the name of the foreign key, but
> none of the standard 'drop' commands seem to apply to it. Am I forced to move
> the data to a temp table, drop the table and recreate, then move the data back?
> Improvements to the ALTER commands are already high on my personal list of
> desired improvements; I run into this sort of thing fairly consistently as users
> change their minds or clarify their requirements.

I believe current source have a DROP CONSTRAINT, however for older
versions, you need to look up the trigger names for the constraint in
pg_trigger and use DROP TRIGGER (you'll need to double quote the name
because of the mixed case).

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Fernando Schapachnik 2001-08-23 16:31:08 Re: Views in PgAccess
Previous Message Tom Lane 2001-08-23 16:19:43 Re: Views in PgAccess