On Tue, Apr 9, 2024 at 8:37 PM Amit Langote <amitlangot...@gmail.com> wrote: > On Tue, Apr 9, 2024 at 4:47 PM jian he <jian.universal...@gmail.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
v2-0001-JSON_TABLE-mention-column-name-in-some-error-mess.patch
Description: Binary data