Re: Conflict between JSON_AGG and COPY

2018-04-09 Thread Adrian Klaver
On 04/08/2018 08:44 PM, Đỗ Ngọc Trí Cường wrote: Dear Arian Klaver, I think there is a misunderstood here. I think that I quite understand how is the second query run. The question I asked here is why exporting data, which is generated by a query "JSON_AGG" , with command "COPY". The data con

Re: Conflict between JSON_AGG and COPY

2018-04-09 Thread Daniel Verite
Đỗ Ngọc Trí Cường wrote: > I want to export it to a file in JSON format so I run the query as below: > COPY (SELECT...) TO '/home/postgres/test1.json' COPY TO applies its own format rules on top of the data, which include among other things, quoting the newline characters. What you seem t

Re: Conflict between JSON_AGG and COPY

2018-04-09 Thread David G. Johnston
On Mon, Apr 9, 2018 at 7:14 AM, Adrian Klaver wrote: > On 04/08/2018 08:44 PM, Đỗ Ngọc Trí Cường wrote: > > Presently, COPY TO will never emit an octal or hex-digits backslash > sequence, but it does use the other sequences listed above for those > control characters. > > >> The second query is f

Re: Conflict between JSON_AGG and COPY

2018-04-09 Thread Adrian Klaver
On 04/08/2018 08:44 PM, Đỗ Ngọc Trí Cường wrote: Dear Arian Klaver, I think there is a misunderstood here. I think that I quite understand how is the second query run. The question I asked here is why exporting data, which is generated by a query "JSON_AGG" , with command "COPY". The data con

Re: Conflict between JSON_AGG and COPY

2018-04-09 Thread Đỗ Ngọc Trí Cường
. But it is don't work as I expected with command COPY. Thank you and best regards, Đỗ Ngọc Trí Cường (Mr.) | Software Development Department | +84 28 3715 5325 From: "Adrian Klaver" To: "Đỗ Ngọc Trí Cường" , "pgsql-general" Sent: Monday, April 9, 2018

Re: Conflict between JSON_AGG and COPY

2018-04-08 Thread Adrian Klaver
On 04/07/2018 03:44 AM, Đỗ Ngọc Trí Cường wrote: Dear all, I've found one case. I don't know this is a bug or I config/query some things wrong. Let I describe it. I have a table with structure and data is:  id | username |   fullname +-+---   1 | john        | J