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

Поиск
Список
Период
Сортировка
От Jeff Janes
Тема Re: WIP patch for Todo Item : Provide fallback_application_name in contrib/pgbench, oid2name, and dblink
Дата
Msg-id CAMkU=1xeLo1E=-x2fkqU58OA-fAAU=yVLQ82T_oY_bBFminyzA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: WIP patch for Todo Item : Provide fallback_application_name in contrib/pgbench, oid2name, and dblink  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: WIP patch for Todo Item : Provide fallback_application_name in contrib/pgbench, oid2name, and dblink  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
On Sun, Feb 9, 2014 at 4:56 PM, Robert Haas <robertmhaas@gmail.com> wrote:
On Sun, Feb 9, 2014 at 6:33 PM, Jeff Janes <jeff.janes@gmail.com> wrote:
>
> 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

OK, that works for me.  I had it completely specified.  Playing with variations on this, I see that the key is pgport.  Set to * it works, set to 5432 it prompts for the password.  (If I specify -p 5432 to pgbench, that would work with the original file)

 
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.

It looks like PQsetdbLogin() has either NULL or empty string passed to it match 5432 in pgpass, while PQconnectdbParams() only has NULL match 5432 and empty string does not.  pgbench uses empty string if no -p is specified.


This make pgbench behave the way I think is correct, but it hardly seems like the right way to fix it.


*** a/contrib/pgbench/pgbench.c
--- b/contrib/pgbench/pgbench.c
*************** doConnect(void)
*** 528,533 ****
--- 528,535 ----

                new_pass = false;

+               if (values[1][0] == 0) values[1]=NULL;
+
                conn = PQconnectdbParams(keywords, values, true);

                if (!conn)


Cheers,

Jeff

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: proposal, patch: allow multiple plpgsql plugins
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: Memory ordering issue in LWLockRelease, WakeupWaiters, WALInsertSlotRelease