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: Preliminary refactoring of plpgsql expression construction.
Date: Tue, 11 Feb 2025 17:49:46 +0000
Message-ID: <E1thuOI-006aaj-1C@gemulon.postgresql.org> (raw)

Preliminary refactoring of plpgsql expression construction.

This short and boring patch simply moves the responsibility for
initializing PLpgSQL_expr.target_param into plpgsql parsing,
rather than doing it at first execution of the expr as before.
This doesn't save anything in terms of runtime, since the work was
trivial and done only once per expr anyway.  But it makes the info
available during parsing, which will be useful for the next step.

Likewise set PLpgSQL_expr.func during parsing.  According to the
comments, this was once impossible; but it's certainly possible
since we invented the plpgsql_curr_compile variable.  Again, this
saves little runtime, but it seems far cleaner conceptually.

While at it, I reordered stuff in struct PLpgSQL_expr to make it
clearer which fields are filled when, and merged some duplicative
code in pl_gram.y.

Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Pavel Borisov <pashkin.elfe@gmail.com>
Discussion: https://postgr.es/m/CACxu=vJaKFNsYxooSnW1wEgsAO5u_v1XYBacfVJ14wgJV_PYeg@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a654af21ae522cc8e867e052defd16f76ffaef2e

Modified Files
--------------
src/pl/plpgsql/src/pl_exec.c | 27 ------------------
src/pl/plpgsql/src/pl_gram.y | 65 ++++++++++++++++++++++++++++++--------------
src/pl/plpgsql/src/plpgsql.h | 31 ++++++++++++---------
3 files changed, 62 insertions(+), 61 deletions(-)



Message-ID: <E1thuOI-006aaj-1C@gemulon.postgresql.org>
Permalink:  ../E1thuOI-006aaj-1C@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1thuOI-006aaj-1C@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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Preliminary refactoring of plpgsql expression construction.
  In-Reply-To: <E1thuOI-006aaj-1C@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