Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1erQKg-0000HD-2j for pgsql-sql@arkaria.postgresql.org; Thu, 01 Mar 2018 15:41:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1erQKY-0006Ga-2e for pgsql-sql@arkaria.postgresql.org; Thu, 01 Mar 2018 15:41:14 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eqjXE-0005q8-Ci for pgsql-sql@lists.postgresql.org; Tue, 27 Feb 2018 17:59:28 +0000 Received: from n3.nabble.com ([162.255.23.22]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1eqjXA-0001GD-6p for pgsql-sql@postgresql.org; Tue, 27 Feb 2018 17:59:26 +0000 Received: from n3.nabble.com (localhost [127.0.0.1]) by n3.nabble.com (Postfix) with ESMTP id C85CFB681FFE for ; Tue, 27 Feb 2018 10:59:22 -0700 (MST) Date: Tue, 27 Feb 2018 10:59:22 -0700 (MST) From: garret To: pgsql-sql@postgresql.org Message-ID: <1519754362818-0.post@n3.nabble.com> Subject: update tables with instead of trigger after update of view MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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 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 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