Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id D880C9FB41F for ; Mon, 23 Oct 2006 12:41:36 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 18805-06 for ; Mon, 23 Oct 2006 15:41:28 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from web54307.mail.yahoo.com (web54307.mail.yahoo.com [206.190.49.117]) by postgresql.org (Postfix) with SMTP id 937439FB41D for ; Mon, 23 Oct 2006 12:41:27 -0300 (ADT) Received: (qmail 58180 invoked by uid 60001); 23 Oct 2006 15:41:26 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=EV6sP+XqUzwb8FUnOdfZ/Klg+w4wrYvHFzEblh2EzbOAE+v+FXNqDQjemWp5Ykbkoq0LHuUoruFkICNmzm8P9I6Bnej5w+KivuQXP2EWmkz82Pif2zl8kcS1En92IIbk/F8F3IZTXSpyqqniQfJxjP6OjXXynUieoENIEFUgZOE= ; Message-ID: <20061023154126.58178.qmail@web54307.mail.yahoo.com> Received: from [68.35.2.64] by web54307.mail.yahoo.com via HTTP; Mon, 23 Oct 2006 08:41:25 PDT Date: Mon, 23 Oct 2006 08:41:25 -0700 (PDT) From: chester c young Subject: Re: delete on cascade To: Luca Ferrari Cc: sql pgsql In-Reply-To: <200610231049.16507.fluca1978@infinito.it> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=3.355 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, DNS_FROM_RFC_WHOIS X-Spam-Level: *** X-Archive-Number: 200610/203 X-Sequence-Number: 26592 --- Luca Ferrari 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