Обсуждение: psql ignores server port setting through alter system whenconnecting?

Поиск
Список
Период
Сортировка

psql ignores server port setting through alter system whenconnecting?

От
Wim Bertels
Дата:
Hallo,

i tested this on two debian stable machines with the apt.postgresql.org
repo enabled. Can anyone confirm this?

Version: 10.1-1.pgdg90+1

Steps to reproduce

1. connect to your db using a unix socket, for example
$ psql --cluster 10/main postgres

2. change the port with alter system, for example
# ALTER SYSTEM set port TO 54331;

3. restart the cluster
# pg_ctlcluster 10 main restart

4. check
# pg_lsclusters
Ver Cluster Port  Status Owner    Data directory               Log file
9.6 main    5432  online postgres /var/lib/postgresql/9.6/main
/var/log/postgresql/postgresql-9.6-main.log
10  main    54331 online postgres /var/lib/postgresql/10/main
/var/log/postgresql/postgresql-10-main.log

5. try to connect again as in 1.
$ psql --cluster 10/main postgres
psql: could not connect to server: Bestand of map bestaat nietIs the server running locally and acceptingconnections on
Unixdomain socket "/var/run/postgresql/.s.PGSQL.5433"?
 

6. check again
$ ss -a | grep 5433
u_str  LISTEN     0      128    /var/run/postgresql/.s.PGSQL.54331
554855                * 0
tcp    LISTEN     0      128    127.0.0.1:54331                 *:*

tcp    LISTEN     0      128       ::1:54331                :::*

Background:
The port in postmaster.conf was always 5433 in this test case, also a
non standard port to try to pinpoint the problem closer.

hth,
Wim



Re: psql ignores server port setting through alter system when connecting?

От
Tom Lane
Дата:
Wim Bertels <wim.bertels@ucll.be> writes:
> i tested this on two debian stable machines with the apt.postgresql.org
> repo enabled. Can anyone confirm this?

How would you expect psql to know about a server setting before
connecting?
        regards, tom lane