usability of pg_get_function_arguments - Mailing list pgsql-hackers

From Gevik Babakhani
Subject usability of pg_get_function_arguments
Date
Msg-id 4A1B249D.4000907@xs4all.nl
Whole thread Raw
Responses Re: usability of pg_get_function_arguments  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
I am trying to extract function argument information using the 
pg_get_function_arguments() and it strikes me that despite of this 
function generating very useful information, it is actually not so user 
friendly.

Consider the following:
-------------------------------------------------
create or replace function f13(int=10,varchar='hello',inout complex 
timestamp='01-01-2009'::timestamp,varchar='comma here ,') as
$$
begin
end;
$$
language plpgsql;

where the pg_get_function_arguments generates the following string:

-------------------------------------------------
"integer DEFAULT 10, character varying DEFAULT 'hello'::character 
varying, INOUT complex timestamp without time zone DEFAULT '2009-01-01 
00:00:00'::timestamp without time zone, character varying DEFAULT 'comma 
here ,'::character varying"   (good luck parsing that, I thought)
-------------------------------------------------

In order to make the data above usable, one has to write a custom parser 
to hopefully be able to make any use of the return data. Of course 
another option is to parse the pg_proc.proargdefaults
which in turn is a challenge on its own.

Perhaps it would be much better if pg_get_function_arguments returned 
the data is some kind of a structure than a blob of string like the above.

BTW: The same goes for pg_get_function_identity_arguments.

Any thoughts?

-- 
Regards,
Gevik



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: generic options for explain
Next
From: Robert Haas
Date:
Subject: Re: generic options for explain