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 1r7d2E-0062fw-Jz for pgsql-general@arkaria.postgresql.org; Mon, 27 Nov 2023 14:56:30 +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 1r7d2D-00EKFd-9E for pgsql-general@arkaria.postgresql.org; Mon, 27 Nov 2023 14:56:29 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r7d2C-00EKFL-UH for pgsql-general@lists.postgresql.org; Mon, 27 Nov 2023 14:56:28 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r7d2A-007cLV-Ic for pgsql-general@lists.postgresql.org; Mon, 27 Nov 2023 14:56:27 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 3AREuMKe3853388; Mon, 27 Nov 2023 09:56:22 -0500 From: Tom Lane To: "David G. Johnston" cc: Dominique Devienne , Adrian Klaver , Davin Shearer , "pgsql-general@lists.postgresql.org" Subject: Re: Emitting JSON to file using COPY TO In-reply-to: References: Comments: In-reply-to "David G. Johnston" message dated "Mon, 27 Nov 2023 06:27:26 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <3853386.1701096982.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 27 Nov 2023 09:56:22 -0500 Message-ID: <3853387.1701096982@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "David G. Johnston" writes: > I agree there should be a copy option for =E2=80=9Cnot formatted=E2=80=9D= so if you dump a > single column result in that format you get the raw unescaped contents o= f > 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