Re: Procedure support improvements - Mailing list pgsql-jdbc

From Peter Eisentraut
Subject Re: Procedure support improvements
Date
Msg-id 99b87249-d08c-8082-340e-84273150b59e@2ndquadrant.com
Whole thread Raw
In response to Re: Procedure support improvements  (Laurenz Albe <laurenz.albe@cybertec.at>)
List pgsql-jdbc
On 2019-08-26 20:08, Laurenz Albe wrote:
> test=> CREATE OR REPLACE PROCEDURE testproc() LANGUAGE plpgsql AS
>        $$BEGIN PERFORM 42; COMMIT; PERFORM 'x'; END;$$;
> CREATE PROCEDURE
> test=> CALL testproc();
> CALL
> test=> BEGIN;
> BEGIN
> test=> CALL testproc();
> ERROR:  invalid transaction termination
> CONTEXT:  PL/pgSQL function testproc() line 1 at COMMIT
> 
> Oops.
> I find that indeed surprising.
> 
> What is the rationale for this?

It's mostly an implementation restriction.  You would need to teach
SPI_commit() and SPI_rollback() to manipulate the top-level transaction
block state appropriately and carefully.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



pgsql-jdbc by date:

Previous
From: Dave Cramer
Date:
Subject: [pgjdbc/pgjdbc] f89e62: fix: In logical decoding the if the backendwas re...
Next
From: Dave Cramer
Date:
Subject: [pgjdbc/pgjdbc] bda74d: Log ignoring rollback when no transaction inprogr...