dblink password required

From: Oliver Kohll - Mailing Lists <oliver(dot)lists(at)agilebase(dot)co(dot)uk>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: dblink password required
Date: 2014-10-24 16:30:35
Message-ID: BE2E6D5C-B509-419E-A4A5-78390A2D1018@agilebase.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I’m trying to use dblink to connect from database1 to database2 on the same machine. The Postgres version is 9.3.5.

Firstly, I’ve created a user to use with the connection, while logged in as the postgres superuser to database2:

> create user db_link with password ‘mypassword’;
> grant select on appuser to db_link;

Secondly, the following has been added to pg_hba.conf and a restart done.

# dblink between database1 and database2
local database2 db_link md5
host database2 db_link 127.0.0.1/32 md5
host database2 db_link ::1/128 md5

Connecting with PSQL prompts for a password as expected:

> psql -U db_link -d database2
Password for user db_link:
psql (9.3.5)
Type "help" for help.

Then, as a normal user logged into database1, I tried

> select * from dblink(‘dbname=database2 username=db_link password=mypassword','select username, email from appuser') as t1(username text, email text);

However this returns

ERROR: password is required
DETAIL: Non-superusers must provide a password in the connection string.

This is my first time trying dblink so there’s probably something simple I’m missing, but I thought I had provided a password. Any ideas?

Regards
Oliver Kohll

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G Johnston 2014-10-24 18:02:59 Re: Finding date intersections
Previous Message twoflower 2014-10-24 16:13:34 Re: Emulating flexible regex replace