Re: Select works only when connected from login postgres

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joseph Brenner <doomvox(at)gmail(dot)com>
Cc: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Select works only when connected from login postgres
Date: 2016-12-04 17:51:49
Message-ID: 26569.1480873909@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Joseph Brenner <doomvox(at)gmail(dot)com> writes:
>> So what happens when you specify the port in your psql connection, eg:
>> /usr/local/pgsql/bin/psql --dbname=doom --username=doom -p 5432
>> /usr/local/pgsql/bin/psql --dbname=doom --username=doom -p 5433
>> /usr/local/pgsql/bin/psql --dbname=doom --username=doom -p 5434

> With /usr/local/pgsql/bin/psql, only "-p 5433" connects, the
> other two complain like so:

> psql: could not connect to server: No such file or directory
> Is the server running locally and accepting
> connections on Unix domain socket "/tmp/.s.PGSQL.5434"?

What this probably indicates is that the other two installations are
configured to put their socket files someplace else than /tmp, perhaps
/var/run/postgresql. Connecting to them and issuing "show
unix_socket_directories" would tell the tale.

You can persuade a psql to connect to a socket in a nondefault directory
by giving the directory name as host, eg

psql --host=/var/run/postgresql -p 5434

It would be interesting to try all nine combinations of the psql's
supplied by your various installations and the servers, just to confirm
which ones behave normally and which don't. Of course, the other two
would have to be told --host=/tmp to talk to the handbuilt server.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2016-12-04 17:52:31 Re: Postgres and LibreOffice's 'Base'
Previous Message Tom Lane 2016-12-04 17:39:17 Re: count(*) in binary mode returns 0

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2016-12-04 19:55:19 Re: PSQL commands: \quit_if, \quit_unless
Previous Message Tom Lane 2016-12-04 17:31:40 Re: Select works only when connected from login postgres