Cascading Updates

Поиск
Список
Период
Сортировка
От Marcus Mascari
Тема Cascading Updates
Дата
Msg-id 19990129090458.19008.rocketmail@send105.yahoomail.com
обсуждение исходный текст
Ответы Re: [GENERAL] Cascading Updates  ("Alex P. Rudnev" <alex@Relcom.EU.net>)
Список 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 по дате отправления:

Предыдущее
От: Charles Hornberger
Дата:
Сообщение: nested loops in joins, ambiguous rewrite rules
Следующее
От: Marcus Mascari
Дата:
Сообщение: Cascading Updates