Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i2JW7-0007i1-Gy for pgsql-hackers@arkaria.postgresql.org; Mon, 26 Aug 2019 18:14:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1i2JW6-0006Si-DL for pgsql-hackers@arkaria.postgresql.org; Mon, 26 Aug 2019 18:14:58 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i2JW6-0006SX-4Z; Mon, 26 Aug 2019 18:14:58 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1i2JW3-0006Oj-Ur; Mon, 26 Aug 2019 18:14:57 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x7QIEoDW009462; Mon, 26 Aug 2019 14:14:50 -0400 From: Tom Lane To: Laurenz Albe cc: Dave Cramer , Greg Nancarrow , David Rader , pgsql-jdbc@lists.postgresql.org, pgsql-hackers@lists.postgresql.org Subject: Re: Procedure support improvements In-reply-to: <1fc1729ff4c1d342b32d0c0fb69df581f02356b1.camel@cybertec.at> References: <2f6ef24a2fae2b42efbf9db3194392dee476f2e5.camel@cybertec.at> <1fc1729ff4c1d342b32d0c0fb69df581f02356b1.camel@cybertec.at> Comments: In-reply-to Laurenz Albe message dated "Mon, 26 Aug 2019 20:08:05 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <9460.1566843290.1@sss.pgh.pa.us> Date: Mon, 26 Aug 2019 14:14:50 -0400 Message-ID: <9461.1566843290@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Laurenz Albe writes: > Dave Cramer wrote: > test=> BEGIN; > BEGIN > test=> CALL testproc(); > ERROR: invalid transaction termination > CONTEXT: PL/pgSQL function testproc() line 1 at COMMIT > What is the rationale for this? A procedure shouldn't be able to force commit of the surrounding transaction. As Dave noted, what would be nicer is for procedures to be able to start and commit autonomous transactions, without affecting the state of the outer transaction. We haven't got that though, and it looks like a lot of work to get there. regards, tom lane