From: | jian he <jian(dot)universality(at)gmail(dot)com> |
---|---|
To: | Jim Nasby <jim(dot)nasby(at)gmail(dot)com> |
Cc: | Dian Fay <di(at)nmfay(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: add function argument names to regex* functions. |
Date: | 2024-01-04 07:03:00 |
Message-ID: | CACJufxHBx+AHGVJocDSD-PbX0z32vJR9eEUhB+vsJHbjwnXNcg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Jan 4, 2024 at 7:26 AM Jim Nasby <jim(dot)nasby(at)gmail(dot)com> wrote:
>
> On 1/3/24 5:05 PM, Dian Fay wrote:
>
> Another possibility is `index`, which is relatively short and not a
> reserved keyword ^1. `position` is not as precise but would avoid the
> conceptual overloading of ordinary indices.
>
> I'm not a fan of "index" since that leaves the question of
> whether it's 0 or 1 based. "Position" is a bit better, but I think
> Jian's suggestion of "occurance" is best.
>
> We do have precedent for one-based `index` in Postgres: array types are
> 1-indexed by default! "Occurrence" removes that ambiguity but it's long
> and easy to misspell (I looked it up after typing it just now and it
> _still_ feels off).
>
> How's "instance"?
>
> Presumably someone referencing arguments by name would have just looked up the names via \df or whatever, so presumably misspelling wouldn't be a big issue. But I think "instance" is OK as well.
>
> --
> Jim Nasby, Data Architect, Austin TX
regexp_instr: It has the syntax regexp_instr(string, pattern [, start
[, N [, endoption [, flags [, subexpr ]]]]])
oracle:
REGEXP_INSTR (source_char, pattern, [, position [, occurrence [,
return_opt [, match_param [, subexpr ]]]]] )
"string" and "source_char" are almost the same descriptive, so maybe
there is no need to change.
"start" is better than "position", imho.
"return_opt" is better than "endoption", (maybe we need change, for
now I didn't)
"flags" cannot be changed to "match_param", given it quite everywhere
in functions-matching.html.
similarly for function regexp_replace, oracle using "repplace_string",
we use "replacement"(mentioned in the doc).
so I don't think we need to change to "repplace_string".
Based on how people google[0], I think `occurrence` is ok, even though
it's verbose.
to change from `N` to `occurrence`, we also need to change the doc,
that is why this patch is more larger.
Attachment | Content-Type | Size |
---|---|---|
v2-0001-add-function-argument-names-to-regex.-functions.patch | text/x-patch | 17.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Banck | 2024-01-04 07:30:36 | Re: [PATCH] Exponential backoff for auth_delay |
Previous Message | Ashutosh Bapat | 2024-01-04 07:00:05 | Re: speed up a logical replica setup |