agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Pepe TD Vo <pepevo@yahoo.com>
Cc: Pgsql-admin <pgsql-admin@postgresql.org>
Cc: pgsql-sql@postgresql.org
Subject: Re: Automatically updating a new information column in PostgreSQL
Date: Fri, 04 Oct 2019 09:50:15 -0400
Message-ID: <5216.1570197015@sss.pgh.pa.us> (raw)
In-Reply-To: <744670167.2325583.1570195612720@mail.yahoo.com>
References: <744670167.2325583.1570195612720.ref@mail.yahoo.com>
	<744670167.2325583.1570195612720@mail.yahoo.com>

Pepe TD Vo <pepevo@yahoo.com> writes:
> good morning experts,I have a trigger before insert (even with or update) and seem it doesnt' work.  The function simply sets both columns named mig_filename to "unknown if its null, and mig_insert_dt to current timestample 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 := 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_CDIM_INS"()

So there is something seriously wrong with however you are testing
this, if you failed to notice that.

			regards, tom lane





view thread (4+ messages)  latest in thread

Message-ID: <5216.1570197015@sss.pgh.pa.us>
Permalink:  ../5216.1570197015@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/5216.1570197015@sss.pgh.pa.us

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pepevo@yahoo.com, pgsql-admin@postgresql.org
  Subject: Re: Automatically updating a new information column in PostgreSQL
  In-Reply-To: <5216.1570197015@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox