Re: [subxact] Proof-of-concept: report nest level to client - Mailing list pgsql-patches

From Tom Lane
Subject Re: [subxact] Proof-of-concept: report nest level to client
Date
Msg-id 20487.1089987058@sss.pgh.pa.us
Whole thread Raw
In response to [subxact] Proof-of-concept: report nest level to client  (Alvaro Herrera <alvherre@dcc.uchile.cl>)
Responses Re: [subxact] Proof-of-concept: report nest level to client  (Oliver Jowett <oliver@opencloud.com>)
List pgsql-patches
Alvaro Herrera <alvherre@dcc.uchile.cl> writes:
> Patch attached (surprinsingly small), though it only applies with the
> savepoint patch applied(*).  If any driver writer wants to play, however,
> it's easy to see what's going on -- a ParameterStatus message will be
> received from the backend whenever the nesting level changes.

This is really quite the wrong behavior --- think about a function that
executes thousands of subtransactions before returning.  You really do
not want to emit a message for every nestlevel change.  (That's one of
the reasons I rejected doing this as a regular GUC variable.)

We could possibly send the info as a fake ParameterStatus that's only
sent just before the Z message, ie only when the backend is about to
wait for a command.

Right at the moment though I'm suspending judgment on whether we should
bite the bullet and do a protocol version change to support nested
xacts.  Off the top of my head we have a couple of reasons to want one:
- need for xact nest level or something like it in Z message
- need for option to make protocol-created portals act like WITH HOLD cursors
and IIRC we have identified some other minor misfeatures in the 7.4
protocol design as well, though I'd have to dig through the archives
to remember the details.  If we find any more I'll start to think that
we should just do it ...

            regards, tom lane

pgsql-patches by date:

Previous
From: Christopher Kings-Lynne
Date:
Subject: Re: add missing options to pg_dumpall
Next
From: Fabien COELHO
Date:
Subject: pgxs: build infrastructure for extensions v4