pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert Treat <xzilla@users.sourceforge.net>
To: Felipenasc@aol.com
Cc: pgsql-admin@postgresql.org
Subject: Re: Update cascade on stmt, not on table definition
Date: 06 Feb 2003 09:58:41 -0500
Message-ID: <1044543521.22810.135.camel@camel> (raw)
In-Reply-To: <23235213.3288E138.0B2082A6@aol.com>
References: <23235213.3288E138.0B2082A6@aol.com>

On Thu, 2003-02-06 at 07:22, Felipenasc@aol.com wrote:
> Hi,
> 
> I saw I can define a table that specifies a ON UPDATE CASCADE for a Foreign Key.
> 
> I have a lot of tables with FK´s, and a lot of others with others FK's for the firts ones, and so on, and I haven´t defined the ON CASCADE clause on the FK´s tables. 
> Now I need to update a primary key on the "mother" table. 
> 
> Is there a way to execute a stmt like 'update tbl set id_field=NEW_ID where id_field=OLD_ID on CASCADE', or something like that? Or do I need to redefine my tables, or the constraints?
> 

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





view thread (2+ messages)

Message-ID: <1044543521.22810.135.camel@camel>
Permalink:  ../1044543521.22810.135.camel@camel/
Also on:    postgresql.org/message-id/1044543521.22810.135.camel@camel

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: xzilla@users.sourceforge.net, Felipenasc@aol.com
  Subject: Re: Update cascade on stmt, not on table definition
  In-Reply-To: <1044543521.22810.135.camel@camel>
  References: <23235213.3288E138.0B2082A6@aol.com> <1044543521.22810.135.camel@camel>

* 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