Re: psql JSON output format

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: Christoph Berg <myon(at)debian(dot)org>
Cc: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Jelte Fennema-Nio <postgres(at)jeltef(dot)nl>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Joe Conway <mail(at)joeconway(dot)com>
Subject: Re: psql JSON output format
Date: 2024-01-09 16:51:31
Message-ID: CAEZATCUMVzeQP3-B6L7atQ6aocaFwTf8wC0fL=-CAR_qKdPaYw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

[cc'ing Joe]

On Tue, 9 Jan 2024 at 14:35, Christoph Berg <myon(at)debian(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2024-01-09 16:58:21 Re: Fix bogus Asserts in calc_non_nestloop_required_outer
Previous Message Robert Haas 2024-01-09 16:44:32 Re: Fix bogus Asserts in calc_non_nestloop_required_outer