Re: Emitting JSON to file using COPY TO

Поиск
Список
Период
Сортировка
Искать
От
Nathan Bossart
Тема
Re: Emitting JSON to file using COPY TO
Дата
Msg-id
20231201230958.GA1786735@nathanxps13
Ответ на
Список
Дерево обсуждения
Re: Emitting JSON to file using COPY TO Joe Conway <mail@joeconway.com>
Re: Emitting JSON to file using COPY TO Joe Conway <mail@joeconway.com>
Re: Emitting JSON to file using COPY TO "David G. Johnston" <david.g.johnston@gmail.com>
Re: Emitting JSON to file using COPY TO Joe Conway <mail@joeconway.com>
On Fri, Dec 01, 2023 at 02:28:55PM -0500, Joe Conway wrote:
> I did a quick PoC patch (attached) -- if there interest and no hard
> objections I would like to get it up to speed for the January commitfest.

Cool.  I would expect there to be interest, given all the other JSON
support that has been added thus far.

I noticed that, with the PoC patch, "json" is the only format that must be
quoted.  Without quotes, I see a syntax error.  I'm assuming there's a
conflict with another json-related rule somewhere in gram.y, but I haven't
tracked down exactly which one is causing it.

> 1. Is supporting JSON array format sufficient, or does it need to support
> some other options? How flexible does the support scheme need to be?

I don't presently have a strong opinion on this one.  My instinct would be
start with something simple, though.  I don't think we offer any special
options for log_destination...

> 2. This only supports COPY TO and we would undoubtedly want to support COPY
> FROM for JSON as well, but is that required from the start?

I would vote for including COPY FROM support from the start.

> ! 	if (!cstate->opts.json_mode)

I think it's unfortunate that this further complicates the branching in
CopyOneRowTo(), but after some quick glances at the code, I'm not sure it's
worth refactoring a bunch of stuff to make this nicer.

-- 
Nathan Bossart
Amazon Web Services: https://aws.amazon.com


В списке pgsql-hackers по дате отправления
От: Sacha Hottinger
Дата:
От: Tom Lane
Дата:
FAQ