Re: Emitting JSON to file using COPY TO

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Dominique Devienne <ddevienne(at)gmail(dot)com>, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, Davin Shearer <scholarsmate(at)gmail(dot)com>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Emitting JSON to file using COPY TO
Date: 2023-11-27 13:56:30
Message-ID: CAFj8pRD-vEAXNew6wu0j9ARhQ_Hu0nwFmGQj0YMQiWw5rQDciQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Hi

po 27. 11. 2023 v 14:27 odesílatel David G. Johnston <
david(dot)g(dot)johnston(at)gmail(dot)com> napsal:

> On Monday, November 27, 2023, Dominique Devienne <ddevienne(at)gmail(dot)com>
> wrote:
>
>> There's even a JSON mode.
>> By miracle, would the JSON output mode recognize JSON[B] values, and
>> avoid the escaping?
>>
>
> I agree there should be a copy option for “not formatted” so if you dump a
> single column result in that format you get the raw unescaped contents of
> the column. As soon as you ask for a format your json is now embedded so it
> is a value within another format and any structural aspects of the wrapper
> present in the json text representation need to be escaped.
>

Is it better to use the LO API for this purpose? It is native for not
formatted data.

Regards

Pavel

> David J.
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2023-11-27 14:43:08 Re: Emitting JSON to file using COPY TO
Previous Message David G. Johnston 2023-11-27 13:27:26 Re: Emitting JSON to file using COPY TO

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2023-11-27 13:56:43 Re: remaining sql/json patches
Previous Message Tomas Vondra 2023-11-27 13:54:56 Re: logical decoding and replication of sequences, take 2