> And all this time I thought that you couldn't write to a view.
You can't.
But you can make it seem so you can.
You can create an ON UPDATE/INSERT trigger on a view which intercepts the
UPDATE/INSERT to the view (which would otherwise fail) and do whatever you
want with it, including doing the operation on the real table.
Search for "postgresql materialized views" for some examples.