pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: chester c young <chestercyoung@yahoo.com>
To: Luca Ferrari <fluca1978@infinito.it>
Cc: sql pgsql <pgsql-sql@postgresql.org>
Subject: Re: delete on cascade
Date: Mon, 23 Oct 2006 08:41:25 -0700 (PDT)
Message-ID: <20061023154126.58178.qmail@web54307.mail.yahoo.com> (raw)
In-Reply-To: <200610231049.16507.fluca1978@infinito.it>

--- Luca Ferrari <fluca1978@infinito.it> 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.
> Luca
  
drop the constraint and re-declare it.  (you can see the constraint
name by \dt skill from psql.)


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



view thread (8+ messages)  latest in thread

Message-ID: <20061023154126.58178.qmail@web54307.mail.yahoo.com>
Permalink:  ../20061023154126.58178.qmail@web54307.mail.yahoo.com/
Also on:    postgresql.org/message-id/20061023154126.58178.qmail@web54307.mail.yahoo.com

 · 

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: chestercyoung@yahoo.com, fluca1978@infinito.it
  Subject: Re: delete on cascade
  In-Reply-To: <20061023154126.58178.qmail@web54307.mail.yahoo.com>

* 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