X-Original-To: pgsql-admin@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 483AF474E4F for ; Thu, 6 Feb 2003 09:58:41 -0500 (EST) Received: from localhost.localdomain (unknown [65.217.53.66]) by postgresql.org (Postfix) with ESMTP id 262C5474E44 for ; Thu, 6 Feb 2003 09:58:40 -0500 (EST) Received: from thorn.mmrd.com (thorn.mmrd.com [172.25.10.100]) by localhost.localdomain (8.12.5/8.12.5) with ESMTP id h16FMX6P014063; Thu, 6 Feb 2003 10:22:33 -0500 Received: from gnvex001.mmrd.com (gnvex001.mmrd.com [192.168.3.55]) by thorn.mmrd.com (8.11.6/8.11.6) with ESMTP id h16Ewfj15987; Thu, 6 Feb 2003 09:58:41 -0500 Received: from camel.mmrd.com ([172.25.5.213]) by gnvex001.mmrd.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id CWVLDLY5; Thu, 6 Feb 2003 09:58:41 -0500 Subject: Re: Update cascade on stmt, not on table definition From: Robert Treat To: Felipenasc@aol.com Cc: pgsql-admin@postgresql.org In-Reply-To: <23235213.3288E138.0B2082A6@aol.com> References: <23235213.3288E138.0B2082A6@aol.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Mailer: Ximian Evolution 1.0.8 Date: 06 Feb 2003 09:58:41 -0500 Message-Id: <1044543521.22810.135.camel@camel> Mime-Version: 1.0 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200302/83 X-Sequence-Number: 7281 On Thu, 2003-02-06 at 07:22, Felipenasc@aol.com wrote: > Hi, >=20 > I saw I can define a table that specifies a ON UPDATE CASCADE for a Forei= gn Key. >=20 > I have a lot of tables with FK=B4s, and a lot of others with others FK's = for the firts ones, and so on, and I haven=B4t defined the ON CASCADE claus= e on the FK=B4s tables.=20 > Now I need to update a primary key on the "mother" table.=20 >=20 > Is there a way to execute a stmt like 'update tbl set id_field=3DNEW_ID w= here id_field=3DOLD_ID on CASCADE', or something like that? Or do I need to= redefine my tables, or the constraints? >=20 There is no way to do this in an sql statement. You might be able to modify the constraints to update instead of delete, though the syntax to do this escapes me (perhaps someone else can post it?). Otherwise you'll have to drop and recreate the fk triggers or recreate the table. Robert Treat