pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tim Perdue <tim@perdue.net>
To: marie.tuite@edisonaffiliates.com
Cc: pgsql-sql@postgresql.org
Subject: Re: ON DELETE CASCADE
Date: Sun, 15 Dec 2002 20:29:40 -0600
Message-ID: <3DFD3A94.20102@perdue.net> (raw)
In-Reply-To: <IGELKLINGDMODABPOOFEAEACCPAA.marie.tuite@edisonaffiliates.com>
References: <IGELKLINGDMODABPOOFEAEACCPAA.marie.tuite@edisonaffiliates.com>

Marie G. Tuite wrote:
> Here is a function that I use to list fk(triggers) on a table.  Execute the
> function to get the trigger name and then - drop trigger "trigger_name" on
> table_name;

Thanks for the function. Strangely enough, it appears the "extra" 
triggers are gone all by themselves. It seems postgres appropriately 
deletes or updates the old triggers when you alter the table the second 
time, even if you did not drop the prior triggers.

>>I'm trying to comb through my database and add ON DELETE CASCADE to a
>>number of tables where I already have fkeys in place, but I'm having a
>>hard time.
>>
>>ALTER TABLE project_task DROP CONSTRAINT
>>"project_task_group_project_id_f" RESTRICT;
>>
>>ERROR:  ALTER TABLE / DROP CONSTRAINT: project_task_group_project_id_f
>>does not exist
>>
>>ALTER TABLE project_task
>>	ADD CONSTRAINT projecttask_groupprojectid_fk
>>	FOREIGN KEY (group_project_id)
>>	REFERENCES project_group_list(group_project_id) ON DELETE CASCADE;
>>NOTICE:  ALTER TABLE will create implicit trigger(s) for FOREIGN KEY
>>check(s)
>>ALTER
>>
>>That command works, but now I think I have 2x as many triggers as I
>>want. How do I get rid of the original triggers?





view thread (10+ messages)

Message-ID: <3DFD3A94.20102@perdue.net>
Permalink:  ../3DFD3A94.20102@perdue.net/
Also on:    postgresql.org/message-id/3DFD3A94.20102@perdue.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tim@perdue.net, marie.tuite@edisonaffiliates.com
  Subject: Re: ON DELETE CASCADE
  In-Reply-To: <3DFD3A94.20102@perdue.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox