pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedUpdate cascade on stmt, not on table definition
2+ messages / 2 participants
[nested] [flat]
* Update cascade on stmt, not on table definition
@ 2003-02-06 12:22 Felipenasc@aol.com
2003-02-06 14:58 ` Re: Update cascade on stmt, not on table definition Robert Treat <xzilla@users.sourceforge.net>
0 siblings, 1 reply; 2+ messages in thread
From: Felipenasc@aol.com @ 2003-02-06 12:22 UTC (permalink / raw)
To: pgsql-admin
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?
Tks
Felipe Nascimento
Felipe Nascimento
webmaster@peladeiro.com.br
www.peladeiro.com.br
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Update cascade on stmt, not on table definition
2003-02-06 12:22 Update cascade on stmt, not on table definition Felipenasc@aol.com
@ 2003-02-06 14:58 ` Robert Treat <xzilla@users.sourceforge.net>
0 siblings, 0 replies; 2+ messages in thread
From: Robert Treat @ 2003-02-06 14:58 UTC (permalink / raw)
To: Felipenasc@aol.com; +Cc: pgsql-admin
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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2003-02-06 14:58 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-02-06 12:22 Update cascade on stmt, not on table definition Felipenasc@aol.com
2003-02-06 14:58 ` Robert Treat <xzilla@users.sourceforge.net>
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