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

From: Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>
To: Michael Paquier <michael(dot)paquier(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 11:10:59
Message-ID: CAJrrPGcZDq-ts3Yx8SyRvKY5s+MTzDmXCL5WM3OQU56fvCcQSA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Mon, Nov 2, 2015 at 6:53 PM, Michael Paquier
<michael(dot)paquier(at)gmail(dot)com> wrote:
> 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.

Thanks for adding the patch to commitfest.

> 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.

Thanks for the review.
Here I attached modified patch that gets the password from parent connection
if exists and use it for the child connection also.

Regards,
Hari Babu
Fujitsu Australia

Attachment Content-Type Size
reuse_password_for_vacuum_db_v3.patch application/octet-stream 10.0 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2015-11-02 13:04:50 Re: BUG #13741: vacuumdb does not accept valid password
Previous Message Michael Paquier 2015-11-02 07:53:44 Re: BUG #13741: vacuumdb does not accept valid password

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2015-11-02 11:32:28 Re: WIP: Access method extendability
Previous Message Marko Tiikkaja 2015-11-02 10:59:55 Re: onlyvalue aggregate (was: First Aggregate Funtion?)