Thread: pgAdmin does not respect pgpass.conf when opening .sql files?

pgAdmin does not respect pgpass.conf when opening .sql files?

From
Mark Zhitomirski
Date:
Hi!
pgAdmin 1.10.0 on Windows XP
PostgreSQL 8.3.3 on the same machine (localhost:5432)

When I'm opening some .sql file (in Windows Explorer) pgAdmin starts and presents dialog "Connect to Server"
with lines Server, Database and Username
I fill those lines and press "OK"
dialog asks for password. (Question 1 - Why? it has it saved already, most probably in pgpass.conf) Then "Query" window appears. I'm done working with that .sql file and close pgAdmin.

When I'm opening another .sql file lines Server, Database and Username has my previous input. Password prompt happens again. Question 2 - is it possible to avoid this prompt?

Thanks
-- Mark

Re: pgAdmin does not respect pgpass.conf when opening .sql files?

From
Dave Page
Date:
On Wed, Oct 21, 2009 at 5:42 PM, Mark Zhitomirski <zhmark@yahoo.com> wrote:
> Hi!
> pgAdmin 1.10.0 on Windows XP
> PostgreSQL 8.3.3 on the same machine (localhost:5432)
>
> When I'm opening some .sql file (in Windows Explorer) pgAdmin starts and
> presents dialog "Connect to Server"
> with lines Server, Database and Username
> I fill those lines and press "OK"
> dialog asks for password. (Question 1 - Why? it has it saved already, most
> probably in pgpass.conf) Then "Query" window appears. I'm done working with
> that .sql file and close pgAdmin.

Are you sure the saved password has the same hostname/ip etc? (eg.
127.0.0.1 vs. 192.168.1.57 or whatever your primary interface uses).
FYI, the saved password is used when I test here - I don't get a
password prompt.

> When I'm opening another .sql file lines Server, Database and Username has
> my previous input. Password prompt happens again. Question 2 - is it
> possible to avoid this prompt?

Well, you could associate the file type with a script which launches
pgAdmin with '-qc <connect string> -f $1' (modified appropriately for
whatever operating system you use).


-- 
Dave Page
EnterpriseDB UK: http://www.enterprisedb.com
PGDay.EU 2009 Conference: http://2009.pgday.eu/start


SOLVED: pgAdmin does respect pgpass.conf when opening .sql files

From
Mark Zhitomirski
Date:
Thanks, Dave,

the problem was caused by me choosing arbitrary name for "server" in Servers tree in Object browser - browser had no problem opening it so I concluded erroneously that host/IP is what matters in pgpass.conf.  Once  I've renamed "server" to 'localhost' problem has gone.

--MZ


From: Dave Page <dpage@pgadmin.org>
To: Mark Zhitomirski <zhmark@yahoo.com>
Cc: pgadmin-support@postgresql.org
Sent: Thu, October 22, 2009 12:28:11 PM
Subject: Re: [pgadmin-support] pgAdmin does not respect pgpass.conf when opening .sql files?

On Wed, Oct 21, 2009 at 5:42 PM, Mark Zhitomirski <zhmark@yahoo.com> wrote:
> Hi!
> pgAdmin 1.10.0 on Windows XP
> PostgreSQL 8.3.3 on the same machine (localhost:5432)
>
> When I'm opening some .sql file (in Windows Explorer) pgAdmin starts and
> presents dialog "Connect to Server"
> with lines Server, Database and Username
> I fill those lines and press "OK"
> dialog asks for password. (Question 1 - Why? it has it saved already, most
> probably in pgpass.conf) Then "Query" window appears. I'm done working with
> that .sql file and close pgAdmin.

Are you sure the saved password has the same hostname/ip etc? (eg.
127.0.0.1 vs. 192.168.1.57 or whatever your primary interface uses).
FYI, the saved password is used when I test here - I don't get a
password prompt.

> When I'm opening another .sql file lines Server, Database and Username has
> my previous input. Password prompt happens again. Question 2 - is it
> possible to avoid this prompt?

Well, you could associate the file type with a script which launches
pgAdmin with '-qc <connect string> -f $1' (modified appropriately for
whatever operating system you use).


--
Dave Page
EnterpriseDB UK: http://www.enterprisedb.com
PGDay.EU 2009 Conference: http://2009.pgday.eu/start