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 1r7beB-005xAi-FI for pgsql-general@arkaria.postgresql.org; Mon, 27 Nov 2023 13:27:35 +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 1r7be8-00DUPj-22 for pgsql-general@arkaria.postgresql.org; Mon, 27 Nov 2023 13:27:32 +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 1r7be7-00DUPb-Nl for pgsql-general@lists.postgresql.org; Mon, 27 Nov 2023 13:27:31 +0000 Received: from mail-ot1-x32a.google.com ([2607:f8b0:4864:20::32a]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1r7be5-008nQc-E8 for pgsql-general@lists.postgresql.org; Mon, 27 Nov 2023 13:27:31 +0000 Received: by mail-ot1-x32a.google.com with SMTP id 46e09a7af769-6d7f67a99c7so1843030a34.0 for ; Mon, 27 Nov 2023 05:27:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701091647; x=1701696447; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=V/PjRqfaj3NwPdt3b1OjCJWONotFdDPHSMqnJwRGN+s=; b=EkfVoqwAJFMI0i9+L2hA1CvtTpjlHVGN5Qjw1z0UD9TnI9KsuJPsot5B3/zq8Gsklu zqW9Zx+kxq8JnUdG+3H0QX4w865KEKkeHXwjAIZPpcey4kv3i9b/YbMaHtp3Inn36Yg9 V0SnwZSjWuSu5kbQ2qYb87yy+Wrv8XJ4PMGXQ0NzlyWKhi3FY0I1H5MPUJi37pQ9i9FY mGGUAk9Vdi6ZETyOYR8iF2rcJ+LJ+6EoSRYgxuneTKqJusQtrhgtaxHmqgP7AhlvOPVB XjM9dGa8V4E6rDCvbKHSFhtyiaMuoqj8suYjqLOcollzKpXY1h0WRLria0RMeEkOl8Ee vObQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701091647; x=1701696447; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=V/PjRqfaj3NwPdt3b1OjCJWONotFdDPHSMqnJwRGN+s=; b=cD0LSJH21nerDFp7SKc/T4ZYfA12CouSIxVnlkK62GqM1y5B9wUb7JDGxCp9ahhTK4 83fFOszTIn86XXEHlbPkmgXcznz2V8kW6QAUgWbWQWiwB/givg/2Rax7UE8JVIKYK9/Y uFES8t7TG5fgvbKzvkq4EZpEr01uCeEFCUXjCVr9od1vs4iluxCDIXswoREU0ftT38OZ ixdXyzLToh5+ty5dWr/mHsagHi6Rb30/EM3Xu/2J+G9VVzUZn8I2sFaWkLhszyxhEKcX U5LTebgy6p/4qNRDKZL6xkpoAA4z8dQw3edmxyjjOw3f8gKRRHSl0f7zhJ0VbZVXP+BT DFiA== X-Gm-Message-State: AOJu0YxAMYWnumwKa0U4SpmZew9Ib5g/cfqlxmU2egf1G7rYTD0Xi9yx 7TPDnBNFaGrGtXUqoe6hCjasprk8kKow0NM/pI4= X-Google-Smtp-Source: AGHT+IEQKmma/ATDvcATMmjIZg0A9edXlnPvdwc6AWzQLghn01ArlqEoBYryxscznDW30fPULzg7t06Jq308HsBKeL0= X-Received: by 2002:a05:6830:1d84:b0:6bd:9e1c:93a6 with SMTP id y4-20020a0568301d8400b006bd9e1c93a6mr7100972oti.0.1701091647328; Mon, 27 Nov 2023 05:27:27 -0800 (PST) MIME-Version: 1.0 Received: by 2002:ac9:7f50:0:b0:4f6:384b:17ef with HTTP; Mon, 27 Nov 2023 05:27:26 -0800 (PST) In-Reply-To: References: From: "David G. Johnston" Date: Mon, 27 Nov 2023 06:27:26 -0700 Message-ID: Subject: Re: Emitting JSON to file using COPY TO To: Dominique Devienne Cc: Adrian Klaver , Davin Shearer , "pgsql-general@lists.postgresql.org" Content-Type: multipart/alternative; boundary="0000000000005e9575060b224369" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000005e9575060b224369 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 avoi= d > the escaping? > I agree there should be a copy option for =E2=80=9Cnot formatted=E2=80=9D s= o 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 wrapper present in the json text representation need to be escaped. David J. --0000000000005e9575060b224369 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Monday, November 27, 2023, Dominique Devienne <ddevienne@gmail.com> wrote:
There's even a JSON mode.<= br>
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 for= mat and any structural aspects of the wrapper present in the json text repr= esentation need to be escaped.

David J.
--0000000000005e9575060b224369--