pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@postgresql.org
Subject: pgsql: Fix problems with ParamListInfo serialization mechanism.
Date: Mon, 02 Nov 2015 23:26:28 +0000
Message-ID: <E1ZtOUe-00082n-Sx@gemulon.postgresql.org> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

Fix problems with ParamListInfo serialization mechanism.

Commit d1b7c1ffe72e86932b5395f29e006c3f503bc53d introduced a mechanism
for serializing a ParamListInfo structure to be passed to a parallel
worker.  However, this mechanism failed to handle external expanded
values, as pointed out by Noah Misch.  Repair.

Moreover, plpgsql_param_fetch requires adjustment because the
serialization mechanism needs it to skip evaluating unused parameters
just as we would do when it is called from copyParamList, but params
== estate->paramLI in that case.  To fix, make the bms_is_member test
in that function unconditional.

Finally, have setup_param_list set a new ParamListInfo field,
paramMask, to the parameters actually used in the expression, so that
we don't try to fetch those that are not needed when serializing a
parameter list.  This isn't necessary for correctness, but it makes
the performance of the parallel executor code comparable to what we
do for cases involving cursors.

Design suggestions and extensive review by Noah Misch.  Patch by me.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/1efc7e538204646fec0f790b683012ed9bd8a99f

Modified Files
--------------
src/backend/commands/prepare.c   |    1 +
src/backend/executor/functions.c |    1 +
src/backend/executor/spi.c       |    1 +
src/backend/nodes/params.c       |   54 ++++++++++++++++++++++++++++++--------
src/backend/tcop/postgres.c      |    1 +
src/backend/utils/adt/datum.c    |   16 +++++++++++
src/include/nodes/params.h       |    4 ++-
src/pl/plpgsql/src/pl_exec.c     |   40 ++++++++++++++++------------
8 files changed, 89 insertions(+), 29 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


Message-ID: <E1ZtOUe-00082n-Sx@gemulon.postgresql.org>
Permalink:  ../E1ZtOUe-00082n-Sx@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1ZtOUe-00082n-Sx@gemulon.postgresql.org

 · 

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-committers@postgresql.org
  Cc: rhaas@postgresql.org
  Subject: Re: pgsql: Fix problems with ParamListInfo serialization mechanism.
  In-Reply-To: <E1ZtOUe-00082n-Sx@gemulon.postgresql.org>
  References: <E1ZtOUe-00082n-Sx@gemulon.postgresql.org>

* 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