From: | Joe Conway <mail(at)joeconway(dot)com> |
---|---|
To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
Cc: | Daniel Verite <daniel(at)manitou-mail(dot)org>, Andrew Dunstan <andrew(at)dunslane(dot)net>, 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-07 15:07:59 |
Message-ID: | 61818b31-4e7a-4d99-b08a-9e545dbf0038@joeconway.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
On 12/7/23 09:11, David G. Johnston wrote:
> Those are all the same breakage though - if truly interpreted as data
> rows the protocol is basically written such that the array format is not
> supportable and only the lines format can be used. Hence my “format 0
> doesn’t work” comment for array output and we should explicitly add
> format 2 where we explicitly decouple lines of output from rows of
> data. That said, it would seem in practice format 0 already decouples
> them and so the current choice of the brackets on their own lines is
> acceptable.
>
> I’d prefer to keep them on their own line.
WFM ¯\_(ツ)_/¯
I am merely responding with options to the many people opining on the
thread.
> I also don’t know why you introduced another level of object nesting
> here. That seems quite undesirable.
I didn't add anything. It is an artifact of the particular query I wrote
in the copy to statement (I did "select ss from ss" instead of "select *
from ss"), mea culpa.
This is what the latest patch, as written today, outputs:
8<----------------------
copy
(select 1, g.i from generate_series(1, 3) g(i))
to stdout (format json, force_array);
[
{"?column?":1,"i":1}
,{"?column?":1,"i":2}
,{"?column?":1,"i":3}
]
8<----------------------
--
Joe Conway
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com
From | Date | Subject | |
---|---|---|---|
Next Message | arun chirappurath | 2023-12-07 19:37:24 | write a sql block which will commit if both updates are successful else it will have to be rolled back |
Previous Message | David G. Johnston | 2023-12-07 14:11:08 | Re: Emitting JSON to file using COPY TO |
From | Date | Subject | |
---|---|---|---|
Next Message | Euler Taveira | 2023-12-07 15:09:23 | Re: I’ve come across what I think is a bug |
Previous Message | Robert Haas | 2023-12-07 14:57:32 | Re: UBSan pointer overflow in xlogreader.c |