Re: Emitting JSON to file using COPY TO
David G. Johnston <david.g.johnston@gmail.com>
From: "David G. Johnston" <david.g.johnston@gmail.com>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: Dominique Devienne <ddevienne@gmail.com>,
Adrian Klaver <adrian.klaver@aklaver.com>, Davin Shearer <scholarsmate@gmail.com>, "pgsql-general@lists.postgresql.org" <pgsql-general@lists.postgresql.org>
Date: 2023-11-27T14:43:08Z
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 Monday, November 27, 2023, Pavel Stehule <pavel.stehule@gmail.com> wrote: > Hi > > po 27. 11. 2023 v 14:27 odesílatel David G. Johnston < > david.g.johnston@gmail.com> napsal: > >> On Monday, November 27, 2023, Dominique Devienne <ddevienne@gmail.com> >> wrote: >> >>> There's even a JSON mode. >>> By miracle, would the JSON output mode recognize JSON[B] values, and >>> avoid the escaping? >>> >> >> I agree there should be a copy option for “not formatted” so if you dump >> a single column result in that format you get the raw unescaped contents of >> the column. As soon as you ask for a format your json is now embedded so it >> is a value within another format and any structural aspects of the wrapper >> present in the json text representation need to be escaped. >> > > Is it better to use the LO API for this purpose? It is native for not > formatted data. > Using LO is, IMO, never the answer. But if you are using a driver API anyway just handle the normal select query result. David J.