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.89) (envelope-from ) id 1iGNyO-0000ao-9O for pgsql-sql@arkaria.postgresql.org; Fri, 04 Oct 2019 13:50:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iGNyN-00069R-2s for pgsql-sql@arkaria.postgresql.org; Fri, 04 Oct 2019 13:50:19 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iGNyM-000693-NW; Fri, 04 Oct 2019 13:50:18 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iGNyK-0002TH-K7; Fri, 04 Oct 2019 13:50:17 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x94DoFq8005217; Fri, 4 Oct 2019 09:50:15 -0400 From: Tom Lane To: Pepe TD Vo cc: Pgsql-admin , pgsql-sql@postgresql.org Subject: Re: Automatically updating a new information column in PostgreSQL In-reply-to: <744670167.2325583.1570195612720@mail.yahoo.com> References: <744670167.2325583.1570195612720.ref@mail.yahoo.com> <744670167.2325583.1570195612720@mail.yahoo.com> Comments: In-reply-to Pepe TD Vo message dated "Fri, 04 Oct 2019 13:26:52 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <5215.1570197015.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Oct 2019 09:50:15 -0400 Message-ID: <5216.1570197015@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Pepe TD Vo writes: > good morning experts,I have a trigger before insert (even with or update= ) and seem it doesnt' work.=C2=A0 The function simply sets both columns na= med mig_filename to "unknown if its null, and mig_insert_dt to current tim= estample for each row passed to the trigger. > here is my script even I take all the rest out and just simple function = with new.mig_insert_dt :=3D localtimestamp; It looks like the RETURN NEW is inside the exception handler recovery block, which is not where you want it. When I run this example I get ERROR: control reached end of trigger procedure without RETURN CONTEXT: PL/pgSQL function "ECISDRDM"."TRIGGER_FCT_TR_STG_APPLICATION_CDI= M_INS"() So there is something seriously wrong with however you are testing this, if you failed to notice that. regards, tom lane