Re: Manua correction

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: troy(at)frericks(dot)us, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: Manua correction
Date: 2021-07-15 21:36:23
Message-ID: 20210715213623.GC14027@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Tue, Jul 13, 2021 at 02:24:01AM +0000, PG Doc comments form wrote:
> The following documentation comment has been logged on the website:
>
> Page: https://www.postgresql.org/docs/13/functions-string.html
> Description:
>
> Hopefully the referrer page was kept. I'm referring to the string functions
> page that reads...
> ==
> position ( substring text IN string text ) → integer
> Returns starting index of specified substring within string, or zero if it's
> not present.
> position('om' in 'Thomas') → 3
> ==
>
> should describe the situation where multiple occurrences of substring are in
> the string text... might read...
>
> Returns starting index of the first occurrence of the specified substring
> within string, or zero if it's not present.

Interesting. I see several cases where our docs are not clear we
process only the first match:

SELECT substring ('abc abd' FROM 'b.');
substring
-----------
bc

SELECT regexp_match('abc abd', 'b.');
regexp_match
--------------
{bc}

SELECT regexp_replace ('abc abf', 'b.', 'dd');
regexp_replace
----------------
add abf

SELECT strpos('abcb', 'b');
strpos
--------
2

SELECT position('a' IN 'abca');
position
----------
1

The attached patch improves these. I can backpatch this were
appropriate.

--
Bruce Momjian <bruce(at)momjian(dot)us> https://momjian.us
EDB https://enterprisedb.com

If only the physical world exists, free will is an illusion.

Attachment Content-Type Size
substring.diff text/x-diff 4.2 KB

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2021-07-16 03:12:38 Re: Manua correction
Previous Message Daniel Gustafsson 2021-07-15 21:31:56 Re: Minor doc fixes