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

From Joe Conway
Subject Re: Emitting JSON to file using COPY TO
Date
Msg-id 7117a356-916c-4cf3-bad8-861490e65dcf@joeconway.com
Whole thread Raw
In response to Re: Emitting JSON to file using COPY TO  (Davin Shearer <davin@apache.org>)
Responses Re: Emitting JSON to file using COPY TO
List pgsql-hackers
On 12/3/23 10:31, Davin Shearer wrote:
> Please be sure to include single and double quotes in the test values 
> since that was the original problem (double quoting in COPY TO breaking 
> the JSON syntax).

test=# copy (select * from foo limit 4) to stdout (format json);
{"id":2456092,"f1":"line with ' in it: 
2456092","f2":"2023-12-03T10:44:40.9712-05:00"}
{"id":2456093,"f1":"line with \\" in it: 
2456093","f2":"2023-12-03T10:44:40.971221-05:00"}
{"id":2456094,"f1":"line with ' in it: 
2456094","f2":"2023-12-03T10:44:40.971225-05:00"}
{"id":2456095,"f1":"line with \\" in it: 
2456095","f2":"2023-12-03T10:44:40.971228-05:00"}

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




pgsql-hackers by date:

Previous
From: Davin Shearer
Date:
Subject: Re: Emitting JSON to file using COPY TO
Next
From: Joe Conway
Date:
Subject: Re: Emitting JSON to file using COPY TO