pgsql: Fix problems with ParamListInfo serialization mechanism.

From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix problems with ParamListInfo serialization mechanism.
Date: 2015-11-02 23:26:28
Message-ID: E1ZtOUe-00082n-Sx@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2015-11-03 00:37:56 pgsql: Remove some more dead Alpha-specific code.
Previous Message Kevin Grittner 2015-11-02 12:30:07 pgsql: Add RMV to list of commands taking AE lock.