Re: [GENERAL] Cascading Updates
От | Alex P. Rudnev |
---|---|
Тема | Re: [GENERAL] Cascading Updates |
Дата | |
Msg-id | Pine.SUN.3.91.990129135612.18173j-100000@virgin.relcom.eu.net обсуждение исходный текст |
Ответ на | Cascading Updates (Marcus Mascari <mascarim@yahoo.com>) |
Список | pgsql-general |
I have tried to do it using _rules_, but completed by my own code in the library realising my data model. The _rule_ is appropriate place to do it, but they are not realised properly and can't be used in serious applications yet. On Fri, 29 Jan 1999, Marcus Mascari wrote: > Date: Fri, 29 Jan 1999 01:04:58 -0800 (PST) > From: Marcus Mascari <mascarim@yahoo.com> > To: pgsql-general@postgreSQL.org > Subject: [GENERAL] Cascading Updates > > 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 > > > Aleksei Roudnev, Network Operations Center, Relcom, Moscow (+7 095) 194-19-95 (Network Operations Center Hot Line),(+7 095) 230-41-41, N 13729 (pager) (+7 095) 196-72-12 (Support), (+7 095) 194-33-28 (Fax)
В списке pgsql-general по дате отправления: