Re: Emitting JSON to file using COPY TO

2023-12-05 Thread Davin Shearer
> Am I understanding something incorrectly? No, you've got it. You already covered the concerns there. > 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

Re: Emitting JSON to file using COPY TO

2023-12-05 Thread Davin Shearer
Hi Joe, In reviewing the 005 patch, I think that when used with FORCE ARRAY, we should also _imply_ FORCE ROW DELIMITER. I can't envision a use case where someone would want to use FORCE ARRAY without also using FORCE ROW DELIMITER. I can, however, envision a use case where someone would want

Re: Emitting JSON to file using COPY TO

2023-12-05 Thread Davin Shearer
Thanks for the wayback machine link Andrew. I read it, understood it, and will comply. Joe, those test cases look great and the outputs are the same as `jq`. As for forward slashes being escaped, I found this: https://stackoverflow.com/questions/1580647/json-why-are-forward-slashes-escaped .

Re: Emitting JSON to file using COPY TO

2023-12-04 Thread Davin Shearer
Sorry about the top posting / top quoting... the link you sent me gives me a 404. I'm not exactly sure what top quoting / posting means and Googling those terms wasn't helpful for me, but I've removed the quoting that my mail client is automatically "helpfully" adding to my emails. I mean no

Re: Emitting JSON to file using COPY TO

2023-12-04 Thread Davin Shearer
rew Dunstan wrote: > > > > On 2023-12-04 Mo 08:37, Joe Conway wrote: > >> On 12/4/23 07:41, Andrew Dunstan wrote: > >>> > >>> On 2023-12-03 Su 20:14, Joe Conway wrote: > >>>> (please don't top quote on the Postgres lists) > >>

Re: Emitting JSON to file using COPY TO

2023-12-03 Thread Davin Shearer
I worked around it by using select json_agg(t)... and redirecting it to file via psql on the command line. COPY TO was working until we ran into broken JSON and discovered the double quoting issue due to some values containing " in them.

Re: Emitting JSON to file using COPY TO

2023-12-03 Thread Davin Shearer
un, Dec 3, 2023, 10:51 Joe Conway wrote: > On 12/3/23 10:31, Davin Shearer wrote: > > Please be sure to include single and double quotes in the test values > > since that was the original problem (double quoting in COPY TO breaking > > the JSON syntax). > > test=#

Re: Emitting JSON to file using COPY TO

2023-12-03 Thread Davin Shearer
Please be sure to include single and double quotes in the test values since that was the original problem (double quoting in COPY TO breaking the JSON syntax). On Sun, Dec 3, 2023, 10:11 Andrew Dunstan wrote: > > On 2023-12-01 Fr 14:28, Joe Conway wrote: > > On 11/29/23 10:32, D

Re: Emitting JSON to file using COPY TO

2023-12-01 Thread Davin Shearer
I'm really glad to see this taken up as a possible new feature and will definitely use it if it gets released. I'm impressed with how clean, understandable, and approachable the postgres codebase is in general and how easy it is to read and understand this patch. I reviewed the patch (though I