add function argument names to regex* functions.

Поиск
Список
Период
Сортировка
От jian he
Тема add function argument names to regex* functions.
Дата
Msg-id CACJufxG3NFKKsh6x4fRLv8h3V-HvN4W5dA=zNKMxsNcDwOKang@mail.gmail.com
обсуждение исходный текст
Ответы Re: add function argument names to regex* functions.
Список pgsql-hackers
Hi.
similar to [1], add function argument names to the following functions:
regexp_like, regexp_match,regexp_matches,regexp_replace,
regexp_substr,regexp_split_to_array,regexp_split_to_table,regexp_count

so I call these function in a different notation[2], like:

SELECT regexp_like(string=>'a'||CHR(10)||'d', pattern=>'a.d', flags:='n');
select regexp_match(string=>'abc',n pattern=>'(B)(c)', flags=>'i');
select regexp_matches(string=>'Programmer', pattern=>'(\w)(.*?\1)',
flags=>'ig');
SELECT regexp_replace(source=>'A PostgreSQL function',
pattern=>'a|e|i|o|u', replacement=>'X', start=>1, n=>4, flags=>'i');
SELECT regexp_substr(string=>'1234567890',
pattern=>'(123)(4(56)(78))', start=>1, n=>1, flags=>'i', subexpr=>4);
SELECT regexp_split_to_array(string=>'thE QUick bROWn FOx jUMPs ovEr
The lazy dOG', pattern=>'e', flags=>'i');

SELECT foo, length(foo)
FROM regexp_split_to_table(string=>'thE QUick bROWn FOx jUMPs ovEr The
lazy dOG', pattern=>'e',flags=>'i') AS foo;
SELECT regexp_count(string=>'ABCABCABCABC', pattern=>'Abc', start=>1,
flags=>'i');

In [3], except the above mentioned function, there is a "substring" function.
I want to refactor substring function argument names. it looks like:
   Schema   |   Name    | Result data type |            Argument data
types             | Type
------------+-----------+------------------+--------------------------------------------+------
 pg_catalog | substring | bit              | bits bit, "from" integer
                 | func
 pg_catalog | substring | bit              | bits bit, "from" integer,
"for" integer    | func
 pg_catalog | substring | bytea            | bytes bytea, "from"
integer                | func
 pg_catalog | substring | bytea            | bytes bytea, "from"
integer, "for" integer | func
 pg_catalog | substring | text             | string text, "from"
integer                | func
 pg_catalog | substring | text             | string text, "from"
integer, "for" integer | func
 pg_catalog | substring | text             | string text, pattern text
                 | func
 pg_catalog | substring | text             | text, text, text
                 | func
(8 rows)

As you can see, the substring function argument names need an explicit
double quote,
which doesn't look good, so I gave up.

[1]https://www.postgresql.org/message-id/flat/877cw3jl8y.fsf@wibble.ilmari.org
[2]https://www.postgresql.org/docs/current/sql-syntax-calling-funcs.html#SQL-SYNTAX-CALLING-FUNCS
[3] https://www.postgresql.org/docs/current/functions-matching.html
Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: David Geier
Дата:
Сообщение: postgres_fdw fails to see that array type belongs to extension
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [PATCH] pg_dump: Do not dump statistics for excluded tables