If you are using linux as platform for the database server
dblink is the solution for cross database query
dblink.sql file resides in the path /usr/share/postgresql/version_no(8.4)/contrib
goto the above path and run
sudo -u postgres psql -d db_name -dblink.sql
For more Info on dblink queries you can visit
http://www.postgresonline.com/journal/index.php?/archives/44-Using-DbLink-to-access-other-PostgreSQL-Databases-and-Servers.html