    plpq functions can be used to acess another database from  PL/pgSQL.
All functions are just wrapers around libpq - C Library.
For more information about libpq see: 
http://www.us.postgresql.org/users-lounge/docs/7.3/postgres/libpq.html

    See the pqtest.sql in this directory for example usage.