public inbox for [email protected]
help / color / mirror / Atom feedFrom: David G. Johnston <[email protected]>
To: jian he <[email protected]>
Cc: PostgreSQL-development <[email protected]>
Subject: Re: add function argument name to substring and substr
Date: Tue, 18 Mar 2025 18:35:52 -0700
Message-ID: <CAKFQuwa-j+oA23EVA7qk+AUdpi24d1LC_O9MH5oSnzOv2McEhg@mail.gmail.com> (raw)
In-Reply-To: <CACJufxFpzqdfYvsj2iWhtemRyPSB5O7_gb9vRd7cE1ZcVvmZnw@mail.gmail.com>
References: <CACJufxHTBkymh06D4mGKNe1YfRNFN+gFBybmygWk=PtMqu00LQ@mail.gmail.com>
<CAKFQuwYD477A9Oy2PxRr_KY8t=k=jbOUK83ie0dS7fcpBsXS3Q@mail.gmail.com>
<CACJufxE9kt7fAz_g_6PO0PmxK=duWDx+dNUyEWHkGxmRw0EqOg@mail.gmail.com>
<CAKFQuwZ=ZEkQaFZBRpukNn-qvk4U52ZAsrLLRPAC4hgcZsJmkQ@mail.gmail.com>
<CACJufxFpzqdfYvsj2iWhtemRyPSB5O7_gb9vRd7cE1ZcVvmZnw@mail.gmail.com>
On Tue, Mar 18, 2025 at 6:20 PM jian he <[email protected]> wrote:
> On Wed, Mar 19, 2025 at 8:19 AM David G. Johnston
> <[email protected]> wrote:
> >
> > The vast majority of examples throughout the manual use traditional
> function call syntax func_name(arg1, arg2, etc.); I'd rather keep with
> convention than start to scatter about alternative syntax choices just to
> give the random reader who happens upon this fairly esoteric part of the
> manual the benefit of seeing their options. If that is a goal, then I'd
> suggest spending some time in our Tutorial adding some more examples with
> these alternative forms to people looking to be exposed to new things in
> the place they'd go to look for them. They probably won't learn about them
> from the Syntax section.
> >
> > On the plus side, I agree now we should add:
> > substring(string text, pattern text[, escape-character text])
> > to Table 9.10
> >
> in Table Table 9.9 we have
> ```
> substring ( string text FROM pattern text ) → text
> Extracts the first substring matching POSIX regular expression; see
> Section 9.7.3.
> substring('Thomas' from '...$') → mas
> ```
>
> can we change to
> substring ( string text FROM pattern text ) → text
> substring ( string text, pattern text ) → text
> Extracts the first substring matching POSIX regular expression;
> the second format is not standardized. see Section 9.7.3.
> substring('Thomas' from '...$') → mas
>
>
No, based on the (I presume) fact that the substring(string, pattern)
variant is not defined in the SQL standard and Table 9.9 is reserved for
those functions.
It would be a different, but probably worth considering, patch to simply
combine Tables 9.9 and 9.10 and just denote which entries are standard and
which are not. The decision to split the tables along that property came
well before our current table format which seems much more amenable to
merging them together.
> if we add to
> ``substring ( string text, pattern text ) → text``
> Table 9.10,
> then maybe it feels like duplication?
> (same function in Table 9.9, Table 9.10, then we also need some words
> saying that they are the same)
>
We can/should add substring(string, pattern) to Table 9.10 for the same
reason and the same general wording that substr(string, start) exists on
that table.
I would be in favor of adding a similar "same as" comment to the functions
in Table 9.9
I just now processed the cross references in Table 9.9 to the POSIX
section. The new entry in Table 9.10 would want that too.
David J.
view thread (22+ 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]
Subject: Re: add function argument name to substring and substr
In-Reply-To: <CAKFQuwa-j+oA23EVA7qk+AUdpi24d1LC_O9MH5oSnzOv2McEhg@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