From: Tom Lane <tgl@sss.pgh.pa.us>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: Dave Cramer <pg@fastcrypt.com>
Cc: Gerson.Stadlmann@ifco.com <Gerson.Stadlmann@ifco.com>
Cc: List <pgsql-jdbc@postgresql.org>
Subject: Re: Bug in JDBC.driver CopyManager method when copying json output
Date: Sat, 20 Oct 2018 13:16:32 -0400
Message-ID: <13326.1540055792@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKFQuwbH-kJyMGPoMGQdW_FscojOZd60zqDX+SUPEBhZZ86ooA@mail.gmail.com>
References: <BYAPR04MB5031DB12A0083C4E52E875B5F8F90@BYAPR04MB5031.namprd04.prod.outlook.com>
<CADK3HHL5tD0KuSVjvF6=DPPH5pyc92JP=wzPhPY=_HwqjxjA7g@mail.gmail.com>
<CAKFQuwbH-kJyMGPoMGQdW_FscojOZd60zqDX+SUPEBhZZ86ooA@mail.gmail.com>
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> The backend is respecting the documented meanings and usage of the QUOTE
> and ESCAPE options of COPY.
Yeah, I don't see any bug here. You've got one layer of backslash-quoting
that is required by JSON string syntax, and then a second layer that is
imposed by COPY's text format.
> Not sure what a JSON mode would look like though I’m thinking it’s not what
> was described here...
I can't see how that would do anything except move the pain somewhere
else. Multiple quoting layers always result in "ugly" output (but if
the receipient is correctly coded and reverses the operations in the
right sequence, the same underlying data will emerge).
The OP might want to consider using COPY BINARY, which uses a length
prefix instead of character-escaping to keep fields separate. Still,
though, this is fundamentally just cosmetic. If you don't apply the
correct reverse conversion steps in the correct order, you won't get
the right results.
regards, tom lane
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: tgl@sss.pgh.pa.us, david.g.johnston@gmail.com, pg@fastcrypt.com, Gerson.Stadlmann@ifco.com
Subject: Re: Bug in JDBC.driver CopyManager method when copying json output
In-Reply-To: <13326.1540055792@sss.pgh.pa.us>
References: <BYAPR04MB5031DB12A0083C4E52E875B5F8F90@BYAPR04MB5031.namprd04.prod.outlook.com> <CADK3HHL5tD0KuSVjvF6=DPPH5pyc92JP=wzPhPY=_HwqjxjA7g@mail.gmail.com> <CAKFQuwbH-kJyMGPoMGQdW_FscojOZd60zqDX+SUPEBhZZ86ooA@mail.gmail.com> <13326.1540055792@sss.pgh.pa.us>
* 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