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: Davin Shearer <scholarsmate@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Date: 2023-11-25T20:02:46Z
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 →
  1. Add option force_array for COPY JSON FORMAT

  2. json format for COPY TO

  3. introduce CopyFormat, refactor CopyFormatOptions

  4. Doc: add IDs to copy.sgml's <varlistentry> and <refsect1>

On Sat, Nov 25, 2023 at 12:22 PM Davin Shearer <scholarsmate@gmail.com>
wrote:

>
> Is there a way to emit JSON results to file from within postgres?
>

Use psql to directly output query results to a file instead of using COPY
to output structured output in a format you don't want.

David J.