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: Refactor pl_funcs.c to provide a usage-independent tree walker.
Date: Tue, 11 Feb 2025 17:49:46 +0000
Message-ID: <E1thuOH-006aai-Ur@gemulon.postgresql.org> (raw)

Refactor pl_funcs.c to provide a usage-independent tree walker.

We haven't done this up to now because there was only one use-case,
namely plpgsql_free_function_memory's search for expressions to clean
up.  However an upcoming patch has another need for walking plpgsql
functions' statement trees, so let's create sharable tree-walker
infrastructure in the same style as expression_tree_walker().

This patch actually makes the code shorter, although that's
mainly down to having used a more compact coding style.  (I didn't
write a separate subroutine for each statement type, and I made
use of some newer notations like foreach_ptr.)

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/6a7283dd2f1c573f2cf3daaf14e8a246577da57d

Modified Files
--------------
src/pl/plpgsql/src/pl_funcs.c | 582 ++++++++++++++++++------------------------
1 file changed, 244 insertions(+), 338 deletions(-)



Message-ID: <E1thuOH-006aai-Ur@gemulon.postgresql.org>
Permalink:  ../E1thuOH-006aai-Ur@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1thuOH-006aai-Ur@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: Refactor pl_funcs.c to provide a usage-independent tree walker.
  In-Reply-To: <E1thuOH-006aai-Ur@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