Re: Libpq functions & string to obtain connection parameters

From: arnaud gaboury <arnaud(dot)gaboury(at)gmail(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Libpq functions & string to obtain connection parameters
Date: 2016-10-07 14:28:51
Message-ID: CAK1hC9vMYkDYv5VK8fHmHDCJADA6d-h5HQVwAL31jk4WsmQexw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Oct 7, 2016 at 3:56 PM Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
wrote:

> On 10/07/2016 06:42 AM, arnaud gaboury wrote:
> >
> >
>
> >
> > Honestly not so much, as it is a nearly perfect Copy/past of postgresql
> > official doc[0].
> > My postgresql socket is in the usual place:
> > /run/postgresql/.s.PGSQL.5432=
> > So no need to specify it. But for the rest, I am still not sure of my URI
> >
> > [0]https://www.postgresql.org/docs/9.5/static/libpq-connect.html
> >
> >
>
> Aah, just remembered you wanted username and password, so:
>
> psql postgresql://aklaver:pwd@/test?connect_timeout=10
>

It helps, but I must have something else misconfigured then:

-------------------------------------
# su postgres
postgres(at)thetradinghall ➤➤ mattermost/bin % bash
bash-4.3$ psql postgresql:///mattermost?connect_timeout=10
psql (9.5.4)
Type "help" for help.

mattermost=# \q
=====> OK
-----------------------------------------
Now with the Unix user I want to use:

--------------------------------------------------------
% su mattermost
bash-4.3$ psql postgresql:///mattermost?connect_timeout=10
psql: FATAL: no pg_hba.conf entry for host "[local]", user "mattermost",
database "mattermost", SSL off
--------------------------------------------

As a reminder, I made an entry in pg_ident.conf this way:
mattermap mattermost mmuser

and add this line in pg_hba.conf
local mattermost mmuser peer
map=mattermap

What is wromg in my UNIX/postgresql user mapping?

> 4408 pts/1 S+ 0:00 psql postgresql://aklaver:pwd@
> /test?connect_timeout=10
> 4409 ? Ss 0:00 postgres: aklaver test [local] idle
>
>
> --
> Adrian Klaver
> adrian(dot)klaver(at)aklaver(dot)com
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2016-10-07 14:42:20 Re: Libpq functions & string to obtain connection parameters
Previous Message Adrian Klaver 2016-10-07 13:56:18 Re: Libpq functions & string to obtain connection parameters