PG Bug reporting form <noreply@postgresql.org> writes:
> The \c metacommand in psql does not anymore use the full information from
> pg_service.conf
> It's reading the pg_service.conf file but seems to ignore everything but the
> dbname=part part of the entry. this bug seems to be new, but is possibly not
> in the psql binary itself, as the bug seems to have at-least partially
> migrated to older versions of psql too.
Hmm, I suppose this has something to do with the fixes for bug #16604 [1].
Those were not supposed to affect the behavior for -reuse-previous=off
cases, which yours should be since there's an "=" in the \c argument.
However, after poking at it for a bit, I have a theory: are the
service-file entries that aren't being honored overridden by variables
from your environment (PGPORT etc)? I think that patch may have
unintentionally changed the relative priority of service file entries
versus other sources of default values.
regards, tom lane
[1] https://www.postgresql.org/message-id/flat/16604-933f4b8791227b15%40postgresql.org