Re: psql JSON output format - Mailing list pgsql-hackers

From Dean Rasheed
Subject Re: psql JSON output format
Date
Msg-id CAEZATCUMVzeQP3-B6L7atQ6aocaFwTf8wC0fL=-CAR_qKdPaYw@mail.gmail.com
Whole thread Raw
In response to Re: psql JSON output format  (Christoph Berg <myon@debian.org>)
Responses Re: psql JSON output format
List pgsql-hackers
[cc'ing Joe]

On Tue, 9 Jan 2024 at 14:35, Christoph Berg <myon@debian.org> wrote:
>
> Getting it print numeric/boolean without quotes was actually easy, as
> well as json(b). Implemented as the attached v2 patch.
>
> But: not quoting json means that NULL and 'null'::json will both be
> rendered as 'null'. That strikes me as a pretty undesirable conflict.
> Does the COPY patch also do that?
>

Yes. Perhaps what needs to happen is for a NULL column to be omitted
entirely from the output. I think the COPY TO json patch would have to
do that if COPY FROM json were to be added later, to make it
round-trip safe.

> > OTOH, this patch outputs the Postgres string representation of the
> > object, which might be round-trip safe, but is not very convenient
> > for any other tool to read.
>
> For my use case, I need something that can be fed back into PG.
> Reassembling all the json parts back into proper values would be a
> pretty hard problem.
>

What is your use case? It seems like what you want is quite different
from the COPY patch.

Regards,
Dean



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Fix bogus Asserts in calc_non_nestloop_required_outer
Next
From: Tom Lane
Date:
Subject: Re: Fix bogus Asserts in calc_non_nestloop_required_outer