Re: Conflict between JSON_AGG and COPY

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: Đỗ Ngọc Trí Cường <dntcuong(at)digi-texx(dot)vn>, pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Conflict between JSON_AGG and COPY
Date: 2018-04-09 14:33:12
Message-ID: CAKFQuwZQpeEAT5XX+A3t1eUeoQLNtzJyPwMbNj8SX==xji7H=A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Apr 9, 2018 at 7:14 AM, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
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 for the old version of PostgreSQL (9.3 and previous)
>> cause of they don't have JSON_AGG aggregate function. Since 9.4, we have
>> "JSON_AGG" already. So I want to rewrite and reduce the length of the
>> query. But it is don't work as I expected with command COPY.
>>
>
​Actually, COPY FROM will interpret the newlines just fine. The issue here
is that most other programs that injects csv are not as intelligent and
will look at the \n as content as opposed to a control character. Those
programs will, however, recognize an actual newline within the quoted field
as being valid data: but it doesn't appear that COPY is capable outputting
such.

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Poty 2018-04-09 14:33:29 Re: algo for canceling a deadlocked transaction
Previous Message Adrian Klaver 2018-04-09 14:14:45 Re: Conflict between JSON_AGG and COPY