update tables with instead of trigger after update of view

From: garret <garretlewis(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: update tables with instead of trigger after update of view
Date: 2018-02-27 17:59:22
Message-ID: 1519754362818-0.post@n3.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi I have views created from several tables. I would like to create a
function with Plpgsql that updates the underlying tables rather than the
view with a do instead trigger. I have been able to get a working example of
what I want in the link below. The thing is, I would rather try to create a
more dynamic function instead of creating an if statement for each column.

Here's my sql fiddle <http://sqlfiddle.com/#!17/d63dc/2> where I show the
end result of what I would like to happen but with a more manual approach of
hard coding in the column and table to update.

I have also posted on DBA stackexchange
<https://dba.stackexchange.com/questions/198412/automate-update-columns-in-a-view-with-trigger-function-in-plpgsql>
but got no responses I was hoping someone on this forum could help, or let
me know if this is not realistically possible.

Thank you

--
Sent from: http://www.postgresql-archive.org/PostgreSQL-sql-f2142323.html

Browse pgsql-sql by date

  From Date Subject
Next Message Gary Stainburn 2018-03-01 08:42:19 Monthly budgets
Previous Message Lahari Sengupta 2018-02-22 16:05:03 Re: Discrepancy in query output