I have come across a postgres trigger that is defined like so...
CREATE FUNCTION public.my_trigger_func() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
PERFORM my_other_func(NEW.my_val);
RETURN NULL;
END;
$$;
From what this other post's answer says (I cannot find it explicitly stated in the postgres documentation):
All PostgreSQL triggers execute in the same transaction as the transaction that has triggered them.
However, does the function my_other_func
, called with PERFORM
, get run in the same transaction as well? Or what is its behavior in this context?
Postgres version:
select version();
version
------------------------------------------------------------------------------------------------------------------
PostgreSQL 12.7 (Debian 12.7-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit