Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 9A6019FA491 for ; Mon, 23 Oct 2006 05:49:41 -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 41662-01 for ; Mon, 23 Oct 2006 08:49:26 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from aa016msg.fastweb.it (aa016msg.fastweb.it [213.140.2.83]) by postgresql.org (Postfix) with ESMTP id 43EC59FA3C0 for ; Mon, 23 Oct 2006 05:49:26 -0300 (ADT) Received: from ms011msg.fastweb.it (10.31.40.27) by aa016msg.fastweb.it (7.3.105.6) id 4535D645001BC5C6 for pgsql-sql@postgresql.org; Mon, 23 Oct 2006 10:48:57 +0200 Received: from [192.168.1.201] (85.18.239.131) by ms011msg.fastweb.it (7.2.070) id 443CC12D04988F59 for pgsql-sql@postgresql.org; Mon, 23 Oct 2006 10:49:17 +0200 From: Luca Ferrari To: pgsql-sql@postgresql.org Subject: delete on cascade Date: Mon, 23 Oct 2006 10:49:16 +0200 User-Agent: KMail/1.9.5 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200610231049.16507.fluca1978@infinito.it> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200610/199 X-Sequence-Number: 26588 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