On Thu, 2026-08-27 at 15:07 +0200, Durumdara wrote:
> When I start a Transaction from a Client and something fails, the PGSQL 
> doesn't allow me to do anything else:
> 
> > ERROR: current transaction is aborted, commands ignored until end of 
> > transaction block
>
> I wanted to check this situation so I created a demo in PGAdmin.
> 
> do $$
>  [...]
>  begin
>    [...]
>    select * from fy__tx; -- This table does not exists
> exception   
>  when others then
>    [...]
>  end; $$;
> 
> Why didn't I get this error in the Exception block?

Because a PL/pgSQL BEGIN ... EXCEPTION ... END block starts a subtransaction,
same as setting a savepoint.  When you enter the exception handler, PL/pgSQL
performs a rollback to that savepoint, which undoes the error as well.

Yours,
Laurenz Albe


Reply via email to