Re: Emitting JSON to file using COPY TO - Mailing list pgsql-general

From David G. Johnston
Subject Re: Emitting JSON to file using COPY TO
Date
Msg-id CAKFQuwZb3zaSqkOvGXRRLZEW61az+4xyHZ7tBPR91JfrcdCKvA@mail.gmail.com
Whole thread Raw
In response to Re: Emitting JSON to file using COPY TO  (Dominique Devienne <ddevienne@gmail.com>)
Responses Re: Emitting JSON to file using COPY TO
Re: Emitting JSON to file using COPY TO
List pgsql-general
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.

David J.

pgsql-general by date:

Previous
From: Sri Mrudula Attili
Date:
Subject: Re:Could not read from file "pg_subtrans/00F5" at offset 122880: Success.
Next
From: Pavel Stehule
Date:
Subject: Re: Emitting JSON to file using COPY TO