Endless loop in trigger function
问题 This is a trigger that is called by either an insert, update or a delete on a table. It is guaranteed the calling table has all the columns impacted and a deletes table also exists. CREATE OR REPLACE FUNCTION sample_trigger_func() RETURNS TRIGGER AS $$ DECLARE operation_code char; table_name varchar(50); delete_table_name varchar(50); old_id integer; BEGIN table_name = TG_TABLE_NAME; delete_table_name = TG_TABLE_NAME || '_deletes'; SELECT SUBSTR(TG_OP, 1, 1)::CHAR INTO operation_code; IF TG