Get list of all foreign key constraints.

Here is the way i do this -

SELECT conname,
       t.relname AS TABLE,
       tf.relname AS ftable,
       a.attname AS field,
       af.attname AS ffield
FROM pg_constraint c,
     pg_attribute a,
                   pg_attribute af,
                   pg_stat_user_tables t,
                   pg_stat_user_tables tf
WHERE c.contype='f'
  AND c.conkey[1]=a.attnum
  AND c.conrelid=a.attrelid
  AND c.confkey[1]=af.attnum
  AND c.confrelid=af.attrelid
  AND t.relid=c.conrelid
  AND tf.relid=c.confrelid