Suresh Kumar R <suresh.arsenal29@gmail.com> writes:
> I needed this because, I use postgres backend along with golang using
> pgx driver. When i query address i need to specify OID of
> address[](composite type). In my case i couldnt find the oid of that type
> since its dynamic.
The usual advice is to look it up on the fly. As an example:
regression=# create type address as (f1 text, f2 text);
CREATE TYPE
regression=# select 'address[]'::regtype;
regtype
-----------
address[]
(1 row)
regression=# select 'address[]'::regtype::oid;
oid
--------
127056
(1 row)
If the client-side stack wants a type OID for a result column,
it's unlikely to be satisfied with a pseudotype OID anyway.
That provides next-to-no useful information about how to
interpret values. Are you sure you can't just leave the type
unspecified (e.g. zero) in whatever API is giving you trouble?
regards, tom lane