Re: Trigger question
От | Terry Lee Tucker |
---|---|
Тема | Re: Trigger question |
Дата | |
Msg-id | 200802220917.47675.terry@chosen-ones.org обсуждение исходный текст |
Ответ на | Trigger question (Alex du Plessis <alexdup01@telkomsa.net>) |
Ответы |
Foreign key violation
|
Список | pgsql-novice |
On Friday 22 February 2008 05:24, Alex du Plessis wrote: > I would like to prevent changes being made to a table (b), except when a > trigger fires as a result of changes (insert,update) being made to > another table (a). Should any changes be made to table b by any other > means than the trigger from table a, I would like to trap those changes > (again, could I use a trigger?) and make sure that the original values > in table b stays the same. > > Can anybody point me in the right direction please. > I suppose there are several ways to accomplish this. One is to create a small table explicitly for this purpose containing whatever you want but making sure that the table has the backend pid stored in it. You can have an AFTER trigger on table a insert data into this table and you can have a BEFORE trigger on table b check for the existence of a record with the same pid and if found, read data out of the table and make the update. Then, delete the table entry. Just one way... -- Terry Lee Tucker Turbo's IT Manager Turbo, division of Ozburn-Hessey Logistics 2251 Jesse Jewell Pkwy NE Gainesville, GA 30501 Tel: (336) 372-6812 Fax: (336) 372-6812 Cell: (336) 404-6987 terry@turbocorp.com www.turbocorp.com
В списке pgsql-novice по дате отправления: