Implementing cascading deletes on an existing table

From: Culley Harrelson <culleyharrelson(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Implementing cascading deletes on an existing table
Date: 2001-03-21 14:42:17
Message-ID: 3AB8BDC9.D71F5397@yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,

Im trying to find out the best way to implement cascading deletes on an
existing table. I have this:

create table fe_custom_set_card(
custom_set_id int4 references fe_custom_set(custom_set_id) on delete
cascade,
card_id int4 references fe_card(card_id),
card_sequence int2,
category text,
primary key(custom_set_id, card_id)
);

and I want to implement this:

create table fe_custom_set_card(
custom_set_id int4 references fe_custom_set(custom_set_id) on delete
cascade,
card_id int4 references fe_card(card_id) on delete cascade,
card_sequence int2,
category text,
primary key(custom_set_id, card_id)
);

How do I go about making this transition? Dump the data, drop the
table, recreate it and load the data?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2001-03-21 14:46:44 Re: error messages VERY misleading...!
Previous Message Renaud Tthonnart 2001-03-21 14:31:51 Problem with interface C++ for PostgreSQL