Re: delete on cascade

From: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>
To: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>, Luca Ferrari <fluca1978(at)infinito(dot)it>, pgsql-sql(at)postgresql(dot)org
Subject: Re: delete on cascade
Date: 2006-10-23 19:04:33
Message-ID: 20061023190433.66796.qmail@web31806.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

i guess my first attempt to send a reply failed.

--- Richard Broersma Jr <rabroersma(at)yahoo(dot)com> wrote:

> > Hi all,
> > I guess this is an already asked question, but I didn't found an answer, so
> > apologize me. Imagine I've got two tables:
> > skill(id,description) // primary key => id
> > family(id,description) // primary key => id
> > and I want to associate skills to families:
> > ass_sf(id_skill,id_family) // appropriate foreign keys
> >
> > Tables are already created and the database is running. Now I'd like to
> > implement a delete cascade, thus when I delete a skill also its association
> > with the family must be deleted. I gues I should have declared the skill
> > table as follows:
> > CREATE TABLE skill
> > (
> > id varchar(20) on delete cascade,
> > description varchar(50),
> > primary key(id)
> > );
> >
> > right? The problem is: how can I alter the table to add the column constraint
> > now, without redeclaring the table?
> > Thanks very much for helping me.
>
> This link has one line that is very similar to what you want to do. You will probably have to
> start a transaction, drop the foriegn key contraint and then add a new foriegn key contraint
> with
> the on drop cascade .
>
> http://archives.postgresql.org/pgsql-general/2006-10/msg00467.php
>
> Regards,
>
> Richard Broersma Jr.
>
>

Browse pgsql-sql by date

  From Date Subject
Next Message Chander Ganesan 2006-10-24 16:18:29 Re: [NOVICE] Can we convert from Postgres to Oracle !!???
Previous Message Andrew Sullivan 2006-10-23 17:16:49 Re: conversion of numeric field from MSSQL to postgres