Re: Emitting JSON to file using COPY TO

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Dominique Devienne <ddevienne(at)gmail(dot)com>, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, Davin Shearer <scholarsmate(at)gmail(dot)com>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Emitting JSON to file using COPY TO
Date: 2023-11-27 14:56:22
Message-ID: 3853387.1701096982@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> 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.

I'm not sure I even buy that. JSON data in particular is typically
multi-line, so how will you know where the row boundaries are?
That is, is a newline a row separator or part of the data?

You can debate the intelligence of any particular quoting/escaping
scheme, but imagining that you can get away without having one at
all will just create its own problems.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ron Johnson 2023-11-27 15:16:41 Re: PostgreSql: Canceled on conflict out to old pivot
Previous Message CG 2023-11-27 14:51:56 Re: Removing oids with pg_repack

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Pyhalov 2023-11-27 15:11:56 Re: Add semi-join pushdown to postgres_fdw
Previous Message Matthias van de Meent 2023-11-27 14:55:08 Re: Questions regarding Index AMs and natural ordering