triggers on views

From: Veganders <>
Date: Mon, 1 Dec 2008 13:11:35 -0800 (PST)
Message-ID: <>

Creating a database as a part of a school project, I ran into a problem that was solved by switching place of two rows that by the look of them would suggest their order would be irrelevant. The situation was roughly as follows:
A view was created as a union of two tables. Two "instead of" trigger was created to handle insert and deletes on the view
In the delete trigger, if the row to be deleted is in the first of the two tables, a row from the second table is deleted and then inserted into the first one. It was the two lines to move the row from the second table to the first that caused to problem. In one of the cases, the row was just inserted into the first table, but never removed from the second.
Trying to find a reason for this, the only thing I came up with, that could explain this odd behaviour, is that a trigger on a view will be executed not only on insertion or deletion on the view itself, but also on its underlying tables. Is this a correct assumption or is my error someplace else?

Best regards
Anders Received on Mon Dec 01 2008 - 15:11:35 CST

Original text of this message