PostgreSQL 中是否有类似于 Oracles 'UPDATING, DELETING, INSERTING' 函数的函数?

Are there functions in PostgreSQL like Oracles 'UPDATING, DELETING, INSERTING' functions?

希望有人能提供帮助。 目前我正在使用 PostgreSQL 数据库,但我真的不知道如何解决我的问题。在 PLSQL 中,有一个名为 'INSERTING, UPDATING, DELETING' 的触发器内部的操作。但是当谈到 PostgreSQL 时,我感到很困惑...

在 Oracle 中我可以这样做:

v_action CHAR(1) := CASE WHEN INSERTING THEN "I" WHEN UPDATING THEN "U" WHEN DELETING THEN "D" END;

https://www.postgresql.org/docs/current/static/plpgsql-trigger.html

TG_OP Data type text; a string of INSERT, UPDATE, DELETE, or TRUNCATE telling for which operation the trigger was fired.

这应该可以解决问题:

v_action := CASE 
  WHEN TG_OP = 'INSERT' THEN 'I' 
  WHEN TG_OP = 'UPDATE' THEN 'U' 
  WHEN TG_OP = 'DELETE' THEN 'D' 
END;