Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rMdlN-005dIa-Pk for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Jan 2024 00:45:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rMdlL-0018Xy-UY for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Jan 2024 00:45:07 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rMdlL-0018Xp-DC for pgsql-hackers@lists.postgresql.org; Mon, 08 Jan 2024 00:45:07 +0000 Received: from out-176.mta1.migadu.com ([2001:41d0:203:375::b0]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rMdlH-000Oqx-CF for pgsql-hackers@lists.postgresql.org; Mon, 08 Jan 2024 00:45:05 +0000 Mime-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nmfay.com; s=key1; t=1704674698; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hmgSsboNyRctXXv917M8QtYrrQS4rxV4aV7h0Le7nUQ=; b=rYD+hWi1EEMFNDroldNpqe/2d0n1suF0eRnZfoedFZg/mYCVVd2vA0czdzcr05MJ8Lyq2X A4psRzlCzn6ZvkIjNciDRuxnX/zOj1gpFOLLYyx0ka+pqkc5Ta+xdoIoVxOSI0JzBrLFt6 1aOSbeemB1qyCQPiO0WUqRPetUSXYfRlbHtgNLp2Dqf9EJrnZQlcWGDkfzB2iXu23Jrkkk uFp/W1zux4CFc60X0eyXh24BF6IfH1umgi+r7lwQnpZl5DrIldquO39L4TZUvYD7+MxDLy p0yuVRa8NK9gwHIyyU1UgOf3gfGArfS+R1K7+9GdCcLtqfaurQvyDl1e1U7rAQ== Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Sun, 07 Jan 2024 19:44:55 -0500 Message-Id: To: "jian he" , "Jim Nasby" Cc: "Peter Eisentraut" , "PostgreSQL Hackers" Subject: Re: add function argument names to regex* functions. X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: "Dian Fay" References: <0eb3a5d7-75d8-4da5-9c88-a93deccdaa03@gmail.com> <75129a34-14da-48aa-9906-42062fe78664@gmail.com> In-Reply-To: X-Migadu-Flow: FLOW_OUT List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu Jan 4, 2024 at 2:03 AM EST, jian he wrote: > On Thu, Jan 4, 2024 at 7:26=E2=80=AFAM Jim Nasby wr= ote: > > > > 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. > > > [0]: https://www.google.com/search?q=3Dregex+nth+match&oq=3Dregex+nth+mat= ch&gs_lcrp=3DEgZjaHJvbWUyBggAEEUYOTIGCAEQRRg8MgYIAhBFGDzSAQc2MThqMGo5qAIAsA= IA&sourceid=3Dchrome&ie=3DUTF-8 The `regexp_replace` summary in table 9.10 is mismatched and still specifies the first parameter name as `string` instead of `source`. Since all the other functions use `string`, should `regexp_replace` do the same or is this a case where an established "standard" diverges? I noticed the original documentation for some of these functions is rather disorganized; summaries explain `occurrence` without explaining the prior `start` parameter, and detailed documentation in 9.7 is usually a single paragraph per function running pell-mell through ifs and buts without section headings, so entries in table 9.10 have to reference the entire section 9.7.3 instead of their specific functions. It's out of scope here, but should I bring this up on pgsql-docs?