Re: substring synopsis section, third argument is optional doc didn't show that

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: substring synopsis section, third argument is optional doc didn't show that
Date: 2025-02-23 06:27:26
Message-ID: CACJufxHQ9WqebF+YOVUjhXfQjoVWi9nGk_2oxjUUWeZBadgvBA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Tue, Feb 18, 2025 at 7:06 AM David G. Johnston
<david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
>
> On Tue, Jan 21, 2025 at 11:29 PM jian he <jian(dot)universality(at)gmail(dot)com> wrote:
>>
>> in 9.7.2 do you think it's worthwhile changing it to
>>
>> ""
>> As with SIMILAR TO, substring(string, pattern, escape-character)
>> the specified pattern must match the entire data string, or else the
>> function fails and returns null.
>> ""
>> ?
>>
>
> Making reference to any one of the three listed function signatures here doesn't seem to provide value. If anything I'd write:
>
> "As with SIMILAR TO, substring matches the specified pattern to the entire data string, returning null otherwise."
>
> I would avoid saying that the function fails in any situation that doesn't produce an actual error. The transition of "match everything or returns null" can be bike-shedded though.
>

thinking about it.
I think the current wording
"As with SIMILAR TO, the specified pattern must match the entire data
string, or else the function fails and returns null"
is fine.

I guess my complaint is that the above sentence is not as explicit as
the 9.7.3 section description.
"
The substring function with two parameters, substring(string from
pattern), provides extraction of a substring that matches a POSIX
regular expression pattern.
It returns null if there is no match, otherwise the first portion of
the text that matched the pattern.
"

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message Amit Kapila 2025-02-24 02:46:20 Re: pg_copy_logical_replication_slot doesn't copy the failover property
Previous Message Shlok Kyal 2025-02-22 05:56:31 Re: pg_copy_logical_replication_slot doesn't copy the failover property