Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t16yb-00Emi5-BC for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Oct 2024 16:34:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1t16yZ-005sdR-Kl for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Oct 2024 16:34:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t16yZ-005sdI-BS for pgsql-hackers@lists.postgresql.org; Wed, 16 Oct 2024 16:34:19 +0000 Received: from dverite2024.planet-service.net ([185.16.44.252] helo=mail.verite.pro) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t16yW-001NxT-08 for pgsql-hackers@lists.postgresql.org; Wed, 16 Oct 2024 16:34:19 +0000 Received: by mail.verite.pro (Postfix, from userid 1000) id EDB072C84E1; Wed, 16 Oct 2024 18:34:13 +0200 (CEST) Content-Type: text/plain; charset="iso-8859-15" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 From: "Daniel Verite" Subject: Re: New "raw" COPY format To: "Joel Jacobson" Cc: Jacob Champion , Tatsuo Ishii , pgsql-hackers@lists.postgresql.org In-Reply-To: Date: Wed, 16 Oct 2024 18:34:13 +0200 Message-Id: X-Mailer: Manitou v1.7.3 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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.=20 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 t) TO 'file'=20 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 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=3Dkcg@m= ail.gmail.com Best regards, --=20 Daniel V=E9rit=E9 https://postgresql.verite.pro/ Twitter: @DanielVerite