Cascading Updates - Mailing list pgsql-general

From Marcus Mascari
Subject Cascading Updates
Date
Msg-id 19990129090458.19008.rocketmail@send105.yahoomail.com
Whole thread Raw
Responses Re: [GENERAL] Cascading Updates
List pgsql-general
Hello.

I was wondering if it is possible, using the current
refint.c code, to perform CASCADING UPDATES.  It
appears that the trigger will fire on either an
update or a delete and call check_foreign_key() to
perform deletes ('cascade') or updates with NULL's
('setnull'), but not updates with the new key.

Am I missing something, or should you be able to
have the following:

CREATE TABLE employees (
employee varchar(10) not null
);

CREATE TABLE payroll (
employee varchar(10) not null,
salaray double not null
);

INSERT INTO employees VALUES ('mascarim');
INSERT INTO payroll VALUES ('mascarim','1250000');

and a trigger which, when the employee id
is updated:

UPDATE employees SET employee = 'mmascari' WHERE
employee = 'mascarim';

in the employees table, cascades to
update the employee id in the payroll table.

Is this currently not possible?  It appears that
the result is that an update to the employees
table, will yield a DELETE in the payroll table
instead of an update.

Any hints would be greatly appreciated.

Thanks,

Marcus Mascari (mascarim@yahoo.com)







_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com


pgsql-general by date:

Previous
From: Charles Hornberger
Date:
Subject: nested loops in joins, ambiguous rewrite rules
Next
From: Marcus Mascari
Date:
Subject: Cascading Updates