diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2016-08-17 18:32:56 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2016-08-17 18:33:01 -0400 |
commit | cf9b0fea5f6d1bcc9b2c66f5c30ecb04684a0919 (patch) | |
tree | 37757fd2bb978cdd4837168e61340ddd7f33de04 /src/include/utils/builtins.h | |
parent | 2d7e591007a6f44e5e27e2b6c1098483105c0d10 (diff) | |
download | postgresql-cf9b0fea5f6d1bcc9b2c66f5c30ecb04684a0919.tar.gz postgresql-cf9b0fea5f6d1bcc9b2c66f5c30ecb04684a0919.zip |
Implement regexp_match(), a simplified alternative to regexp_matches().
regexp_match() is like regexp_matches(), but it disallows the 'g' flag
and in consequence does not need to return a set. Instead, it returns
a simple text array value, or NULL if there's no match. Previously people
usually got that behavior with a sub-select, but this way is considerably
more efficient.
Documentation adjusted so that regexp_match() is presented first and then
regexp_matches() is introduced as a more complicated version. This is
a bit historically revisionist but seems pedagogically better.
Still TODO: extend contrib/citext to support this function.
Emre Hasegeli, reviewed by David Johnston
Discussion: <CAE2gYzy42sna2ME_e3y1KLQ-4UBrB-eVF0SWn8QG39sQSeVhEw@mail.gmail.com>
Diffstat (limited to 'src/include/utils/builtins.h')
-rw-r--r-- | src/include/utils/builtins.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h index a91be981b98..40e25c88247 100644 --- a/src/include/utils/builtins.h +++ b/src/include/utils/builtins.h @@ -628,6 +628,8 @@ extern Datum textregexsubstr(PG_FUNCTION_ARGS); extern Datum textregexreplace_noopt(PG_FUNCTION_ARGS); extern Datum textregexreplace(PG_FUNCTION_ARGS); extern Datum similar_escape(PG_FUNCTION_ARGS); +extern Datum regexp_match(PG_FUNCTION_ARGS); +extern Datum regexp_match_no_flags(PG_FUNCTION_ARGS); extern Datum regexp_matches(PG_FUNCTION_ARGS); extern Datum regexp_matches_no_flags(PG_FUNCTION_ARGS); extern Datum regexp_split_to_table(PG_FUNCTION_ARGS); |