Re: Emitting JSON to file using COPY TO

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Emitting JSON to file using COPY TO
Дата
Msg-id CAKFQuwa=tVQxe0m6tnW-BtLhsGJN0ympLP=WiP+bsbavQU2w4A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Emitting JSON to file using COPY TO  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-general
On Monday, November 27, 2023, Pavel Stehule <pavel.stehule@gmail.com> wrote:
Hi

po 27. 11. 2023 v 14:27 odesílatel David G. Johnston <david.g.johnston@gmail.com> napsal:
On Monday, November 27, 2023, Dominique Devienne <ddevienne@gmail.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. 

Using LO is, IMO, never the answer.  But if you are using a driver API anyway just handle the normal select query result.

David J.

В списке pgsql-general по дате отправления:

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: Emitting JSON to file using COPY TO
Следующее
От: CG
Дата:
Сообщение: Re: Removing oids with pg_repack