Re: Emitting JSON to file using COPY TO

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Dominique Devienne <ddevienne(at)gmail(dot)com>
Cc: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, Davin Shearer <scholarsmate(at)gmail(dot)com>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Emitting JSON to file using COPY TO
Date: 2023-11-27 13:27:26
Message-ID: CAKFQuwZb3zaSqkOvGXRRLZEW61az+4xyHZ7tBPR91JfrcdCKvA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Monday, November 27, 2023, Dominique Devienne <ddevienne(at)gmail(dot)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 “not formatted” 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 wrapper
present in the json text representation need to be escaped.

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2023-11-27 13:56:30 Re: Emitting JSON to file using COPY TO
Previous Message Sri Mrudula Attili 2023-11-27 11:50:26 Re:Could not read from file "pg_subtrans/00F5" at offset 122880: Success.

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2023-11-27 13:39:16 Re: Optimizing nbtree ScalarArrayOp execution, allowing multi-column ordered scans, skip scan
Previous Message Masahiko Sawada 2023-11-27 13:06:15 Re: Testing autovacuum wraparound (including failsafe)