Re: Function argument names in pg_catalog

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Mike Toews <mwtoews(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Function argument names in pg_catalog
Date: 2011-07-19 17:35:59
Message-ID: 1311096621-sup-7316@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Excerpts from Mike Toews's message of mar jul 19 07:23:24 -0400 2011:
> Hi hackers,
>
> I'm curios why argument names (argname) are not used in the DDL for
> functions in pg_catalog, while they are are used throughout the
> documentation. For example, the documentation for pg_read_file in
> Table 9-60[1] has an "SQL prototype":
> pg_read_file(filename text, offset bigint, length bigint)
>
> then why isn't the DDL for the function instead something like:
>
> CREATE OR REPLACE FUNCTION
> public.pg_read_file(filename text, "offset" bigint, length bigint)
> RETURNS text AS 'pg_read_file'
> LANGUAGE internal VOLATILE STRICT COST 1;

Probably mostly historical. We only got argument names (useful argument
names) recently.

> Apologies for my ignorance on how the DDL for functions in pg_catalog
> are defined. I can only assume they are generated from their internal
> C functions, as I can't find a pg_catalog.sql file in the source.

They are generated from pg_proc.h. I think we only have argument names
for functions that have OUT arguments. See the pg_stat_file entry for
an example.

I'm not sure how open we are to adding names to more builtin functions.
If catalog bloat is the only problem it'd cause, my guess is that it
should be OK. I know that I have personally been bitten by not having
argument names in builtin functions; they are pretty good "run-time"
documentation.

--
Álvaro Herrera <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2011-07-19 17:49:53 Re: FOR KEY LOCK foreign keys
Previous Message Bruce Momjian 2011-07-19 17:25:54 Re: pg_upgrade and log file output on Windows