Re: pgpass option is not working with hostaddr parameter

From: Murtuza Zabuawala <murtuza(dot)zabuawala(at)enterprisedb(dot)com>
To: Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>
Cc: Murtuza Zabuawala <m_zabuawala(at)yahoo(dot)com>, "psycopg(at)lists(dot)postgresql(dot)org" <psycopg(at)lists(dot)postgresql(dot)org>
Subject: Re: pgpass option is not working with hostaddr parameter
Date: 2017-11-22 06:05:57
Message-ID: CAKKotZS7K1wGoFp+ZjfCQ8mQB5fqBxX+gm4Gbd-oaRjqTrNJCQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

Hi,

Sorry for the noise, I am able to connect to postgres with hostaddr
parameter.

Earlier I only had
localhost:5432:postgres:postgres:test
in my pgpass file which allowed me to connect to database using host
parameter(value: localhost).

but when I try to use the same file with hostaddr parameter(value:
127.0.0.1) it failed, I assumed that mapping from IP address 127.0.0.1 to
localhost will be done automatically but I was wrong.

Then I added new entry in pgpass file like below and it worked, Now I'm
able to connect with hostaddr parameter as well.
localhost:5432:postgres:postgres:test
127.0.0.1:5432:postgres:postgres:test

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Tue, Nov 21, 2017 at 5:21 PM, Daniele Varrazzo <
daniele(dot)varrazzo(at)gmail(dot)com> wrote:

> On Tue, Nov 21, 2017 at 6:02 AM, Murtuza Zabuawala
> <m_zabuawala(at)yahoo(dot)com> wrote:
> > Hi,
> >
> > I'm trying to connect to postgres database server v.10 using latest
> version
> > of psycopg2(2.7.3.2) + Python3.6.
> >
> > The issue is that if I use pgpass parameter with host parameter in
> > psycopg2's connect() method I'm able to connect to postgres server
> properly
> > but with the same pgpass parameter (as well as pgpass file) and if I use
> the
> > hostaddr parameter instead of host parameter I get error "No pasword
> > supplied"
> >
> > Is it a bug with psycopg2 or libpq?
>
> We should at least know what is in the pgpass file (not necessarily
> the password, of course), and what command line you are trying to
> connect as.
>
> In principle, if you can connect with psql using the same connection
> string, you can connect with psycopg as well.
>
> If there is any bug it is in the libpq because psycopg just passes
> forward the connection string. But I'm pretty sure there is no bug and
> you have something wrong in your config.
>
> -- Daniele
>
>

Attachment Content-Type Size
image/png 61.3 KB
pgpass application/octet-stream 75 bytes
image/png 42.4 KB

In response to

Browse psycopg by date

  From Date Subject
Next Message Israel Brewster 2017-12-05 18:31:32 LISTEN, select/poll question/clarification
Previous Message Daniele Varrazzo 2017-11-21 11:51:55 Re: pgpass option is not working with hostaddr parameter