Re: BUG #13741: vacuumdb does not accept valid password

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>
Cc: brown(at)fastmail(dot)com, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #13741: vacuumdb does not accept valid password
Date: 2015-11-02 07:53:44
Message-ID: CAB7nPqR8h98JM-k0NM-DPpf=zrBDjtg4-poqr0ppwiX4pS7sVw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Mon, Nov 2, 2015 at 3:56 PM, Michael Paquier
<michael(dot)paquier(at)gmail(dot)com> wrote:
> On Thu, Oct 29, 2015 at 9:13 AM, Haribabu Kommi
> <kommi(dot)haribabu(at)gmail(dot)com> wrote:
>> On Wed, Oct 28, 2015 at 4:07 PM, Haribabu Kommi
>> <kommi(dot)haribabu(at)gmail(dot)com> wrote:
>>> Here I attached a patch that saves the password provided by the user
>>> from the connectDatabase function and reuse it for connecting all clients
>>> to the same database.
>>
>> Attached a wrong patch, it is having some compilation problems,
>> Here is the new version with the fixed problems.
>
> I have added an entry in this CF:
> https://commitfest.postgresql.org/7/417/
> Let's not lose track of this patch.

Regarding this patch, wouldn't it be clearer to pass the password as a
variable of connectDatabase()? Then we could use NULL at the first
call of connectDatabase so as we enforce the prompt if requested by
the user. For successive calls of connectDatabase for each worker, we
then fetch the password from the parent connection using that:
if (PQconnectionUsedPassword(con))
password = PQpass(conn);
And pass it as an argument of connectDatabase. In short, I think that
this approach would make a more portable routine because one could
enforce a password at the first call of connectDatabase() without
having to save it once.
--
Michael

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Haribabu Kommi 2015-11-02 11:10:59 Re: BUG #13741: vacuumdb does not accept valid password
Previous Message Jeff Janes 2015-11-02 07:34:35 Re: Re: BUG #13685: Archiving while idle every archive_timeout with wal_level hot_standby

Browse pgsql-hackers by date

  From Date Subject
Next Message Dean Rasheed 2015-11-02 08:32:30 Re: onlyvalue aggregate (was: First Aggregate Funtion?)
Previous Message Jeff Janes 2015-11-02 07:34:35 Re: Re: BUG #13685: Archiving while idle every archive_timeout with wal_level hot_standby