Query to Postgresql type casting information:
source_type | target_type | proname | castcontext | castmethod
---------------+---------------+-------------+-------------+------------
int8 | int2 | int2 | a | f
int8 | int4 | int4 | a | f
int8 | float4 | float4 | i | f
int8 | float8 | float8 | i | f
int8 | numeric | numeric | i | f
int2 | int8 | int8 | i | f
int2 | int4 | int4 | i | f
int2 | float4 | float4 | i | f
int2 | float8 | float8 | i | f
int2 | numeric | numeric | i | f
int4 | int8 | int8 | i | f
...
(143 rows)
The details of pg_cast is available at
http://www.postgresql.org/docs/9.2/static/catalog-pg-cast.html
SELECT ct.*,
source_t.typname as source_type
,target_t.typname as target_type
, proc.proname
FROM
pg_cast as ct
, pg_type as source_t
, pg_type as target_t
,pg_proc as proc
WHERE
ct.castsource = source_t.oid
and ct.casttarget = target_t.oid
and ct.castfunc = proc.oid
source_type | target_type | proname | castcontext | castmethod
---------------+---------------+-------------+-------------+------------
int8 | int2 | int2 | a | f
int8 | int4 | int4 | a | f
int8 | float4 | float4 | i | f
int8 | float8 | float8 | i | f
int8 | numeric | numeric | i | f
int2 | int8 | int8 | i | f
int2 | int4 | int4 | i | f
int2 | float4 | float4 | i | f
int2 | float8 | float8 | i | f
int2 | numeric | numeric | i | f
int4 | int8 | int8 | i | f
...
(143 rows)
The details of pg_cast is available at
http://www.postgresql.org/docs/9.2/static/catalog-pg-cast.html