public inbox for [email protected]  
help / color / mirror / Atom feed
From: jian he <[email protected]>
To: David E. Wheeler <[email protected]>
Cc: Chao Li <[email protected]>
Cc: Álvaro Herrera <[email protected]>
Cc: Florents Tselai <[email protected]>
Cc: Tom Lane <[email protected]>
Cc: Peter Eisentraut <[email protected]>
Cc: Robert Haas <[email protected]>
Cc: Alexander Korotkov <[email protected]>
Cc: pgsql-hackers <[email protected]>
Cc: Andrew Dunstan <[email protected]>
Subject: Re: PATCH: jsonpath string methods: lower, upper, initcap, l/r/btrim, replace, split_part
Date: Sun, 7 Dec 2025 19:21:47 +0800
Message-ID: <CACJufxHxWKhNcTsmYz428yxUikeUVZz=o6mLNRXpB7F_1oDEng@mail.gmail.com> (raw)
In-Reply-To: <CACJufxGdgxyRLd03wM=GtJzUskXnXxEBGGtwA2vsTvkV827SxA@mail.gmail.com>
References: <[email protected]>
	<[email protected]>
	<[email protected]>
	<CACJufxGAmcwq33nr_MmgnGdGo7E10c55kCA22DQ4n9FBUOZmTA@mail.gmail.com>
	<[email protected]>
	<CACJufxEphbmEWLKzYNfzsyEB5+bkbMAMUHJq2LxpDdcSZn98BA@mail.gmail.com>
	<CACJufxGdgxyRLd03wM=GtJzUskXnXxEBGGtwA2vsTvkV827SxA@mail.gmail.com>

hi.
       <para>
        <literal>jsonb_path_query('"abc,def,ghi,jkl"',
'$.split_part(",", 2)')</literal>
        <returnvalue>"ghi"</returnvalue>
       </para></entry>
the return value should be
"def"
?

      <row>
       <entry role="func_table_entry"><para role="func_signature">
        <replaceable>string</replaceable> <literal>.</literal>
<literal>ltrim(<replaceable>characters</replaceable>)</literal>
        <returnvalue><replaceable>string</replaceable></returnvalue>
       </para>
       <para>
        String with the longest string containing only spaces or the
        characters in <replaceable>characters</replaceable> removed from the
        start of <replaceable>string</replaceable>
       </para>
       <para>
        <literal> jsonb_path_query('"  hello"', '$.ltrim()')</literal>
        <returnvalue>"hello"</returnvalue>
       </para>
       <para>
        <literal>jsonb_path_query('"zzzytest"', '$.ltrim("xyz")')</literal>
        <returnvalue>"test"</returnvalue>
       </para></entry>
      </row>

The actual signature:
<replaceable>characters</replaceable> part is optional, but we didn't
use square brackets
to indicate it's optional.

personally I would prefer list two seperate function signature, like:
       <entry role="func_table_entry"><para role="func_signature">
        <replaceable>string</replaceable> <literal>.</literal>
<literal>ltrim()</literal>
        <returnvalue><replaceable>string</replaceable></returnvalue>
       </para>
       <para role="func_signature">
        <replaceable>string</replaceable> <literal>.</literal>
<literal>ltrim(<replaceable>characters</replaceable>)</literal>
        <returnvalue><replaceable>string</replaceable></returnvalue>
       </para>

similarly:
string . rtrim([ characters ]) → string
change to
```
string . rtrim() → string
string . rtrim(characters ) → string
```

string . btrim([ characters ]) → string
change to
```
string . btrim() → string
string . btrim([ characters ]) → string
``
would improve the readability, I think.


--
jian
https://www.enterprisedb.com/





view thread (51+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: PATCH: jsonpath string methods: lower, upper, initcap, l/r/btrim, replace, split_part
  In-Reply-To: <CACJufxHxWKhNcTsmYz428yxUikeUVZz=o6mLNRXpB7F_1oDEng@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox