Re: More new SQL/JSON item methods

Andrew Dunstan <andrew@dunslane.net>

From: Andrew Dunstan <andrew@dunslane.net>
To: Jeevan Chalke <jeevan.chalke@enterprisedb.com>, Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: tgl@sss.pgh.pa.us, peter@eisentraut.org, pgsql-hackers@lists.postgresql.org
Date: 2024-02-27T07:10:12Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Rationalize and improve error messages for some jsonpath items

  2. Clean up a bug in sql/json items commit 66ea94e8e6

  3. Implement various jsonpath methods

  4. Reorganise jsonpath operators and methods

  5. Add numeric_int8_opt_error() to optionally suppress errors

On 2024-02-02 Fr 00:31, Jeevan Chalke wrote:
>
>
> On Thu, Feb 1, 2024 at 11:25 AM Kyotaro Horiguchi 
> <horikyota.ntt@gmail.com> wrote:
>
>     At Thu, 1 Feb 2024 09:22:22 +0530, Jeevan Chalke
>     <jeevan.chalke@enterprisedb.com> wrote in
>     > On Thu, Feb 1, 2024 at 7:24 AM Kyotaro Horiguchi
>     <horikyota.ntt@gmail.com>
>     > wrote:
>     >
>     > > At Thu, 01 Feb 2024 10:49:57 +0900 (JST), Kyotaro Horiguchi <
>     > > horikyota.ntt@gmail.com> wrote in
>     > > > By the way, while playing with this feature, I noticed the
>     following
>     > > > error message:
>     > > >
>     > > > > select jsonb_path_query('1.1' , '$.boolean()');
>     > > > > ERROR:  numeric argument of jsonpath item method
>     .boolean() is out of
>     > > range for type boolean
>     > > >
>     > > > The error message seems a bit off to me. For example,
>     "argument '1.1'
>     > > > is invalid for type [bB]oolean" seems more appropriate for this
>     > > > specific issue. (I'm not ceratin about our policy on the
>     spelling of
>     > > > Boolean..)
>     > >
>     > > Or, following our general convention, it would be spelled as:
>     > >
>     > > 'invalid argument for type Boolean: "1.1"'
>     > >
>     >
>     > jsonpath way:
>
>     Hmm. I see.
>
>     > ERROR:  argument of jsonpath item method .boolean() is invalid
>     for type
>     > boolean
>     >
>     > or, if we add input value, then
>     >
>     > ERROR:  argument "1.1" of jsonpath item method .boolean() is
>     invalid for
>     > type boolean
>     >
>     > And this should work for all the error types, like out of range,
>     not valid,
>     > invalid input, etc, etc. Also, we don't need separate error
>     messages for
>     > string input as well, which currently has the following form:
>     >
>     > "string argument of jsonpath item method .%s() is not a valid
>     > representation.."
>
>     Agreed.
>
>
> Attached are patches based on the discussion.



Thanks, I combined these and pushed the result.


cheers


andrew


--
Andrew Dunstan
EDB:https://www.enterprisedb.com