Re: "A transaction cannot be ended inside a block with exception handlers."

2022-05-08 Thread Bryn Llewellyn
> david.g.johns...@gmail.com wrote: > > I do understand better now and indeed the current limitation has no > workaround that I can come up with. I was hoping maybe subblocks would work > but its pretty clear cut that to catch an error at the commit command you > must catch it within a block an

Re: "A transaction cannot be ended inside a block with exception handlers."

2022-05-06 Thread David G. Johnston
I do understand better now and indeed the current limitation has no workaround that I can come up with. I was hoping maybe subblocks would work but its pretty clear cut that to catch an error at the commit command you must catch it within a block and the commit error will be raised first. On Fri,

Re: "A transaction cannot be ended inside a block with exception handlers."

2022-05-06 Thread Bryn Llewellyn
> t...@sss.pgh.pa.us wrote: > >> b...@yugabyte.com wrote: >> >> I want to demonstrate how to meet this requirement: >> >> « >> Encapsulate each business function in a user-defined subprogram that hides >> all the implementation details like table names and the SQL statements that >> manipulate

Re: "A transaction cannot be ended inside a block with exception handlers."

2022-05-06 Thread Tom Lane
Bryn Llewellyn writes: > I want to demonstrate how to meet this requirement: > « > Encapsulate each business function in a user-defined subprogram that hides > all the implementation details like table names and the SQL statements that > manipulate their contents so the they cannot be seen usin

Re: "A transaction cannot be ended inside a block with exception handlers."

2022-05-06 Thread Bryn Llewellyn
> david.g.johns...@gmail.com wrote: > >> b...@yugabyte.com wrote: >> >> Is there simply no way that inserts into table "t" in my example can be >> encapsulated in PL/pgSQL so that the error from the failing trigger can be >> handled rather there than escaping, raw, to the client? > > Any poten

Re: "A transaction cannot be ended inside a block with exception handlers."

2022-05-06 Thread David G. Johnston
On Fri, May 6, 2022 at 4:40 PM Bryn Llewellyn wrote: > > Is there simply no way that inserts into table "t" in my example can be > encapsulated in PL/pgSQL so that the error from the failing trigger can be > handled rather there than escaping, raw, to the client? > > Any potential solution to thi

"A transaction cannot be ended inside a block with exception handlers."

2022-05-06 Thread Bryn Llewellyn
The PG doc section 43.8. Transaction Management: https://www.postgresql.org/docs/current/plpgsql-transactions.html says "A transaction cannot be ended inside a block with exception handlers." It's easy to demonstrate the restriction by adding this just before the final "