Re: [PATCH] proposal for regexp_count, regexp_instr, regexp_substr and regexp_replace
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Gilles Darold <gillesdarold@gmail.com>
Cc: Chapman Flack <chap@anastigmatix.net>, Gilles Darold <gilles@darold.net>,
er@xs4all.nl, pgsql-hackers@lists.postgresql.org
Date: 2021-07-26T19:56:01Z
Lists: pgsql-hackers
Gilles Darold <gillesdarold@gmail.com> writes:
> [ v4-0001-regexp-foo-functions.patch ]
I started to work through this and was distressed to realize that
it's trying to redefine regexp_replace() in an incompatible way.
We already have
regression=# \df regexp_replace
List of functions
Schema | Name | Result data type | Argument data types | Type
------------+----------------+------------------+------------------------+------
pg_catalog | regexp_replace | text | text, text, text | func
pg_catalog | regexp_replace | text | text, text, text, text | func
(2 rows)
The patch proposes to add (among other alternatives)
+{ oid => '9608', descr => 'replace text using regexp',
+ proname => 'regexp_replace', prorettype => 'text',
+ proargtypes => 'text text text int4', prosrc => 'textregexreplace_extended_no_occurrence' },
which is going to be impossibly confusing for both humans and machines.
I don't think we should go there. Even if you managed to construct
examples that didn't result in "ambiguous function" failures, that
doesn't mean that ordinary mortals won't get bit that way.
I'm inclined to just drop the regexp_replace additions. I don't think
that the extra parameters Oracle provides here are especially useful.
They're definitely not useful enough to justify creating compatibility
hazards for.
regards, tom lane
Commits
-
doc: More documentation on regular expressions and SQL standard
- 222b697ec077 15.0 landed
-
Add assorted new regexp_xxx SQL functions.
- 642433707358 15.0 landed