Re: Procedure support improvements

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Dave Cramer <pg(at)fastcrypt(dot)com>
Cc: Greg Nancarrow <gregn4422(at)gmail(dot)com>, David Rader <david(dot)rader(at)gmail(dot)com>, pgsql-jdbc(at)lists(dot)postgresql(dot)org, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Procedure support improvements
Date: 2019-08-26 18:08:05
Message-ID: 1fc1729ff4c1d342b32d0c0fb69df581f02356b1.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc

[CC to -hackers]
Dave Cramer wrote:
> On Mon, 26 Aug 2019 at 13:43,
Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
> wrote:
> > Dave Cramer wrote:
>
> > As I said, I'd entertain a connection parameter that switched the
>
> > CALL to call procedures but ideally you'd complain to the server
> >
> folks to make Procedures useful.
> >
> > Apart from the obvious
problem that procedures make life hard for
> > the JDBC driver, because
it does not know if it shall render a call
> > as SELECT or CALL:
> >
What is missing in PostgreSQL procedures to make them useful?
>
> being
able to use transactions inside a procedure inside a
> transaction.

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?

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2019-08-26 18:09:45 Re: Does TupleQueueReaderNext() really need to copy its result?
Previous Message Laurenz Albe 2019-08-26 18:06:39 Re: Procedure support improvements

Browse pgsql-jdbc by date

  From Date Subject
Next Message Tom Lane 2019-08-26 18:14:50 Re: Procedure support improvements
Previous Message Laurenz Albe 2019-08-26 18:06:39 Re: Procedure support improvements