tags:

views:

61

answers:

1

Hi, I have a view consisting of 2 natural joins over the id field which is a foreign key for the second column referencing the first and a foreign key for the third referencing the second. When I try to insert in this view there is no error but only one row is inserted in the first table.

Do I have to use triggers to make it updatable?


Upon further investigation I discovered that MySQL 5.1 (the version I am using does not support triggers referencing views).

A: 

From http://dev.mysql.com/doc/refman/5.1/en/view-updatability.html:

For a multiple-table updatable view, INSERT can work if it inserts into a single table.

It sounds like inserting through a view to multiple tables is not supported. In other words, your INSERT should specify only columns from a single base table.

Bill Karwin