NEW variable is null in a trigger function.

Last edited: 1/16/2025

When you create a function and call it from a trigger the NEW variable is only passed in if the trigger is on ROW operations

The UI currently defaults to STATEMENT which will not provide NEW or OLD variables to the function.

image

Also in SQL (reference: https://www.postgresql.org/docs/current/sql-createtrigger.html)

image