Re: builtin functions, parameter names and psql's \df - Mailing list pgsql-hackers

From Tom Lane
Subject Re: builtin functions, parameter names and psql's \df
Date
Msg-id 328356.1599058876@sss.pgh.pa.us
Whole thread Raw
In response to Re: builtin functions, parameter names and psql's \df  (Oleksandr Shulgin <oleksandr.shulgin@zalando.de>)
Responses Re: builtin functions, parameter names and psql's \df  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
Oleksandr Shulgin <oleksandr.shulgin@zalando.de> writes:
> On Wed, Sep 2, 2020 at 7:35 AM Andres Freund <andres@anarazel.de> wrote:
>> In the docs we already name the parameters using SQL like syntax, see [1].
>> How about we actually do so for at least the more common / complicated
>> functions?

> I find myself in the same situation a lot.
> I've never realized that's an implementation detail and not something
> fundamental preventing the parameters from being named in the built-in
> functions.

Yeah, it's not really hard to fix; somebody just has to do the legwork.
The attached is enough to get me to

regression=# \df regexp_split_to_table
                                          List of functions
   Schema   |         Name          | Result data type |          Argument data types          | Type
------------+-----------------------+------------------+---------------------------------------+------
 pg_catalog | regexp_split_to_table | SETOF text       | string text, pattern text             | func
 pg_catalog | regexp_split_to_table | SETOF text       | string text, pattern text, flags text | func
(2 rows)

I don't think we should go overboard on this, but +1 for labeling all the
cases where the usage isn't obvious.

            regards, tom lane

diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat
index 1dd325e0e6..ecf1299ef3 100644
--- a/src/include/catalog/pg_proc.dat
+++ b/src/include/catalog/pg_proc.dat
@@ -3551,10 +3551,12 @@
 { oid => '2765', descr => 'split string by pattern',
   proname => 'regexp_split_to_table', prorows => '1000', proretset => 't',
   prorettype => 'text', proargtypes => 'text text',
+  proargnames => '{string,pattern}',
   prosrc => 'regexp_split_to_table_no_flags' },
 { oid => '2766', descr => 'split string by pattern',
   proname => 'regexp_split_to_table', prorows => '1000', proretset => 't',
   prorettype => 'text', proargtypes => 'text text text',
+  proargnames => '{string,pattern,flags}',
   prosrc => 'regexp_split_to_table' },
 { oid => '2767', descr => 'split string by pattern',
   proname => 'regexp_split_to_array', prorettype => '_text',

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: describe-config issue
Next
From: Pavel Borisov
Date:
Subject: Re: [PATCH] Covering SPGiST index