Re: Query function arg data types ONLY (no arg names)

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Jeremy Finzel <finzelj(at)gmail(dot)com>
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Query function arg data types ONLY (no arg names)
Date: 2018-04-28 17:00:36
Message-ID: CAFj8pRCBCxOV+cWGnZavChLTfnbE-FOcRrfkHrqU_MVBP7NcwA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi

2018-04-28 18:52 GMT+02:00 Jeremy Finzel <finzelj(at)gmail(dot)com>:

> It appears that neither pg_get_function_arguments
> nor pg_get_function_identity_arguments could be used for this. I want to
> get function argument data types from the catalog by ordinal position,
> without the argument name.
>
> For example, I want the same information for these 2 functions:
>
> foo(p_1 int, p_2 text)
>
> - {int, text}
>
> foo(int, text)
>
> - {int, text}
>
> Any suggestions as to how to use the catalogs or built-in postgres
> functions to query this?
>

CREATE OR REPLACE FUNCTION public.foo(a integer, b integer, c text)
RETURNS text
LANGUAGE sql
AS $function$ select 'hi'; $function$

postgres=# select (proargtypes::regtype[])[0:] from pg_proc where proname =
'foo';
┌─[ RECORD 1 ]┬────────────────────────┐
│ proargtypes │ {integer,integer,text} │
└─────────────┴────────────────────────┘

Regards

Pavel

> Thank you!
> Jeremy
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2018-04-28 17:03:21 Re: Query function arg data types ONLY (no arg names)
Previous Message Jeremy Finzel 2018-04-28 16:52:03 Query function arg data types ONLY (no arg names)