I have some problem with using dblink_connect_u() while making a connection using a .pgpass file.
select * from gis.dblink_connect_u('conn'||'X123','dbname='||'pgdb');
ERROR: could not establish connection
DETAIL: fe_sendauth: no password supplied
The .pgpass file is under postgres user home (home/postgres/.pgpass) and has 0600 permission and postgres group.
I am able to connect with the ./pgpass file without using a user password.
:/opt/PostgreSQL-14/bin$ ./psql -d postgres -U postgres
psql (14.6)
Type "help" for help.
postgres=#
pg_hba.conf have the following entry:
host all all 127.0.0.1/32 md5
.pgpass have :
*:5432:*:postgres:2WSX#E86qrfv
I tried with the below (localhost and 127.0.0.1 and IP) also but no success.
localhost:5432:*:postgres:2WSX#E86qrfv
127..0.0.1:5432:*:postgres:2WSX#E86qrfv
110.24.30.100:5432:*:postgres:2WSX#E86qrfv
When I provide the password in the connection string, there is no problem, but when I don’t, it says:
select * from gis.dblink_connect_u('conn'||'X123','dbname='||'gisdb');
ERROR: could not establish connection
DETAIL: fe_sendauth: no password supplied
My Postgres server is running on Ubuntu, version 18.04.1 with PostgreSQL 14.6
Thanks,