I have a view table which is a union of two separate tables (say Table _A and Table _B).
I need to be able to update a row in the view table, and it seems the way to do this was through a 'view rule'. All entries in the view table have separate id's, so an id that exists in table _A won't exist in table _B.
I created the following rule:
CREATE OR REPLACE RULE view_update AS
ON UPDATE TO viewtable DO INSTEAD ( UPDATE _A SET foo = false
WHERE old.id = _A.id;
UPDATE _B SET foo = false
WHERE old.id = _B.id;
You can't. Unless you do it in a stored procedure and return the number of affected rows.
A good explanation in the official doc