Is it possible to find out if an argument in a function in postgres was defined as
table.column%type foo
or
sometype foo
querying e.g. pg_proc?
Is it possible to find out if an argument in a function in postgres was defined as
table.column%type foo
or
sometype foo
querying e.g. pg_proc?
The proargtypes
column in pg_proc
is an array of the types of all the function's arguments. Each type can then be cross-referenced to pg_type.oid
.
So if I define a function like this:
steve@steve@[local] =# create function testfunc(pg_proc.proname%type) returns boolean language 'sql' immutable strict as $$ select true $$;
NOTICE: type reference pg_proc.proname%TYPE converted to name
CREATE FUNCTION
Well, that notice isn't too hopeful.
The pg_proc entry for that function is:
proname | proargtypes
----------+-------------
testfunc | 19
and type 19 is just "name". so it looks like the answer here is "no", I'm afraid.