Re: sql/json remaining issue

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: jian he <jian(dot)universality(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: sql/json remaining issue
Date: 2024-04-10 08:39:21
Message-ID: CA+HiwqGNsDAo2NM+JMsP35sCP3EK4U=Ov11HvzE16SvAVtRF+Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Apr 9, 2024 at 8:37 PM Amit Langote <amitlangote09(at)gmail(dot)com> wrote:
> On Tue, Apr 9, 2024 at 4:47 PM jian he <jian(dot)universality(at)gmail(dot)com> wrote:
> > the last query error message is:
> > `
> > ERROR: no SQL/JSON item
> > `
> >
> > we are in ExecEvalJsonExprPath, can we output it to be:
> > `
> > ERROR: after applying json_path "5s", no SQL/JSON item found
> > `
> > in a json_table query, we can have multiple path_expressions, like the
> > above query.
> > it's not easy to know applying which path_expression failed.
>
> Hmm, I'm not so sure about mentioning the details of the path because
> path names are optional and printing path expression itself is not a
> good idea. Perhaps, we could mention the column name which would
> always be there, but we'd then need to add a new field column_name
> that's optionally set to JsonFuncExpr and JsonExpr, that is, when they
> are being set up for JSON_TABLE() columns. As shown in the attached.
> With the patch you'll get:
>
> ERROR: no SQL/JSON item found for column "b"

Attached is a bit more polished version of that, which also addresses
the error messages in JsonPathQuery() and JsonPathValue(). I noticed
that there was comment I had written at one point during JSON_TABLE()
hacking that said that we should be doing this.

I've also added an open item for this.

--
Thanks, Amit Langote

Attachment Content-Type Size
v2-0001-JSON_TABLE-mention-column-name-in-some-error-mess.patch application/octet-stream 12.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Lakhin 2024-04-10 09:00:00 Re: Add SPLIT PARTITION/MERGE PARTITIONS commands
Previous Message Sutou Kouhei 2024-04-10 08:16:26 Re: Make COPY format extendable: Extract COPY TO format implementations