Subject: Function can not use the 'NEW' variable as a direct parameter inside trigger function?

From: intmail01 <[email-masked]>
Date: Fri, 5 Apr 2024 20:17:43 +0300

Hi,

Why a function can not pass the 'NEW' variable as a direct parameter ?
When I use myFunction(NEW) inside a trigger function an error appears :

pq_driver: [PGRES_FATAL_ERROR]ERROR:  function myFunction(MyTableStruct)
does not exist
LINE 1: ...myFunction(NEW)...
              ^
HINT:  No function matches the given name and argument types. You might
need to add explicit type casts.

I have to use trick by using a temporary variable to run the code :

theVariable MyTableStruct;
theVariable = NEW ;
myFunction(theVariable) ;

Thanks

---

From: Tom Lane <[email-masked]>
Date: Fri, 05 Apr 2024 15:21:10 -0400

> need to add explicit type casts.

That doesn't look like NEW's fault.  You lack a suitable function
to be called.

			regards, tom lane