Postgres: 'role does not exist' using dblink, but it does
So this is super strange. I'm trying to do a simple select using dblink as
such:
SELECT * FROM dblink('dbname=my_db_name, user=my_user, password=password,
hostaddr=127.0.0.1', 'SELECT action, object, created_at, id FROM
my_table') AS de(ACTION VARCHAR, OBJECT VARCHAR, created_at TIMESTAMP, id
INT)
And I immediately am getting an error message of:
PG::SqlclientUnableToEstablishSqlconnection: ERROR: could not
establish connection DETAIL: FATAL: role "my_user," does not exist
But if I connect to psql locally and print out the list of users using \du
you'll see it's listed:
List of roles
Role name | Attributes | Member of
---------------+------------------------------------------------+-----------
MyName | Superuser, Create role, Create DB, Replication | {}
my_user | Create DB | {}
I'm really at a loss as to how to fix this, googling hasn't helped me much
at all either. Any thoughts as to why it's giving me this error message?
When I connect using my superuser account I don't need to specify a
password and the dblink runs fine, so I'm quite confused. Here is by
pg_hba.conf:
local all all trust
local all all md5
host all all 192.168.33.1/24 trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
host all all 127.0.0.1/32 md5
# IPv6 local connections:
host all all ::1/128 trust
host all all ::1/128 md5
Thanks in advance!
No comments:
Post a Comment