Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1j9us8-0003Fl-5N for pgsql-general@arkaria.postgresql.org; Thu, 05 Mar 2020 18:05:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j9us7-0005qI-1X for pgsql-general@arkaria.postgresql.org; Thu, 05 Mar 2020 18:05:23 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j9us6-0005qA-OC for pgsql-general@lists.postgresql.org; Thu, 05 Mar 2020 18:05:22 +0000 Received: from mailbackend.panix.com ([166.84.1.89]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j9us3-0002ch-HH for pgsql-general@lists.postgresql.org; Thu, 05 Mar 2020 18:05:22 +0000 Received: from panix5.panix.com (panix5.panix.com [166.84.1.5]) by mailbackend.panix.com (Postfix) with ESMTP id 48YJZ52kGdz1K3j; Thu, 5 Mar 2020 13:05:17 -0500 (EST) Received: by panix5.panix.com (Postfix, from userid 17622) id 48YJZ51BtZzfYm; Thu, 5 Mar 2020 13:05:17 -0500 (EST) Date: Thu, 5 Mar 2020 13:05:16 -0500 From: stan To: "David G. Johnston" Cc: pgsql-general@lists.postgresql.org Subject: Re: A question about the number of times a trigger will fire Message-ID: <20200305180516.GA28124@panix.com> References: <20200305145811.GA17538@panix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Editor: gVim List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, Mar 05, 2020 at 08:58:32AM -0700, David G. Johnston wrote: > On Thu, Mar 5, 2020 at 7:58 AM stan wrote: > > > UPDATE BOM_ITEM SET cost_per_unit = 23.45 , qty = 12345.00 > > > > So, it appears that I need to create a WHERE clause for the resultant > > statement. But I do not see how the function has enough data to use to > > create this where clause. > > > > What am I missing, here? > > > > > OLD and/or NEW? > > https://www.postgresql.org/docs/12/plpgsql-trigger.html#PLPGSQL-DML-TRIGGER Yes, I was thinking that might be what I had to do. My thinking right now is to create a WHERE clause for the new statement, using (perhaps a subset) of the columns returned by this. -- "They that would give up essential liberty for temporary safety deserve neither liberty nor safety." -- Benjamin Franklin