Re: Emitting JSON to file using COPY TO
Joe Conway <mail@joeconway.com>
From: Joe Conway <mail@joeconway.com>
To: Andrew Dunstan <andrew@dunslane.net>, Davin Shearer <davin@apache.org>,
PostgreSQL-development <pgsql-hackers@postgreSQL.org>
Date: 2023-12-03T20:09:36Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Add option force_array for COPY JSON FORMAT
- 4c0390ac53b7 19 (unreleased) landed
-
json format for COPY TO
- 7dadd38cda95 19 (unreleased) landed
-
introduce CopyFormat, refactor CopyFormatOptions
- a2145605ee3d 19 (unreleased) landed
-
Doc: add IDs to copy.sgml's <varlistentry> and <refsect1>
- e4018f891dec 19 (unreleased) cited
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