Skip to content

NEW variable is null in a trigger function.

当你创建一个函数并从触发器中调用它时,只有在触发器针对行操作时,NEW 变量才会被传入

🌐 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

当前界面默认是 STATEMENT,它不会向函数提供 NEW 或 OLD 变量。

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

image

在 SQL 中也是如此(参考:https://www.postgresql.org/docs/current/sql-createtrigger.html)

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

image