From: | Gevik Babakhani <pgdev(at)xs4all(dot)nl> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | usability of pg_get_function_arguments |
Date: | 2009-05-25 23:07:09 |
Message-ID: | 4A1B249D.4000907@xs4all.nl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2009-05-25 23:33:19 | Re: generic options for explain |
Previous Message | Tom Lane | 2009-05-25 22:32:57 | Re: generic options for explain |