[ADMIN] confusing .pgpass behaviour for undocumented replication=trueconnection parameter - Mailing list pgsql-admin

From Ervin Weber
Subject [ADMIN] confusing .pgpass behaviour for undocumented replication=trueconnection parameter
Date
Msg-id CAFC4ZFjnk-EYJCNxfpsjw35aTOLC0iyibA=K-fSftEqLwoUjDg@mail.gmail.com
Whole thread Raw
List pgsql-admin
Hello,

(everything following was tested on Ubuntu 14.04.5 LTS, using PostgreSQL 9.6.5)


given '.pgpass' fille with content:
dbmaster.service.consul:5432:replication:replication_user:supersecret

Postgresql streaming replication slave server, containing
"primary_conninfo  = 'host=dbmaster.service.consul port=5432
user=replication_user'" inside recovery.conf is able to connect to
primary without any errors using said .pgpass file.

However when i run following command:
psql -d "host=dbmaster.service.consul port=5432 user=replication_user
replication=true" -c "IDENTIFY_SYSTEM;"  I get password prompt, seems
like psql is not considering replication database name in .pgpass as
match.

However if i replace previous .pgpass  file with
"dbmaster.service.consul:5432:*:replication_user:supersecret"  it
seams to please psql, so that ' systemid       | timeline |   xlogpos | dbname' and other info is returned without
passwordprompt. Using
 
star seems to also be OK for replication (both pg_basebackup and
streaming replication initiated by standby server itself).

I find this behaviour confusing, even for non documented parameter.
Maybe psql should consider 'replication' as database name in .pgpass
lookup when asked for replication connection? Alternatively, maybe
documentation can be clarified, because even when it says "The
database field is of limited usefulness because users have the same
password for all databases in the same cluster." for some reason it
suggest using special database name in one sentence before that: 'In a
standby server, a database name of replication matches streaming
replication connections made to the master server.' Maybe better
suggestion would be to always use star instead of database name in
.pgpass?

Thanks.


-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

pgsql-admin by date:

Previous
From: Bear Giles
Date:
Subject: Re: [ADMIN] Processing very large TEXT columns (300MB+) using C/libpq
Next
From: Geoff Winkless
Date:
Subject: Re: [ADMIN] Processing very large TEXT columns (300MB+) using C/libpq