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 1j6dmi-0005lQ-RF for pgsql-general@arkaria.postgresql.org; Tue, 25 Feb 2020 17:14:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j6dlj-0001kb-Gd for pgsql-general@arkaria.postgresql.org; Tue, 25 Feb 2020 17:13:15 +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 1j6dlj-0001kU-6S for pgsql-general@lists.postgresql.org; Tue, 25 Feb 2020 17:13:15 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j6dlc-0006Zs-7N for pgsql-general@postgresql.org; Tue, 25 Feb 2020 17:13:14 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id B61A122129; Tue, 25 Feb 2020 12:13:05 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Tue, 25 Feb 2020 12:13:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=3 /hjSND1WS7fvd7m+8X937a/Nu4+c6lbSYn9pAKnKSQ=; b=THQyo2d8yhrXtpMl3 gUTXMyNSlc7nsHgMHovoKPd3rpf0K6SjzxZrXRWKMeYxpG97G6xcGVFXFZ8Tv5wi bdbuUip9W4IuIBiedKyzzwgeCOSwIq+3ActgvugZSyBCYWv4Xa7ceJoV+qPGasRp v/6/EeIBELmCNyfN3RrI4hhLMbx5E6GrvbsW1X7MUH3JMHONLhrLcrHqTL1Cgr29 PN5fRAOBXiQZp8/lC+CsDVlkH2q2PtvFkqrVW4Lziv9lUwDbOtrM/xKLBXPpvxyS r4L/XSriyeVAyriVDlkygoQTdBkEffFgy7fxojjANyKdebG9eRjFBtmNoq+xSSqk SoDvQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=3/hjSND1WS7fvd7m+8X937a/Nu4+c6lbSYn9pAKnK SQ=; b=0rVwnyf3YOFV1GL1fQkse52UvPQKfnmheLCh91sA1pVxAh3z87VUlpBvG h6XzCFeTnPNYHE0/p5DqXADTZBpEtSPN3P4IjFnTReRsQlVxW9gDilje8tE20yFK dtZyi+781LEjKyOp6TAGu+Guoed3pKFX8L7odhAgenkWV4zr39uQlzvaS72Xnoat 0qeHYVG0E2U1NjfwOaq5EehUcwXGVgbw6rRH9ZXEJz9g2GGuXzROyKtcljHhS6B1 /38nrry/D0e8YWUvqU8fCAfqiuU7tK5V5DUquX6+M7soacxLULEhyFBbcARS1rh5 4d6LtrBl0KGq0KAukY2MQr8pRuklw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrledvgdelkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefuvfhfhffkffgfgggjtgfgsehtkeertddtfeejnecuhfhrohhmpeetughrihgr nhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh eqnecuffhomhgrihhnpegurghrohhlugdrnhgvthenucfkphepjedurddvuddvrdduvdel rdduleefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh eprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Received: from [192.168.1.10] (unknown [71.212.129.193]) by mail.messagingengine.com (Postfix) with ESMTPA id C283D3280059; Tue, 25 Feb 2020 12:13:04 -0500 (EST) Subject: Re: Trigger To: Alban Hertroys Cc: Sonam Sharma , pgsql-general References: <0b2c9168-01ef-e54b-fb46-9bedfbe179bd@aklaver.com> <95C2937F-1036-4691-B682-9052C1D2B621@gmail.com> From: Adrian Klaver Message-ID: <36dbe912-6596-1eff-d270-42f356d042f0@aklaver.com> Date: Tue, 25 Feb 2020 09:13:04 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <95C2937F-1036-4691-B682-9052C1D2B621@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2/25/20 9:08 AM, Alban Hertroys wrote: > >> On 25 Feb 2020, at 17:53, Adrian Klaver wrote: >> >> On 2/25/20 12:01 AM, Sonam Sharma wrote: >>> I have a trigger, like many other triggers that fire after >>> update and checks a field of the OLD set. For some reason this trigger throw this error: >>> ERROR: record "old" has no field "ivo_sts_cd" CONTEXT: SQL statement >> >>> if exc_count = 0 then >>> UPDATE pps.T8071_CAI_IVO_HDR SET IVO_STS_CD = 1 where T616_VBU_NBR=old.T616_VBU_NBR and T617_FNC_TYP_CD=old.T617_FNC_TYP_CD and >>> T8071_CAI_IVO_ID=old.T8071_CAI_IVO_ID and T8071_ADD_DM= old. T8071_ADD_DM and old.ivo_sts_cd != 10 and old.ivo_sts_cd != 3; >> >> Realized I went through the above to quickly. I do not see a SET, nor am I clear what table you are trying to UPDATE. > > I’m pretty sure that if the OP were to format their query in a more readable and consistent way, they would spot their error pretty quickly. It’s a simple typo. Yeah, throwing it at: http://sqlformat.darold.net/ returned: UPDATE pps.T8071_CAI_IVO_HDR SET IVO_STS_CD = 1 WHERE T616_VBU_NBR = old.T616_VBU_NBR AND T617_FNC_TYP_CD = old.T617_FNC_TYP_CD AND T8071_CAI_IVO_ID = old.T8071_CAI_IVO_ID AND T8071_ADD_DM = old. T8071_ADD_DM AND old.ivo_sts_cd != 10 AND old.ivo_sts_cd != 3; Found the SET:) > > Alban Hertroys > -- > If you can't see the forest for the trees, > cut the trees and you'll find there is no forest. > -- Adrian Klaver adrian.klaver@aklaver.com