Re: add function argument names to regex* functions.

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: add function argument names to regex* functions.
Дата
Msg-id CAKFQuwaSHLBxqOun03+2WgQPdrq1Jd38t2K5FG-vAgqDFqcUTQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: add function argument names to regex* functions.  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: add function argument names to regex* functions.  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
On Wed, May 15, 2024 at 12:07 PM Robert Haas <robertmhaas@gmail.com> wrote:
On Wed, May 15, 2024 at 3:01 PM David G. Johnston
<david.g.johnston@gmail.com> wrote:
> I think this confusion goes to show that replacing N with count doesn't work.
>
> "replace_at" comes to mind as a better name.

I do not agree with that at all. It shows that a literal
search-and-replace changing N to count does not work, but it does not
show that count is a bad name for the concept, and I don't think it
is. I believe that if I were reading the documentation, count would be
clearer to me than N, N would probably still be clear enough, and
replace_at wouldn't be clear at all. I'd expect replace_at to be a
character position or something, not an occurrence count.


The function replaces matches, not random characters.  And if you are reading the documentation I find it implausible that the wording I suggested would cause one to think in terms of characters instead of matches.

If I choose not to read the documentation "count" seems like it behaves as a qualified "g".  I don't want all matches replaced, I want the first "count" matches only replaced.

"occurrence" probably is the best choice but I agree the spelling issues are a big negative.

count - how many things there are.  This isn't a count.  I'd rather stick with N, at least it actually has the desired meaning as a pointer to an item in a list.

N - The label provides zero context as to what the number you place there is going to be used for.  Labels ideally do more work than this especially if someone takes the time to spell them out.  Otherwise why use "pattern" instead of "p".

David J.

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Chapman Flack
Дата:
Сообщение: Re: add function argument names to regex* functions.
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [PATCH] Add --syntax to postgres for SQL syntax checking