Re: Automatically updating a new information column in PostgreSQL

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Pepe TD Vo <pepevo(at)yahoo(dot)com>
Cc: Pgsql-admin <pgsql-admin(at)postgresql(dot)org>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Automatically updating a new information column in PostgreSQL
Date: 2019-10-04 13:50:15
Message-ID: 5216.1570197015@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-sql

Pepe TD Vo <pepevo(at)yahoo(dot)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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Pepe TD Vo 2019-10-04 15:53:32 Re: Automatically updating a new information column in PostgreSQL
Previous Message Voillequin, Jean-Marc 2019-10-04 13:49:24 RE: Automatically updating a new information column in PostgreSQL

Browse pgsql-sql by date

  From Date Subject
Next Message Pepe TD Vo 2019-10-04 15:53:32 Re: Automatically updating a new information column in PostgreSQL
Previous Message Voillequin, Jean-Marc 2019-10-04 13:49:24 RE: Automatically updating a new information column in PostgreSQL