Re: Emitting JSON to file using COPY TO

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Joe Conway <mail(at)joeconway(dot)com>, Davin Shearer <davin(at)apache(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Emitting JSON to file using COPY TO
Date: 2023-12-06 12:36:36
Message-ID: 2e7ff718-895d-83fc-46f7-be25e23b23b4@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers


On 2023-12-05 Tu 16:46, Joe Conway wrote:
> On 12/5/23 16:20, Andrew Dunstan wrote:
>> On 2023-12-05 Tu 16:09, Joe Conway wrote:
>>> On 12/5/23 16:02, Joe Conway wrote:
>>>> On 12/5/23 15:55, Andrew Dunstan wrote:
>>>>> and in any other case (e.g. LINES) I can't see why you
>>>>> would have them.
>>>
>>> Oh I didn't address this -- I saw examples in the interwebs of MSSQL
>>> server I think [1] which had the non-array with commas import and
>>> export style. It was not that tough to support and the code as
>>> written already does it, so why not?
>>
>> That seems quite absurd, TBH. I know we've catered for some absurdity in
>> the CSV code (much of it down to me), so maybe we need to be liberal in
>> what we accept here too. IMNSHO, we should produce either a single JSON
>> document (the ARRAY case) or a series of JSON documents, one per row
>> (the LINES case).
>
>
> So your preference would be to not allow the non-array-with-commas
> case but if/when we implement COPY FROM we would accept that format?
> As in Postel'a law ("be conservative in what you do, be liberal in
> what you accept from others")?

Yes, I think so.

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Patrick FICHE 2023-12-06 13:44:14 RE: ALTER SUBSCRIPTION ... REFRESH cannot be executed from a function
Previous Message Arne Henrik Segtnan 2023-12-06 12:21:15 PostgreSQL 12 error unrecognized configuration parameter zbx_tmp.wal_json_res

Browse pgsql-hackers by date

  From Date Subject
Next Message Euler Taveira 2023-12-06 12:46:09 Re: Is WAL_DEBUG related code still relevant today?
Previous Message Daniel Verite 2023-12-06 12:31:59 Re: Make COPY format extendable: Extract COPY TO format implementations