Re: Bug in JDBC.driver CopyManager method when copying json output - Mailing list pgsql-jdbc

From Tom Lane
Subject Re: Bug in JDBC.driver CopyManager method when copying json output
Date
Msg-id 13326.1540055792@sss.pgh.pa.us
Whole thread Raw
In response to Bug in JDBC.driver CopyManager method when copying json output  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-jdbc
"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


pgsql-jdbc by date:

Previous
From: Dave Cramer
Date:
Subject: Re: ⚠ Re: Bug in JDBC.driver CopyManager method when copying json output
Next
From: "Kalyan Koka"
Date:
Subject: Stored Procedure call using JDBC is failing