can you do rollback in a trigger function? - Mailing list pgsql-general

From Quang Thoi
Subject can you do rollback in a trigger function?
Date
Msg-id 571602E8CBF2CE4B8D025AD126A299632B70A422FB@TUS1XCHEVSPIN32.SYMC.SYMANTEC.COM
Whole thread Raw
Responses Re: can you do rollback in a trigger function?
Re: can you do rollback in a trigger function?
List pgsql-general

I want to roll back deletion if there is a reference (FK) in another table.

Can I explicitly call a rollback inside a function?

 

 

CREATE OR REPLACE FUNCTION pre_del_prod_proc()

returns trigger as $$

begin

        if exists (select 1 from host_config where config_id = OLD.id) then

            rollback;

        end if;       

end;

$$ language plpqsql;

 

CREATE TRIGGER pre_del_prod_proc

before delete on prod_config

for each row execute procedure pre_del_prod_proc();

 

Thanks,

Quang.

pgsql-general by date:

Previous
From: David Johnston
Date:
Subject: Re: Fwd: String reverse funtion?
Next
From: Vick Khera
Date:
Subject: Re: can you do rollback in a trigger function?