AW: deficiency on delete and update instead rules for v iews

Started by Zeugswetter Andreas SBabout 25 years ago1 messages
#1Zeugswetter Andreas SB
ZeugswetterA@wien.spardat.at

We lack a syntax that would enable us to write an on update/delete do instead rule
that would efficiently map an update/delete to a table that is referenced by a view.

Currently the only rule you can implement is one that uses a primary key.
This has the disadvantage of needing a self join to find the appropriate rows.

One of the concepts used in other DBs is to have views with row
OIDs/DBKeys: ie. views that have one primary table (but maybe have column
selects, calculations and/or function calls) can still have a real row
underlying each row. This then allows insert, update & delete to work more
easily. Doesn't really help now, but it might be useful in a
future release.

Imho the functionality inside the backend is probably there since old Postgres 4
could do such rules. That is why I said that syntax is missing.

Btw, the insert is not a problem, the on insert do instead rules are straight forward
to write, at least in the cases where other db's allow an insert on a view.
(e.g. on insert to test1 do instead insert into test (a,b) values (new.a, new.b);
where test1 has a few extra calculated columns)

Andreas