We have the update query inside the transaction block with the exception block. Shown below:
do $$
begin
update dbo.myTable set name = 'Table Name' where id = 47;
commit;
exception when others then
raise notice '% %', SQLERRM, SQLSTATE;
rollback;
end; $$
language 'plpgsql';
But this will return an exception raised message which is cannot commit while a subtransaction is active 2D000. Any leads on this issue and how can we support this transaction behaviour?