pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Daniel Verite <daniel@manitou-mail.org>
To: Joe Conway <mail@joeconway.com>
Cc: Andrew Dunstan <andrew@dunslane.net>
Cc: Davin Shearer <davin@apache.org>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: Emitting JSON to file using COPY TO
Date: Fri, 08 Dec 2023 20:45:23 +0100
Message-ID: <bfb8b746-148a-47e4-a5c1-51156bcb7e89@manitou-mail.org> (raw)
In-Reply-To: <4162f7f7-6fd6-4720-98e2-89f80e3de2ed@joeconway.com>

	Joe Conway wrote:

> copyto_json.007.diff

When the source has json fields with non-significant line feeds, the COPY
output has these line feeds too, which makes the output incompatible
with rule #2 at https://jsonlines.org  ("2. Each Line is a Valid JSON
Value").

create table j(f json);

insert into j values('{"a":1,
"b":2
}');

copy j to stdout (format json);

Result:
{"f":{"a":1,
"b":2
}}

Is that expected? copy.sgml in 007 doesn't describe the output
in terms of lines so it's hard to tell from the doc.


Best regards,
-- 
Daniel Vérité
https://postgresql.verite.pro/
Twitter: @DanielVerite





view thread (163+ messages)  latest in thread

Message-ID: <bfb8b746-148a-47e4-a5c1-51156bcb7e89@manitou-mail.org>
Permalink:  ../bfb8b746-148a-47e4-a5c1-51156bcb7e89@manitou-mail.org/
Also on:    postgresql.org/message-id/bfb8b746-148a-47e4-a5c1-51156bcb7e89@manitou-mail.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-general@postgresql.org
  Cc: daniel@manitou-mail.org, mail@joeconway.com, andrew@dunslane.net, davin@apache.org, pgsql-hackers@postgresql.org
  Subject: Re: Emitting JSON to file using COPY TO
  In-Reply-To: <bfb8b746-148a-47e4-a5c1-51156bcb7e89@manitou-mail.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox