Re: Automatically updating a new information column in PostgreSQL

Tom Lane <[email protected]> Fri, 04 Oct 2019 09:50:15 -0400
Newsgroups gmane.comp.db.postgresql.sql,gmane.comp.db.postgresql.admin
Message-ID <[email protected]>
Pepe TD Vo <[email protected]> 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