Re: permission denied on socket

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>
Cc: Atul Kumar <akumar14871(at)gmail(dot)com>, pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: permission denied on socket
Date: 2024-01-25 21:14:58
Message-ID: c935ec0f-2a91-436e-a5a1-66728705461d@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On 1/25/24 12:39 PM, Ron Johnson wrote:
> On Thu, Jan 25, 2024 at 3:32 PM Adrian Klaver
> <adrian(dot)klaver(at)aklaver(dot)com> wrote:
> [snip]
>
> Best guess is you are using a version of psql that is expecting the
> socket to be somewhere else then where it actually is.
>
>
> Is "permission denied" really the error you get when the socket does
> not exist?
>
> Trying "psql --host=/var/run/foo" gave me "No such file or directory".

The OP used:

psql postgres

In that case psql will use the default set when it is compiled against
libpq which from here:

https://www.postgresql.org/docs/16/libpq-connect.html#LIBPQ-PARAMKEYWORDS

"... is to connect to a Unix-domain socket in |/tmp| (or whatever socket
directory was specified when PostgreSQL was built)"

If you have more then one instance of psql on a machine and they where
built with different defaults you can

end up not hitting the right socket.

Also "permission denied" could be due to any part of the path
/tmp/.s.PGSQL.5432.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michael Nolan 2024-01-25 21:29:08 field error on refreshed materialized view
Previous Message Ron Johnson 2024-01-25 20:39:50 Re: permission denied on socket