Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mAMMN-0002G8-Fj for pgsql-hackers@arkaria.postgresql.org; Mon, 02 Aug 2021 01:03:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mAMMM-0005Db-DX for pgsql-hackers@arkaria.postgresql.org; Mon, 02 Aug 2021 01:03:14 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mAMMM-0005DT-5f for pgsql-hackers@lists.postgresql.org; Mon, 02 Aug 2021 01:03:14 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mAMMJ-00024J-Si for pgsql-hackers@lists.postgresql.org; Mon, 02 Aug 2021 01:03:13 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 17212KsH1572285; Sun, 1 Aug 2021 21:02:20 -0400 From: Tom Lane To: Gilles Darold cc: Chapman Flack , er@xs4all.nl, pgsql-hackers@lists.postgresql.org Subject: Re: [PATCH] proposal for regexp_count, regexp_instr, regexp_substr and regexp_replace In-reply-to: <1567465.1627860115@sss.pgh.pa.us> References: <2292303d-766d-2172-2942-b076a3bb6505@darold.net> <2122577845.234888.1616324857283@webmailclassic.xs4all.nl> <9f91e4e7-19c8-d8e0-6955-fefaebd4c8fe@darold.net> <60575B5A.4080807@anastigmatix.net> <345476.1616338397@sss.pgh.pa.us> <45fe2893-1efc-1666-3ea5-b5fb1918c7fa@gmail.com> <212635.1627329361@sss.pgh.pa.us> <2204c4a4-8ee8-abdd-d5ca-d0b6893f96ab@darold.net> <1124806.1627681104@sss.pgh.pa.us> <1567465.1627860115@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Sun, 01 Aug 2021 19:21:55 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1572283.1627866140.1@sss.pgh.pa.us> Date: Sun, 01 Aug 2021 21:02:20 -0400 Message-ID: <1572284.1627866140@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I wrote: > ... aside from the question of whether > a too-large subexpression number should be an error or not. Oh ... poking around some more, I noticed a very nearby precedent. regexp_replace's replacement string can include \1 to \9 to insert the substring matching the N'th parenthesized subexpression. But if there is no such subexpression, you don't get an error, just an empty insertion. So that seems like an argument for not throwing an error for an out-of-range subexpr parameter. regards, tom lane