Re: [EXTERNAL] Re: Cannot connect local with ttrust (pg_upgrade assumes it)

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: "Abraham, Danny" <danny_abraham(at)bmc(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Francisco Olarte <folarte(at)peoplecall(dot)com>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: [EXTERNAL] Re: Cannot connect local with ttrust (pg_upgrade assumes it)
Date: 2025-04-09 20:45:42
Message-ID: 03a52ff9-6732-4197-bd6c-728eb862098d@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 4/9/25 13:40, Abraham, Danny wrote:
> Thanks again.
>
> 1. No other PG instances on this Linux machine.
> 2. RHEL9
> 3. Our compiled PG which is embedded within our product/site
> 4. I am not aware of an env variable that changes the top down matching
> on pg_hba.conf

From here:

https://www.postgresql.org/docs/current/libpq-envars.html

"The following environment variables can be used to select default
connection parameter values, which will be used by PQconnectdb,
PQsetdbLogin and PQsetdb if no value is directly specified by the
calling code.

PGHOST behaves the same as the host connection parameter.

...
"

So if you have PGHOST set to say localhost it would be added to:

psql -Upostgres

>
> Danny
>
> *From:*David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
> *Sent:* Wednesday, April 9, 2025 10:34 PM
> *To:* Abraham, Danny <danny_abraham(at)bmc(dot)com>
> *Cc:* Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>; Francisco Olarte
> <folarte(at)peoplecall(dot)com>; pgsql-general(at)lists(dot)postgresql(dot)org
> *Subject:* Re: [EXTERNAL] Re: Cannot connect local with ttrust
> (pg_upgrade assumes it)
>
> On Wed, Apr 9, 2025, 12:21 Abraham, Danny <danny_abraham(at)bmc(dot)com
> <mailto:danny_abraham(at)bmc(dot)com>> wrote:
>
> Thanks again.
> Here is the example:
> >>>>>>>>
> dba-tlv-x6y64k% cat pg_hba.conf
> # TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
> local   all         all                               trust
> host    all         all 0.0.0.0/0
> <https://urldefense.com/v3/__http:/0.0.0.0/0__;!!PEZBYkTc!e_x_LCIABYSpqVum5S6Hr0TtEs6P4NaumHqEqyXEa3ErrZTPMmnUeC33JmyNsqr1kGf2DxtZKMbJ_ofkSSjZQC4hsuUN$>                   scram-sha-256
>
> dba-tlv-x6y64k% pg_ctl reload
> server signaled
> dba-tlv-x6y64k% psql -Upostgres
> Password for user postgres:
> psql (17.4)
> Type "help" for help.
>
> ctrlmdb=#
> >>>>>>>
> PSQL should not have asked for the password.
> Thanks
> Danny
>
> Suggests there are environment variables coming into play making
> non-default choices for you.  Namely, making you not use local as the
> connection method.
>
> David J.
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Laurenz Albe 2025-04-09 20:50:00 Re: Interesting case of IMMUTABLE significantly hurting performance
Previous Message Abraham, Danny 2025-04-09 20:40:00 RE: [EXTERNAL] Re: Cannot connect local with ttrust (pg_upgrade assumes it)