From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@postgresql.org
Subject: pgsql: In plpgsql, unify duplicate variables for record and row cases.
Date: Fri, 08 Dec 2017 16:21:14 +0000
Message-ID: <E1eNLOk-0007RG-Uj@gemulon.postgresql.org> (raw)
In plpgsql, unify duplicate variables for record and row cases.
plpgsql's function exec_move_row() handles assignment of a composite
source value to either a PLpgSQL_rec or PLpgSQL_row target variable.
Oddly, rather than taking a single target argument which it could do
run-time type detection on, it was coded to take two separate arguments
(only one of which is allowed to be non-NULL). This choice had then
back-propagated into storing two separate target variables in various
plpgsql statement nodes, with lots of duplicative coding and awkward
interface logic to support that. Simplify matters by folding those
pairs down to single variables, distinguishing the two cases only
where we must ... which turns out to be only in exec_move_row itself.
This is purely refactoring and should not change any behavior.
In passing, remove unused field PLpgSQL_stmt_open.returntype.
Discussion: https://postgr.es/m/11787.1512713374@sss.pgh.pa.us
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/dd759b96ea8fa41b48541dd321c07d9a947f8de9
Modified Files
--------------
src/pl/plpgsql/src/pl_comp.c | 2 +-
src/pl/plpgsql/src/pl_exec.c | 111 ++++++++++++++-----------------------
src/pl/plpgsql/src/pl_funcs.c | 39 ++++---------
src/pl/plpgsql/src/pl_gram.y | 126 +++++++++++++++---------------------------
src/pl/plpgsql/src/plpgsql.h | 22 +++-----
5 files changed, 106 insertions(+), 194 deletions(-)
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: In plpgsql, unify duplicate variables for record and row cases.
In-Reply-To: <E1eNLOk-0007RG-Uj@gemulon.postgresql.org>
References: <E1eNLOk-0007RG-Uj@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