pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Rethink the "read/write parameter" mechanism in pl/pgsql.
Date: Mon, 04 Jan 2021 17:39:40 +0000
Message-ID: <E1kwTpU-0000yY-Qk@gemulon.postgresql.org> (raw)

Rethink the "read/write parameter" mechanism in pl/pgsql.

Performance issues with the preceding patch to re-implement array
element assignment within pl/pgsql led me to realize that the read/write
parameter mechanism is misdesigned.  Instead of requiring the assignment
source expression to be such that *all* its references to the target
variable could be passed as R/W, we really want to identify *one*
reference to the target variable to be passed as R/W, allowing any other
ones to be passed read/only as they would be by default.  As long as the
R/W reference is a direct argument to the top-level (hence last to be
executed) function in the expression, there is no harm in R/O references
being passed to other lower parts of the expression.  Nor is there any
use-case for more than one argument of the top-level function being R/W.

Hence, rewrite that logic to identify one single Param that references
the target variable, and make only that Param pass a read/write
reference, not any other Params referencing the target variable.

Discussion: https://postgr.es/m/4165684.1607707277@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1c1cbe279b3c6e8038c8f8079402f069bb4cea4c

Modified Files
--------------
src/backend/utils/adt/arrayfuncs.c |   7 +-
src/pl/plpgsql/src/pl_exec.c       | 177 ++++++++++++++++++-------------------
src/pl/plpgsql/src/pl_gram.y       |   6 +-
src/pl/plpgsql/src/plpgsql.h       |  12 ++-
4 files changed, 106 insertions(+), 96 deletions(-)



Message-ID: <E1kwTpU-0000yY-Qk@gemulon.postgresql.org>
Permalink:  ../E1kwTpU-0000yY-Qk@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1kwTpU-0000yY-Qk@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: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Rethink the "read/write parameter" mechanism in pl/pgsql.
  In-Reply-To: <E1kwTpU-0000yY-Qk@gemulon.postgresql.org>
  References: <E1kwTpU-0000yY-Qk@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