I know this is not new, but I have not found a solution, even though I have followed several posts in this forum.
I'm trying to show table from different database using dblink
extension.
Installing dblink
using :
CREATE EXTENSION dblink
And run successfully. In db1
then I try querying, like:
SELECT *
FROM dblink('dbname=db_name2 port=5432
host=xx.xx.x.x user=username_db2 password=password_db2',
'SELECT * FROM tableFrom_Db2');
I always get notice like this:
ERROR: a column definition list is required for functions returning "record"
When I try replace SELECT *
with a list of columns, I get:
ERROR: invalid input syntax for type boolean: "SELECT column FROM tableFrom_Db2"
To make sure that the connection is going well, I tried
SELECT dblink_connect('host=xx.xx.x.x user=username_db2 password=password_db2 dbname=db_name2');
And I get notice like :
ERROR: could not establish connection
DETAIL: FATAL: no pg_hba.conf entry for host "IP_db1", user "username_db2", database "db_name2", SSL on
FATAL: no pg_hba.conf entry for host "IP_db1", user "username_db2", database "db_name2", SSL off
By the way What's wrong?