Re: WIP patch for Todo Item : Provide fallback_application_name in contrib/pgbench, oid2name, and dblink

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila(at)huawei(dot)com>, Shigeru HANADA <shigeru(dot)hanada(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: WIP patch for Todo Item : Provide fallback_application_name in contrib/pgbench, oid2name, and dblink
Date: 2014-02-10 00:56:28
Message-ID: CA+Tgmob+q=6QRPXt8mYqiwb90SaHy+SMbsW7LrTZvoXuvKgvmg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Feb 9, 2014 at 6:33 PM, Jeff Janes <jeff(dot)janes(at)gmail(dot)com> wrote:
> On Wed, Jul 4, 2012 at 12:41 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>> On Tue, Jul 3, 2012 at 11:36 PM, Amit Kapila <amit(dot)kapila(at)huawei(dot)com>
>> wrote:
>> > Hi Shigeru/Robert,
>> >
>> >> The way fixing oid2name and pgbench seems reasonable, so applying it to
>> >> vacuumlo (as Peter mentioned) would be enough for this issue.
>> >
>> > Shall I consider following 2 points to update the patch:
>> > 1. Apply changes similar to pgbench and oid2name for vacuumlo
>> > 2. Remove the modifications for dblink.
>>
>> I've done these two things and committed this. Along the way, I also
>> fixed it to use a stack-allocated array instead of using malloc, since
>> there's no need to malloc a fixed-size array with 7 elements.
>>
>> Thanks for the patch.
>
> Since this commit (17676c785a95b2598c573), pgbench no longer uses .pgpass to
> obtain passwords, but instead prompts for a password
>
> This problem is in 9.3 and 9.4dev
>
> According to strace, it is reading the .pgpass file, it just seem like it is
> not using it.

Hmm. I tried pgbench with the following .pgpass file and it worked
OK. Removing the file caused pgbench to prompt for a password.

*:*:*:*:foo

Presumably whatever behavior difference you are seeing is somehow
related to the use of PQconnectdbParams() rather than PQsetdbLogin(),
but the fine manual does not appear to document a different between
those functions as regards password-prompting behavior or .pgpass
usage. My guess is that it's getting as far as PasswordFromFile() and
then judging whatever entry you have in the file not to match the
connection attempt. If you're correct about this commit being to
blame, then my guess is that one of hostname, port, dbname, and
username must end up initialized differently when PQconnectdbParams()
rather than PQsetdbLogin() is used...

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2014-02-10 01:06:07 Re: Breaking compile-time dependency cycles of Postgres subdirs?
Previous Message Jeff Janes 2014-02-09 23:33:50 Re: WIP patch for Todo Item : Provide fallback_application_name in contrib/pgbench, oid2name, and dblink