Re: PATCH: pgagent connection string parsing - Mailing list pgadmin-hackers

From Thomas Krennwallner
Subject Re: PATCH: pgagent connection string parsing
Date
Msg-id 20170821052203.GD23580@postsubmeta.net
Whole thread Raw
In response to Re: PATCH: pgagent connection string parsing  (Ashesh Vashi <ashesh.vashi@enterprisedb.com>)
Responses Re: PATCH: pgagent connection string parsing  (Ashesh Vashi <ashesh.vashi@enterprisedb.com>)
List pgadmin-hackers
On Mon Aug 21, 2017 06:50:03AM +0530, Ashesh Vashi wrote:
>    On Aug 20, 2017 22:48, "Thomas Krennwallner" <[1]tk+pgsql@postsubmeta.net>
>    wrote:
> 
>      % ./pgagent -f -t60 -l2  dbname=xxx user=tkren connection_timeout=5
[...]
>      Sun Aug 20 18:24:34 2017 : DEBUG: Creating DB connection: user=tkren connection_timeout=5 dbname=xxx
>      Sun Aug 20 18:24:34 2017 : WARNING: Couldn't create the primary connection (attempt 1): invalid connection
option"connection_timeout"
 
> 
>    This suggests pgAgent is not using the latest version of libpq.
>    Please use LD_LIBRARY_PATH environment to inform pgAgent to use the libpq,
>    it is compiled with.
>    -- Thanks,
>    Ashesh Vashi
>    -- Thanks, Ashesh

Unfortunately, this does not work. On a current Debian sid system,
I've compiled pgagent from source and get
% ldd ./pgagent[...]    libpq.so.5 => /usr/lib/x86_64-linux-gnu/libpq.so.5 (0x00007ff531382000)[...]


The system has libpq 9.6.4 installed:
% apt-cache show libpq5Package: libpq5Source: postgresql-9.6Version: 9.6.4-1[...]


If I run pgagent from the Debian package (same ldd linkage), I get the
same error:
% /usr/bin/pgagent -f -t60 -l2  dbname=xxx user=tkren connection_timeout=5[...]Mon Aug 21 06:51:04 2017 : DEBUG:
CreatingDB connection: user=tkren connection_timeout=5 dbname=xxxMon Aug 21 06:51:04 2017 : WARNING: Couldn't create
theprimary connection (attempt 1): invalid connection option "connection_timeout"[...]
 


But I don't get why connection_timeout should work at all, the
libpq documentation 
https://www.postgresql.org/docs/9.6/static/libpq-connect.html#LIBPQ-CONNECT-CONNECT-TIMEOUT
states that the keyword is
connect_timeout
    Maximum wait for connection, in seconds (write as a decimal    integer string). Zero or not specified means wait
indefinitely.It    is not recommended to use a timeout of less than 2 seconds.
 


libpq.so seems to only mention connect_timeout:
% strings /usr/lib/x86_64-linux-gnu/libpq.so.5  | egrep 'connect(ion)?_timeout'connect_timeout


The libpq source implements it in src/interfaces/libpq/fe-connect.c,
but after a quick check I didn't see a special treatment for
connection_timeout:
    {"connect_timeout", "PGCONNECT_TIMEOUT", NULL, NULL,        "Connect-timeout", "", 10,    /* strlen(INT32_MAX) ==
10*/    offsetof(struct pg_conn, connect_timeout)},
 


And psql dislikes connection_timeout as well:
% psql 'dbname=xxx user=tkren connection_timeout=5'psql: invalid connection option "connection_timeout"
% psql 'dbname=xxx user=tkren connect_timeout=5'psql (9.6.4)Type "help" for help.
xxx=#


TK


pgadmin-hackers by date:

Previous
From: Ashesh Vashi
Date:
Subject: Re: PATCH: pgagent connection string parsing
Next
From: Ashesh Vashi
Date:
Subject: Re: PATCH: pgagent connection string parsing