pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Clean up and simplify code in a couple of set-returning function
Date: Thu, 24 Feb 2022 07:12:02 +0000
Message-ID: <E1nN8ID-0007Il-MH@gemulon.postgresql.org> (raw)

Clean up and simplify code in a couple of set-returning functions

The following set-returning functions have their logic simplified, to be
more consistent with other in-core areas:
- pg_prepared_statement()'s tuple descriptor is now created with
get_call_result_type() instead of being created from scratch, saving
from some duplication with pg_proc.dat.
- show_all_file_settings(), similarly, now uses get_call_result_type()
to build its tuple descriptor instead of creating it from scratch.
- pg_options_to_table() made use of a static routine called only once.
This commit removes this internal routine to make the function easier to
follow.
- pg_config() was using a unique logic style, doing checks on the tuple
descriptor passed down in expectedDesc, but it has no need to do so.
This switches the function to use a tuplestore with a tuple descriptor
retrieved from get_call_result_type(), instead.

This simplifies an upcoming patch aimed at refactoring the way
tuplestores are created and checked in set-returning functions, this
change making sense as its own independent cleanup by shaving some
code.

Author: Melanie Plageman, Michael Paquier
Reviewed-by: Justin Pryzby
Discussion: https://postgr.es/m/CAAKRu_azyd1Z3W_r7Ou4sorTjRCs+PxeHw1CWJeXKofkE6TuZg@mail.gmail.com

Branch
------
master

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

Modified Files
--------------
src/backend/commands/prepare.c     | 31 ++++--------------
src/backend/foreign/foreign.c      | 37 +++++++++-------------
src/backend/utils/misc/guc.c       | 20 ++----------
src/backend/utils/misc/pg_config.c | 65 ++++++++++----------------------------
src/backend/utils/mmgr/portalmem.c | 23 ++++----------
5 files changed, 48 insertions(+), 128 deletions(-)



Message-ID: <E1nN8ID-0007Il-MH@gemulon.postgresql.org>
Permalink:  ../E1nN8ID-0007Il-MH@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1nN8ID-0007Il-MH@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: michael@paquier.xyz
  Subject: Re: pgsql: Clean up and simplify code in a couple of set-returning function
  In-Reply-To: <E1nN8ID-0007Il-MH@gemulon.postgresql.org>
  References: <E1nN8ID-0007Il-MH@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