Search Postgresql Archives

can you do rollback in a trigger function?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux