Re: make tuplestore helper function - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: make tuplestore helper function
Date
Msg-id Yhx+lbKYA0Oa38pi@paquier.xyz
Whole thread Raw
In response to Re: make tuplestore helper function  (Michael Paquier <michael@paquier.xyz>)
Responses Re: make tuplestore helper function  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
On Thu, Feb 24, 2022 at 08:25:06PM +0900, Michael Paquier wrote:
> This is the remaining piece, as attached, that I have not been able to
> poke much at yet.

So, I have finally poked at this last part of the patch set, and I
found that we can be more aggressive with the refactoring, by moving
into MakeFuncResultTuplestore() the parts where we save the tuplestore
and the tupledesc in the per-query memory context.  There are two
pieces that matter once things are reshaped:
- The tuple descriptor may need some extra validation via
BlessTupleDesc() when it comes from a transient record datatype,
something that happens for most of the subroutines related to the JSON
functions.
- expectedDesc is sometimes required by the caller, though most of the
time just needs to be built with the more expensive
get_call_result_type().

In order to keep things pluggable at will, MakeFuncResultTuplestore()
has been changed to access a set of bits32 flags, able to control the
two options above.  With this facility in place, I have been able to
cut much more code than the initial patch, roughly twice as of:
 24 files changed, 157 insertions(+), 893 deletions(-)

This seems in rather good shape to me, the changes are
straight-forward and the code cut is really good, so I'd like to move
on with that.  0001 is the initial patch, and 0002 is the extra
refactoring I have been working on.  The plan would be to merge both,
but I am sending a split to ease any checks on what I have changed.

Comments or objections?
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: "tanghy.fnst@fujitsu.com"
Date:
Subject: RE: Design of pg_stat_subscription_workers vs pgstats
Next
From: Michael Paquier
Date:
Subject: Re: Allow file inclusion in pg_hba and pg_ident files