Re: make tuplestore helper function
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Justin Pryzby <pryzby@telsasoft.com>
Cc: Melanie Plageman <melanieplageman@gmail.com>, pgsql-hackers@postgresql.org, Andres Freund <andres@anarazel.de>, Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: 2022-02-24T11:25:06Z
Lists: pgsql-hackers
Attachments
- v8-0001-Introduce-MakeFuncResultTuplestore.patch (text/x-diff) patch v8-0001
On Mon, Feb 21, 2022 at 04:41:17PM +0900, Michael Paquier wrote: > So, I got my hands on this area, and found myself applying 07daca5 as > a first piece of the puzzle. Anyway, after more review today, I have > bumped into more pieces that could be consolidated, and finished with > the following patch set: > - 0001 changes a couple of SRFs that I found worth simplifying. These > refer mostly to the second and fourth group mentioned upthread by > Melanie, with two exceptions: pg_tablespace_databases() where it is > not worth changing to keep it backward-compatible and pg_ls_dir() as > per its one-arg version. That's a nice first cut in itself. > - 0002 changes a couple of places to unify some existing SRF checks, > that I bumped into on the way. The value here is in using the same > error messages everywhere, reducing the translation effort and > generating the same errors for all cases based on the same conditions. > This eases the review of the next patch. These two have been now applied, with some comment improvements and the cleanup of pg_options_to_table() done in 0001, and a slight change in 0002 for pageinspect where a check was not necessary for a BRIN code path. > - 0003 is the actual refactoring meat, where I have been able to move > the check on expectedDesc into MakeFuncResultTuplestore(), shaving > more code than previously. If you discard the cases of patch 0001, it > should actually be possible to set setResult, setDesc and returnMode > within the new function, which would feel natural as that's the place > where we create the function's tuplestore and we want to materialize > its contents. The cases with the JSON code are also a bit hairy and > need more thoughts, but we could also cut this part of the code from > the initial refactoring effort. This is the remaining piece, as attached, that I have not been able to poke much at yet. -- Michael
Commits
-
Simplify SRFs using materialize mode in contrib/ modules
- 5b81703787bf 15.0 landed
-
Create routine able to set single-call SRFs for Materialize mode
- 9e98583898c3 15.0 landed
-
Simplify more checks related to set-returning functions
- e77216fcb021 15.0 landed
-
Clean up and simplify code in a couple of set-returning functions
- fcc28178c694 15.0 landed
-
Fix inconsistencies in SRF checks of pg_config() and string_to_table()
- 07daca53bfca 15.0 landed
-
Remove all traces of tuplestore_donestoring() in the C code
- d61a361d1aef 15.0 landed
-
Support domains over composite types in PL/Perl.
- 60651e4cddbb 11.0 cited