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

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

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.

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

Re: Conflict between JSON_AGG and COPY

2018-04-09 Thread Đỗ Ngọc Trí Cường
pgsql-general" <pgsql-general@lists.postgresql.org> Sent: Monday, April 9, 2018 12:59:44 AM Subject: Re: Conflict between JSON_AGG and COPY 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

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        |

Conflict between JSON_AGG and COPY

2018-04-07 Thread Đỗ Ngọc Trí Cường
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 | John 2 | anna | Anna 3 | sussi | Sussi 4 | david | David