public inbox for [email protected]
help / color / mirror / Atom feedFrom: Daniel Verite <[email protected]>
To: Joel Jacobson <[email protected]>
Cc: Jacob Champion <[email protected]>
Cc: Tatsuo Ishii <[email protected]>
Cc: [email protected]
Subject: Re: New "raw" COPY format
Date: Wed, 16 Oct 2024 18:34:13 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
Joel Jacobson wrote:
> However, I thinking rejecting such column data seems like the
> better alternative, to ensure data exported with COPY TO
> can always be imported back using COPY FROM,
> for the same format.
On the other hand, that might prevent cases where we
want to export, for instance, a valid json array:
copy (select json_agg(col) from table ) to 'file' RAW
This is a variant of the discussion in [1] where the OP does:
copy (select json_agg(row_to_json(t)) from <query> t) TO 'file'
and he complains that both text and csv "break the JSON".
That discussion morphed into a proposed patch adding JSON
format to COPY, but RAW would work directly as the OP
expected.
That is, unless <query> happens to include JSON fields with LF/CRLF
in them, and the RAW format says this is an error condition.
In that case it's quite annoying to make it an error, rather than
simply let it pass.
[1]
https://postgr.es/m/CALvfUkBxTYy5uWPFVwpk_7ii2zgT07t3d-yR_cy4sfrrLU=kcg@mail.gmail.com
Best regards,
--
Daniel Vérité
https://postgresql.verite.pro/
Twitter: @DanielVerite
view thread (2+ messages)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: New "raw" COPY format
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox