Documented parameter names differ from callable proargnames for several built-ins
Documented parameter names differ from callable proargnames for several built-ins
От:
Mi cro <micro6947@gmail.com>
Дата:
Hello,
Several built-in functions are documented with parameter names that differ from
the names registered in pg_proc. PostgreSQL supports named-argument calls, so
these differences directly affect whether the documented call can be used.
For example, on PostgreSQL 16.14:
SELECT parse_ident(str => 'a.b');
-- {a,b}
SELECT parse_ident(qualified_identifier => 'a.b');
-- ERROR: function parse_ident(qualified_identifier => unknown) does not exist
The current REL_18_STABLE documentation uses qualified_identifier/strict_mode,
while pg_proc.dat registers the names as str/strict.
The same class of mismatch appears in:
- make_timestamp and make_timestamptz: documentation uses day;
pg_proc uses mday.
- jsonb_set, jsonb_set_lax, and jsonb_insert: documentation uses
target/new_value; the registered names are jsonb_in/replacement.
- table_to_xml, table_to_xmlschema, and table_to_xml_and_xmlschema:
documentation uses table; pg_proc uses tbl.
- pg_logical_emit_message in PG18: documentation uses content; the SQL-visible
name is message for both overloads.
References:
https://www.postgresql.org/docs/current/sql-syntax-calling-funcs.html
https://github.com/postgres/postgres/blob/REL_18_STABLE/doc/src/sgml/func.sgml
https://github.com/postgres/postgres/blob/REL_18_STABLE/src/include/catalog/pg_proc.dat
https://github.com/postgres/postgres/blob/REL_18_STABLE/src/backend/catalog/system_functions.sql
I suggest updating the displayed names to the SQL-visible parameter names.
Renaming the runtime parameters would change named-call compatibility.
Regards
Re: Documented parameter names differ from callable proargnames for several built-ins
On Sat, Oct 31, 2026 at 6:50 PM Mi cro wrote: > I suggest updating the displayed names to the SQL-visible parameter names. > Renaming the runtime parameters would change named-call compatibility. Thanks for the report and suggestion! I also found the same issue in pg_input_error_info(), ts_parse(), and ts_stat(). The attached patch fixes the reported issue and updates these three functions as well. Regards, -- Fujii Masao
Re: Documented parameter names differ from callable proargnames for several built-ins
От:
Matemática A3K <matematica.a3k@gmail.com>
Дата:
I came across named parameters in an example of the pattern matching chapter. I thought it was just an example but it turns out that it is supported. To inspect if each function parameter is documented correctly for each function of each supported release seems like a gargantuan task to be done. Perhaps a note in somewhere that says "named parameters in functions are supported but may not be up to date, using positional arguments is the recommended way for function calling"? On Sun, Nov 1, 2026 at 2:51 PM Fujii Masao wrote: > > On Sat, Oct 31, 2026 at 6:50 PM Mi cro wrote: > > I suggest updating the displayed names to the SQL-visible parameter names. > > Renaming the runtime parameters would change named-call compatibility. > > Thanks for the report and suggestion! > > I also found the same issue in pg_input_error_info(), ts_parse(), and ts_stat(). > The attached patch fixes the reported issue and updates these three functions > as well. > > Regards, > > -- > Fujii Masao
Re: Documented parameter names differ from callable proargnames for several built-ins
От:
"David G. Johnston" <david.g.johnston@gmail.com>
Дата:
On Mon, Nov 2, 2026 at 8:47 PM Matemática A3K <matematica.a3k@gmail.com> wrote:
To inspect if each function parameter is documented correctly for each
function of each supported release seems like a gargantuan task to be
done.
We're pretty good about sgml markup in this area, it doesn't seem that hard to build a deterministic detection system if someone wants to try. I'd make it require an installed instance and use the catalog as the authoritative dataset.
Perhaps a note in somewhere that says "named parameters in functions
are supported but may not be up to date, using positional arguments is
the recommended way for function calling"?
I don't think we actually recommend that. Telling people how to find the names of function parameters should they wish to use them and the docs aren't correct would be helpful though. For procedure-like functions/procedures I'd say named arguments are recommended.
David J.
Re: Documented parameter names differ from callable proargnames for several built-ins
От:
Matemática A3K <matematica.a3k@gmail.com>
Дата:
On Tue, Nov 3, 2026 at 1:16 AM David G. Johnston wrote: > > On Mon, Nov 2, 2026 at 8:47 PM Matemática A3K wrote: >> >> To inspect if each function parameter is documented correctly for each >> function of each supported release seems like a gargantuan task to be >> done. > > > We're pretty good about sgml markup in this area, it doesn't seem that hard to build a deterministic detection system if someone wants to try. I'd make it require an installed instance and use the catalog as the authoritative dataset. I can'f figure that code in my mind, only manual checking, it would be nice to see the code that automates it. > >> >> Perhaps a note in somewhere that says "named parameters in functions >> are supported but may not be up to date, using positional arguments is >> the recommended way for function calling"? >> > > I don't think we actually recommend that. Telling people how to find the names of function parameters should they wish to use them and the docs aren't correct would be helpful though. For procedure-like functions/procedures I'd say named arguments are recommended. The feature works (calling a function with named arguments), it can't be used if the names documented doesn't match those defined in the code or the catalog. Stating this as caveat isn't neccesary if the correspondence is ensured. The patches attached go in this sense, so they should be accepted. If someone can provide the code you mentioned, then there wouldn't be anything more to be fixed here (besides the mismatches that code may find). > > David J. >
Re: Documented parameter names differ from callable proargnames for several built-ins
От:
Fujii Masao <masao.fujii@gmail.com>
Дата:
On Mon, Nov 2, 2026 at 2:50 AM Fujii Masao wrote: > I also found the same issue in pg_input_error_info(), ts_parse(), and ts_stat(). > The attached patch fixes the reported issue and updates these three functions > as well. I've pushed the patch. Thanks! Regards, -- Fujii Masao