On 12/3/23 14:52, Andrew Dunstan wrote:

On 2023-12-03 Su 14:24, Joe Conway wrote:
On 12/3/23 11:03, Joe Conway wrote:
On 12/3/23 10:10, Andrew Dunstan wrote:
I  realize this is just a POC, but I'd prefer to see composite_to_json()
not exposed. You could use the already public datum_to_json() instead,
passing JSONTYPE_COMPOSITE and F_RECORD_OUT as the second and third
arguments.

Ok, thanks, will do

Just FYI, this change does loose some performance in my not massively scientific A/B/A test:

8<---------------------------
<snip>
8<---------------------------

That is somewhere in the 3% range.

I assume it's because datum_to_json() constructs a text value from which
you then need to extract the cstring, whereas composite_to_json(), just
gives you back the stringinfo. I guess that's a good enough reason to go
with exposing composite_to_json().

Yeah, that was why I went that route in the first place. If you are good with it I will go back to that. The code is a bit simpler too.

--
Joe Conway
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com



Reply via email to