This is a really straightforward task. Just use dblink for this purpose:
INSERT INTO t(a, b, c)
SELECT a, b, c FROM dblink('host=xxx user=xxx password=xxx dbname=xxx', 'SELECT a, b, c FROM t') AS x(a integer, b integer, c integer)
If you need to fetch data from external database on a regular basis, it would be wise to define a server and user mapping. Then, you could use shorter statement:
dblink('yourdbname', 'your query')
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…