pgsql: Fix problems with ParamListInfo serialization mechanism. - Mailing list pgsql-committers

From Robert Haas
Subject pgsql: Fix problems with ParamListInfo serialization mechanism.
Date
Msg-id E1ZtOUe-00082n-Sx@gemulon.postgresql.org
Whole thread Raw
List pgsql-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(-)


pgsql-committers by date:

Previous
From: Kevin Grittner
Date:
Subject: pgsql: Add RMV to list of commands taking AE lock.
Next
From: Tom Lane
Date:
Subject: pgsql: Remove some more dead Alpha-specific code.