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 1r7c6p-005yfX-W9 for pgsql-general@arkaria.postgresql.org; Mon, 27 Nov 2023 13:57:12 +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 1r7c6o-00Dnz7-L3 for pgsql-general@arkaria.postgresql.org; Mon, 27 Nov 2023 13:57:10 +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 1r7c6o-00Dnyn-9f for pgsql-general@lists.postgresql.org; Mon, 27 Nov 2023 13:57:10 +0000 Received: from mail-yb1-xb2e.google.com ([2607:f8b0:4864:20::b2e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1r7c6l-007bpI-RM for pgsql-general@lists.postgresql.org; Mon, 27 Nov 2023 13:57:09 +0000 Received: by mail-yb1-xb2e.google.com with SMTP id 3f1490d57ef6-daf7ed42ea6so4003258276.0 for ; Mon, 27 Nov 2023 05:57:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701093427; x=1701698227; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=9U3fVsmpEU2UfZuFCd61le+4B/J8ehvUrTpsdzi0Mf4=; b=id5AMShv2OkT9rQ132AIRqa//N2YGrj/Lc8RoPqiBeRZlrC3q2HxEEhxKm6XsU/dDJ ecn8PCZEY9Qw5q7qeRRcutlyHSTeb2efhnJa6NkFotL5+r1qjIRAPb+jv/sKELrbTQkw r4eGNSRXMkXq2ds+6z0VknXQkttUJwhnLIsVUdOLtkPULGVeMnCugAn3btFrlgnZKXt2 PWdxZgU3K0TXdWIicsio5wgNFEYZwacjWKnMdgSX80X2sJjiwi+NJRNH5Ve1Z96hcbOX fN1BuprhXmmrgrFu9eimlNUKZxIQwhe0OEY5ITinO8vZfEhrDicLtLMuBvrXtDjJJtiZ QUmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701093427; x=1701698227; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9U3fVsmpEU2UfZuFCd61le+4B/J8ehvUrTpsdzi0Mf4=; b=P5F/yphV2X8nmLh6co78tQ4+3kXRMFa3DHwaAQw/dXYJ2fOz346W678PdPY2zCxYFU Snh28G8Ji0NDnzXc6vlkY/F5ZR/1T/I40n2Ddr19BJd1BfVT1yphwBzn+cEpWz84kSfj XnjrNKaWF7+r9AO84vG/TNM79WvfLBCyHJo9TAxdOIvuUnzZpKFoAkf4MY2TRP4K4cd7 +SDw1MR5oWtq+ZlRz7DWLQw4mhRnLpY43DughnDaW3YuM1jQI/FmEz1aM/JxdhrsdjVZ 2OEa0sx1EiZqj4/Y0IHKvC9tc/Ez/HIvjnAZ+CB9u1YoMdRLzGUBR54uhp4de9hKOnEw yvkw== X-Gm-Message-State: AOJu0YyQKGo9AAhwqLWFKdNZGUd+58G2fXsQ6jd5zzaEbXmTHay0Isb9 UUC29R1M4/HYCnHqoVEwnWkzhzGfEH7iQzqdt8Y= X-Google-Smtp-Source: AGHT+IEi9cmYGRDo7Xd9q5RogVrTH2Bd8oAwMBpDxUqEWuS7nG1m2dArbrhCvrhW0qg9vCPqArT5/vpq0IRM05dUS38= X-Received: by 2002:a5b:28c:0:b0:d9b:87f3:54f9 with SMTP id x12-20020a5b028c000000b00d9b87f354f9mr11338285ybl.28.1701093426968; Mon, 27 Nov 2023 05:57:06 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Pavel Stehule Date: Mon, 27 Nov 2023 14:56:30 +0100 Message-ID: Subject: Re: Emitting JSON to file using COPY TO To: "David G. Johnston" Cc: Dominique Devienne , Adrian Klaver , Davin Shearer , "pgsql-general@lists.postgresql.org" Content-Type: multipart/alternative; boundary="00000000000071be64060b22aded" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000071be64060b22aded Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi po 27. 11. 2023 v 14:27 odes=C3=ADlatel David G. Johnston < david.g.johnston@gmail.com> napsal: > On Monday, November 27, 2023, Dominique Devienne > wrote: > >> There's even a JSON mode. >> By miracle, would the JSON output mode recognize JSON[B] values, and >> avoid the escaping? >> > > 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 of > the column. As soon as you ask for a format your json is now embedded so = it > is a value within another format and any structural aspects of the wrappe= r > present in the json text representation need to be escaped. > Is it better to use the LO API for this purpose? It is native for not formatted data. Regards Pavel > David J. > --00000000000071be64060b22aded Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi

po 27. 11. 2023 v=C2=A014:27 odes=C3=ADlatel = David G. Johnston <david.g.johnston@gmail.com> napsal:
On Monday, November 27, 2023, Domini= que Devienne <d= devienne@gmail.com> wrote:
There's even a JSON mode.=
By miracle, would the JSON output= mode recognize JSON[B] values, and avoid the escaping?

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 th= at format you get the raw unescaped contents of the column. As soon as you = ask for a format your json is now embedded so it is a value within another = format and any structural aspects of the wrapper present in the json text r= epresentation need to be escaped.

Is = it better to use the LO API for this purpose?=C2=A0 It is native for not fo= rmatted data.

Regards

Pavel


David J.
--00000000000071be64060b22aded--