pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Laurenz Albe <laurenz.albe@cybertec.at>
To: Dave Cramer <pg@fastcrypt.com>
Cc: Greg Nancarrow <gregn4422@gmail.com>
Cc: David Rader <david.rader@gmail.com>
Cc: pgsql-jdbc@lists.postgresql.org
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Procedure support improvements
Date: Wed, 28 Aug 2019 18:44:54 +0200
Message-ID: <99b87249-d08c-8082-340e-84273150b59e@2ndquadrant.com> (raw)
In-Reply-To: <1fc1729ff4c1d342b32d0c0fb69df581f02356b1.camel@cybertec.at>
References: <CAOcA-58PFqVxri+C9rZjfG1omtXcdeEWRuY2LaS6igJ7o+4UXw@mail.gmail.com>
	<CAJcOf-dPruhYkyeHmUNU8BCpJxOzSZL+yYpQ=sXac1pGETb7AA@mail.gmail.com>
	<CADK3HHKhbUQey2-XKARdK2Uyx29QLcj1Es+4qGpWqVz+FfuCgw@mail.gmail.com>
	<CAJcOf-eyv_et=Z2WhcFdZLGD-BpH4DyOKH=VZn__L0EKmHbMJQ@mail.gmail.com>
	<CADK3HH+EVnWCS3ynqey8jh=b+WOriH=Jv44yKSun3JrBfKtiZQ@mail.gmail.com>
	<CAJcOf-fEHe9UCvsFXfiizeNUOjHu=WbzkzHM_Yi0Xs4=U8Gnng@mail.gmail.com>
	<CADK3HHKoJ_1FYpqH-3v4rKJD+qp4UEjOE0_e8yXeekNDiD7a1w@mail.gmail.com>
	<2f6ef24a2fae2b42efbf9db3194392dee476f2e5.camel@cybertec.at>
	<CADK3HH+Bfat=byMsatf9VZ2VcG7Geu7=QJBSbJ8cTeE=sqtkAw@mail.gmail.com>
	<1fc1729ff4c1d342b32d0c0fb69df581f02356b1.camel@cybertec.at>

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





view thread (17+ messages)

Message-ID: <99b87249-d08c-8082-340e-84273150b59e@2ndquadrant.com>
Permalink:  ../99b87249-d08c-8082-340e-84273150b59e@2ndquadrant.com/
Also on:    postgresql.org/message-id/99b87249-d08c-8082-340e-84273150b59e@2ndquadrant.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: peter.eisentraut@2ndquadrant.com, laurenz.albe@cybertec.at, pg@fastcrypt.com, gregn4422@gmail.com, david.rader@gmail.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: Procedure support improvements
  In-Reply-To: <99b87249-d08c-8082-340e-84273150b59e@2ndquadrant.com>
  References: <CAOcA-58PFqVxri+C9rZjfG1omtXcdeEWRuY2LaS6igJ7o+4UXw@mail.gmail.com> <CAJcOf-dPruhYkyeHmUNU8BCpJxOzSZL+yYpQ=sXac1pGETb7AA@mail.gmail.com> <CADK3HHKhbUQey2-XKARdK2Uyx29QLcj1Es+4qGpWqVz+FfuCgw@mail.gmail.com> <CAJcOf-eyv_et=Z2WhcFdZLGD-BpH4DyOKH=VZn__L0EKmHbMJQ@mail.gmail.com> <CADK3HH+EVnWCS3ynqey8jh=b+WOriH=Jv44yKSun3JrBfKtiZQ@mail.gmail.com> <CAJcOf-fEHe9UCvsFXfiizeNUOjHu=WbzkzHM_Yi0Xs4=U8Gnng@mail.gmail.com> <CADK3HHKoJ_1FYpqH-3v4rKJD+qp4UEjOE0_e8yXeekNDiD7a1w@mail.gmail.com> <2f6ef24a2fae2b42efbf9db3194392dee476f2e5.camel@cybertec.at> <CADK3HH+Bfat=byMsatf9VZ2VcG7Geu7=QJBSbJ8cTeE=sqtkAw@mail.gmail.com> <1fc1729ff4c1d342b32d0c0fb69df581f02356b1.camel@cybertec.at> <99b87249-d08c-8082-340e-84273150b59e@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox