PORT 5432 ERROR

2023-08-01 Thread David Beck
I am receiving an error when I enter the server port number to listen
to—installed on all available versions, both 32-bit and 64-bit when
applicable, even the latest version, 15.3 x64 for Windows. I downloaded the
latest version as an example, and as I was told, I used the 5432 port as
the default port needed. I get a pop-up afterward saying, "Warning: The
specified port number is not available. Please enter a different port
number," than roadblocks at entering the default port number. I found
port 5434 available though it locks at a loading screen "loading server
Postgre version 7.4. Version 10 works on port 5434 though the server list
tree spins eternally.

Any solution or assistance would be appreciated.


Best regards,
David Beck


How to build a new grammer for pg?

2023-08-01 Thread jacktby






Hi, I’m trying to develop a new grammar for pg, can you give me a code example to reference?





















error: connection to server on socket...

2023-08-01 Thread Amn Ojee Uw

Using the following command on my Debian 12 machine:

/*sudo apt-get install postgresql postgresql-15 postgresql-client-common 
postgresql-common postgresql-contrib postgresql-doc phppgadmin

*/


and following the instruction on this 
 web page I have 
installed PostgreSQL-15.

The installation went smooth, until the following command was issued :

/*sudo -u postgres psql*/

... I get an error message that reads:

/*could not change directory to "/home/my_account": Permission denied*//*
*//*psql: error: connection to server on socket 
"/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory*//*
*//*    Is the server running locally and accepting connections on that 
socket?*/


What can I do to resolve this issue?

Thanks in advance.


Re: error: connection to server on socket...

2023-08-01 Thread Amn Ojee Uw

_*Addendum*_

I tried this, but to no avail : /*sudo systemctl start postgresql*/

On 8/1/23 6:22 a.m., Amn Ojee Uw wrote:


Using the following command on my Debian 12 machine:

/*sudo apt-get install postgresql postgresql-15 
postgresql-client-common postgresql-common postgresql-contrib 
postgresql-doc phppgadmin

*/


and following the instruction on this 
 web page I have 
installed PostgreSQL-15.

The installation went smooth, until the following command was issued :

/*sudo -u postgres psql*/

... I get an error message that reads:

/*could not change directory to "/home/my_account": Permission denied*//*
*//*psql: error: connection to server on socket 
"/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory*//*
*//*    Is the server running locally and accepting connections on 
that socket?*/


What can I do to resolve this issue?

Thanks in advance.


Re: error: connection to server on socket...

2023-08-01 Thread Tomas Pospisek

On 01.08.23 12:22, Amn Ojee Uw wrote:

Using the following command on my Debian 12 machine:

sudo apt-get install postgresql postgresql-15 postgresql-client-common 
postgresql-common postgresql-contrib postgresql-doc phppgadmin

and following the instruction on this 
 web page I have 
installed PostgreSQL-15.

The installation went smooth, until the following command was issued :

sudo -u postgres psql

... I get an error message that reads:

could not change directory to "/home/my_account": Permission denied
psql: error: connection to server on socket 
"/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
    Is the server running locally and accepting connections on that socket?

What can I do to resolve this issue?


When executing the `sudo` command above:

* as which user are you doing that (you can see that via `id`)?
* in which directory are you executing it  (you can see that via `pwd`)?
* what is the home directory of the postgres user (you can see that via 
`grep postgres /etc/passwd`)
* what does `ls -ld /var/run/postgresql/; ls -l 
/var/run/postgresql/.s.PGSQL.5432` show?


You also wrote:

> I tried this, but to no avail : `sudo systemctl start postgresql`

- what does `journalctl -xeu postgresql` say?
- what does `tail -n 20 
/var/log/postgresql/postgresql-*-qgisclouddb.log` show?


*t





Re: PORT 5432 ERROR

2023-08-01 Thread Tomas Pospisek

On 01.08.23 01:18, David Beck wrote:
I am receiving an error when I enter the server port number to listen 
to—installed on all available versions, both 32-bit and 64-bit when 
applicable, even the latest version, 15.3 x64 for Windows. I downloaded 
the latest version as an example, and as I was told, I used the 5432 
port as the default port needed. I get a pop-up afterward saying, 
"Warning: The specified port number is not available. Please enter a 
different port number," than roadblocks at entering the default port 
number. I found port 5434 available though it locks at a loading screen 
"loading server Postgre version 7.4. Version 10 works on port 5434 
though the server list tree spins eternally.


Any solution or assistance would be appreciated.


How/where do you enter the server port?
*t





Re: error: connection to server on socket...

2023-08-01 Thread pf
On Tue, 1 Aug 2023 06:22:46 -0400 Amn Ojee Uw wrote:

>"/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory*//*

Like mine, your distro probably uses /tmp/.s.PGSQL.5432 
$ ll /tmp/.s.PGSQL.5432
srwxrwxrwx 1 postgres postgres 0 Aug  1 06:33 /tmp/.s.PGSQL.5432=


https://askubuntu.com/questions/50621/can-not-connect-to-postgresql-listening-on-port-5432




Re: error: connection to server on socket...

2023-08-01 Thread Matthias Apitz
El día martes, agosto 01, 2023 a las 07:28:49 -0400, p...@pfortin.com escribió:

> On Tue, 1 Aug 2023 06:22:46 -0400 Amn Ojee Uw wrote:
> 
> >"/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory*//*
> 
> Like mine, your distro probably uses /tmp/.s.PGSQL.5432 
> $ ll /tmp/.s.PGSQL.5432
> srwxrwxrwx 1 postgres postgres 0 Aug  1 06:33 /tmp/.s.PGSQL.5432=
> 

This here is on SuSE Linux:

# ls -l /tmp/.*5432
srwxrwxrwx 1 postgres postgres 0 Aug  1 13:39 /tmp/.s.PGSQL.5432
# netstat -an | grep 5432 | grep LIST
tcp0  0 0.0.0.0:54320.0.0.0:*   LISTEN
tcp6   0  0 :::5432 :::*LISTEN
unix  2  [ ACC ] STREAM LISTENING 22000/tmp/.s.PGSQL.5432

We normaly use the TCP/IP port 5432 to connect to the server.

matthias
-- 
Matthias Apitz, ✉ g...@unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub




Re: error: connection to server on socket...

2023-08-01 Thread Tom Lane
p...@pfortin.com writes:
> On Tue, 1 Aug 2023 06:22:46 -0400 Amn Ojee Uw wrote:
>> "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory*//*

> Like mine, your distro probably uses /tmp/.s.PGSQL.5432 
> $ ll /tmp/.s.PGSQL.5432
> srwxrwxrwx 1 postgres postgres 0 Aug  1 06:33 /tmp/.s.PGSQL.5432=

Yeah.  Look to see if there's a socket file there, and if so try

sudo -u postgres psql -h /tmp

In the longer term, this indicates that you have a psql that did
not come from the same packager as your server, because the server
thinks the default socket location is /tmp, but psql (or really
the libpq.so it's using) thinks the default location is
/var/run/postgresql.  That's a build-time choice that some
packagers make because $standards.  So the long-term fix is to
not have a hodge-podge of different Postgres installations on
the same machine.

BTW, you can ignore the "could not change directory" warning.
That's expected when starting "sudo -u postgres psql" in a
directory that the postgres user can't read.

regards, tom lane




Re: PORT 5432 ERROR

2023-08-01 Thread Adrian Klaver

On 7/31/23 16:18, David Beck wrote:
I am receiving an error when I enter the server port number to listen 
to—installed on all available versions, both 32-bit and 64-bit when 
applicable, even the latest version, 15.3 x64 for Windows. I downloaded 
the latest version as an example, and as I was told, I used the 5432 
port as the default port needed. I get a pop-up afterward saying, 
"Warning: The specified port number is not available. Please enter a 
different port number," than roadblocks at entering the default port 
number. I found port 5434 available though it locks at a loading screen 
"loading server Postgre version 7.4. Version 10 works on port 5434 
though the server list tree spins eternally.




I'm going to bet you installed Postgres using the EDB installer and the 
issue is with pgAdmin4. This is a bug in the installer, see various 
threads here:


https://www.postgresql.org/list/pgadmin-support/


Any solution or assistance would be appreciated.


The solution is to uninstall just pgAdmin4 and reinstall directly from

https://www.pgadmin.org/download/

An installer fix seems to be out:

https://www.postgresql.org/message-id/CAFOhELf4BZB-ujS%3Da1LSjxU7qVJoz%3DqT9se4hEzbhzqJEsAooQ%40mail.gmail.com




Best regards,
David Beck


--
Adrian Klaver
adrian.kla...@aklaver.com





Re: error: connection to server on socket...

2023-08-01 Thread Adrian Klaver

On 8/1/23 03:22, Amn Ojee Uw wrote:

Using the following command on my Debian 12 machine:

/*sudo apt-get install postgresql postgresql-15 postgresql-client-common 
postgresql-common postgresql-contrib postgresql-doc phppgadmin

*/


and following the instruction on this 
 web page I have 
installed PostgreSQL-15.

The installation went smooth, until the following command was issued :

/*sudo -u postgres psql*/

... I get an error message that reads:

/*could not change directory to "/home/my_account": Permission denied*//*
*//*psql: error: connection to server on socket 
"/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory*//*
*//*    Is the server running locally and accepting connections on that 
socket?*/


What can I do to resolve this issue?


Run

pg_lsclusters

and see what port the server is running on.



Thanks in advance.



--
Adrian Klaver
adrian.kla...@aklaver.com





Re:How to build a new grammer for pg?

2023-08-01 Thread Wen Yi
If you want to add some new function to postgresql, just check this ducument:


https://www.postgresql.org/docs/current/extend-how.html




-- Original --
From:   
 "jacktby"  
  


PostgreSQL listens on localhost?

2023-08-01 Thread Frank Gunseor
I have read that PostgreSQL listens on localhost is it possible to have it
listen on an IP address?

Thank you.

FDG


Re: PostgreSQL listens on localhost?

2023-08-01 Thread Matthias Apitz
El día martes, agosto 01, 2023 a las 09:12:51a. m. -0700, Frank Gunseor 
escribió:

> I have read that PostgreSQL listens on localhost is it possible to have it
> listen on an IP address?
> 
> Thank you.
> 
> FDG

How about reading the man page of postgresql.conf and pg_hba.conf

Thanks

matthias
-- 
Matthias Apitz, ✉ g...@unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub




Re: PostgreSQL listens on localhost?

2023-08-01 Thread Ron

On 8/1/23 11:12, Frank Gunseor wrote:
I have read that PostgreSQL listens on localhost is it possible to have it 
listen on an IP address?


Of course.  "localhost" is just the default.

--
Born in Arizona, moved to Babylonia.




Sample pg_hba.conf allows local users to access all databases

2023-08-01 Thread William Edwards

Hi,

The sample pg_hba.conf in master 
(https://github.com/postgres/postgres/blob/master/src/backend/libpq/pg_hba.conf.sample) 
contains the following lines:


```
# IPv4 local connections:
hostall all 127.0.0.1/32
@authmethodhost@

# IPv6 local connections:
hostall all ::1/128 
@authmethodhost@

```

This allows all local users connecting over TCP to access all databases, 
not only the databases that the user is a member of as one might expect.


Proof that user is able to access database that it is not a member of is 
below. This was tested with PostgreSQL 14.x on Debian 11 using its 
default pg_hba.conf that also contains the lines above.


I can imagine that this is not desirable on machines to which 
unprivileged users have access. It seems likely that a PostgreSQL 
administrator would expect users to be able to access only the databases 
of which they are a member, unless configured otherwise manually.


Why are these lines shipped by default, and/or am I overestimating the 
impact in real-world scenarios?


Proof:

```
root@sandbox:~# sudo -u postgres psql
postgres=# create database john;
CREATE DATABASE
postgres=# create database jack;
CREATE DATABASE
postgres=# CREATE USER john;
CREATE ROLE
postgres=# CREATE USER jack;
CREATE ROLE
postgres=# ALTER USER john WITH PASSWORD 'password';
ALTER ROLE
postgres=# ALTER USER jack WITH PASSWORD 'password';
ALTER ROLE
postgres=# grant all privileges on database john to john;
GRANT
postgres=# grant all privileges on database jack to jack;
GRANT
postgres=> \l
  List of databases
   Name|  Owner   | Encoding |   Collate   |Ctype|   Access 
privileges

---+--+--+-+-+---
...
 jack  | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | 
=Tc/postgres +
   |  |  | | | 
postgres=CTc/postgres+
   |  |  | | | 
jack=CTc/postgres
 john  | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | 
=Tc/postgres +
   |  |  | | | 
postgres=CTc/postgres+
   |  |  | | | 
john=CTc/postgres


root@sandbox:~# psql john john -h 127.0.0.1 -W
Password:
psql (14.8 (Debian 14.8-1.pgdg110+1))
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 
256, compression: off)

Type "help" for help.

john=> \c jack
Password:
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 
256, compression: off)

You are now connected to database "jack" as user "john".
```

With kind regards,

William Edwards





Re: How to build a new grammer for pg?

2023-08-01 Thread David G. Johnston
On Tue, Aug 1, 2023 at 2:27 AM jacktby  wrote:

> Hi, I’m trying to develop a new grammar for pg, can you give me a code
> example to reference?
>

Use git blame or a repo history viewer.

David J.


Re: Sample pg_hba.conf allows local users to access all databases

2023-08-01 Thread Christophe Pettus



> On Aug 1, 2023, at 10:13, William Edwards  wrote:
> This allows all local users connecting over TCP to access all databases, not 
> only the databases that the user is a member of as one might expect.

There's really no notion of a user being "a member of" a database in 
PostgreSQL.  Users are global resources, which are either granted access to a 
particular database, or aren't.

In your example, you explicitly grant access to the databases to the users you 
are creating.

Since a default installation of PostgreSQL contains only one superuser role, 
and the `postgres` database, any other access requires specific intervention on 
the part of someone with a superuser account.



Re: Sample pg_hba.conf allows local users to access all databases

2023-08-01 Thread David G. Johnston
On Tue, Aug 1, 2023 at 10:13 AM William Edwards 
wrote:

> This allows all local users connecting over TCP to access all databases,
> not only the databases that the user is a member of as one might expect.
>
> Proof that user is able to access database that it is not a member of is
> below.


Roles do not gain membership in databases.  Roles can be granted
permissions on databases (mainly CONNECT).  And all roles, via PUBLIC, get
connect privileges on all databases by default.  So the pg_hba.conf entry
is not causing something to happen against the wishes of the privileges
system.

https://www.postgresql.org/docs/current/ddl-priv.html

And yes, this is a usability vs secure-by-default that hasn't seen enough
complaint to take on changing the default.

David J.


Re: error: connection to server on socket...

2023-08-01 Thread Amn Ojee Uw

Ah! Adrean, here is something interesting.

/*pg_lsclusters*/ displays the following information

/*Ver Cluster Port Status    Owner    Data 
directory  Log file*//*
*//*12  main    5432 down,binaries_missing postgres 
/var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log*//*
*//*15  main    5433 online    postgres 
/var/lib/postgresql/15/main /var/log/postgresql/postgresql-15-main.log*/


What is version 12 is doing there, I thought that I had completely 
removed it and replaced it with version 15!!

Should I remove that log file?

Regarding /p...@pfortin.com/ assertion, I am working with a _/Debian 12/_ 
machine and /*ls -l /tmp/.s.PGSQL.5432*/
displays the following error message : /*ls: cannot access 
'/tmp/.s.PGSQL.5432': No such file or directory*/


As for Tomas Pospisek questions :
* as which user are you doing that (you can see that via `id`)?

   Due to matters of security let us assume that the output is :
   /*id*//*
   *//*uid=1000(my_account) gid=1000(my_account)
   
groups=1000(my_account),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),100(users),*/
   
/*106(netdev),111(bluetooth),113(lpadmin),116(scanner),122(postgres),1001(tomcat)*/

* in which directory are you executing it  (you can see that via `pwd`)?

   /*/home/*//*my_account*/

* what is the home directory of the postgres user (you can see that via 
`grep postgres /etc/passwd`) /*

*/

   /*~$ grep postgres /etc/passwd*//*
   *//*postgres:x:113:122:PostgreSQL
   administrator,,,:/var/lib/postgresql:/bin/bash*/

* what does `ls -ld /var/run/postgresql/; ls -l 
/var/run/postgresql/.s.PGSQL.5432` show?


   /*ls -ld /var/run/postgresql/*//*
   *//*drwxrwsr-x 2 postgres postgres 100 Jul 31 20:45
   /var/run/postgresql/*/

   /*ls -l /var/run/postgresql/.s.PGSQL.5432*//*
   *//*ls: cannot access '/var/run/postgresql/.s.PGSQL.5432': No such
   file or directory*/


- what does `journalctl -xeu postgresql` say?

   /*sudo journalctl -xeu postgresql*//*
   *//*[sudo] password for *//*/**//*my_account*/: *//*
   *//*░░ Support: https://www.debian.org/support*//*
   *//*░░ *//*
   *//*░░ A start job for unit postgresql.service has begun execution.*//*
   *//*░░ *//*
   *//*░░ The job identifier is 3496.*//*
   *//*Jul 31 20:45:13 *//*tree.com systemd[1]: Finished
   postgresql.service - PostgreSQL R>*//*
   *//*░░ Subject: A start job for unit postgresql.service has finished
   successfully*//*
   *//*░░ Defined-By: systemd*//*
   *//*░░ Support: https://www.debian.org/support*//*
   *//*░░ *//*
   *//*░░ A start job for unit postgresql.service has finished
   successfully.*//*
   *//*░░ *//*
   *//*░░ The job identifier is 3496.*//*
   *//*lines 4-16/16 (END)*/

- what does `tail -n 20 
/var/log/postgresql/postgresql-*-qgisclouddb.log` show?


   /*sudo tail -n 20 /var/log/postgresql/postgresql-*-qgisclouddb.log*//*
   *//*tail: cannot open
   '/var/log/postgresql/postgresql-*-qgisclouddb.log' for reading: No
   such file or directory*/


I hope I was able to answer all the interesting questions posted as 
reply to my original post.


/Thanks folks, I really appreciate the time you have dedicated to my 
question./



On 8/1/23 10:35 a.m., Adrian Klaver wrote:

On 8/1/23 03:22, Amn Ojee Uw wrote:

Using the following command on my Debian 12 machine:

/*sudo apt-get install postgresql postgresql-15 
postgresql-client-common postgresql-common postgresql-contrib 
postgresql-doc phppgadmin

*/


and following the instruction on this 
 web page I have 
installed PostgreSQL-15.

The installation went smooth, until the following command was issued :

/*sudo -u postgres psql*/

... I get an error message that reads:

/*could not change directory to "/home/my_account": Permission 
denied*//*
*//*psql: error: connection to server on socket 
"/var/run/postgresql/.s.PGSQL.5432" failed: No such file or 
directory*//*
*//*    Is the server running locally and accepting connections on 
that socket?*/


What can I do to resolve this issue?


Run

pg_lsclusters

and see what port the server is running on.



Thanks in advance.



Re: PostgreSQL listens on localhost?

2023-08-01 Thread Adrian Klaver

On 8/1/23 09:12, Frank Gunseor wrote:
I have read that PostgreSQL listens on localhost is it possible to have 
it listen on an IP address?


Read:

https://www.postgresql.org/docs/current/runtime-config-connection.html#RUNTIME-CONFIG-CONNECTION-SETTINGS



Thank you.

FDG


--
Adrian Klaver
adrian.kla...@aklaver.com





Re: error: connection to server on socket...

2023-08-01 Thread Adrian Klaver

On 8/1/23 11:42, Amn Ojee Uw wrote:

Ah! Adrean, here is something interesting.

/*pg_lsclusters*/ displays the following information

/*Ver Cluster Port Status    Owner    Data 
directory  Log file*//*
*//*12  main    5432 down,binaries_missing postgres 
/var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log*//*
*//*15  main    5433 online    postgres 
/var/lib/postgresql/15/main /var/log/postgresql/postgresql-15-main.log*/


What is version 12 is doing there, I thought that I had completely 
removed it and replaced it with version 15!!


You didn't, read:

https://www.postgresql.org/message-id/20230731125247.puiaz7fjkfvljdwy%40alvherre.pgsql

and

https://www.postgresql.org/message-id/33f0fc61-2d0f-60bd-e0ed-4cada3c30...@aklaver.com

The clue is "binaries_missing".

You remove(ed) all the files except the conf files.



Should I remove that log file?


Run:

sudo apt purge postgresql-12

That will take care of removing all the conf files.


To connect you need to specify the correct port, 5433 or do:

sudo vi /etc/postgresql/15/main/postgresql.conf

and change

port = 5433

to

port = 5432

Then restart the server.

You then need to spend some time at the links in this message:

https://www.postgresql.org/message-id/c1ad730a-a84a-ae97-2f23-6891cb06ef26%40aklaver.com



Regarding /p...@pfortin.com/ assertion, I am working with a _/Debian 12/_ 
machine and /*ls -l /tmp/.s.PGSQL.5432*/
displays the following error message : /*ls: cannot access 
'/tmp/.s.PGSQL.5432': No such file or directory*/


As for Tomas Pospisek questions :
* as which user are you doing that (you can see that via `id`)?

Due to matters of security let us assume that the output is :
/*id*//*
*//*uid=1000(my_account) gid=1000(my_account)

groups=1000(my_account),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),100(users),*/

/*106(netdev),111(bluetooth),113(lpadmin),116(scanner),122(postgres),1001(tomcat)*/

* in which directory are you executing it  (you can see that via `pwd`)?

/*/home/*//*my_account*/

* what is the home directory of the postgres user (you can see that via 
`grep postgres /etc/passwd`) /*

*/

/*~$ grep postgres /etc/passwd*//*
*//*postgres:x:113:122:PostgreSQL
administrator,,,:/var/lib/postgresql:/bin/bash*/

* what does `ls -ld /var/run/postgresql/; ls -l 
/var/run/postgresql/.s.PGSQL.5432` show?


/*ls -ld /var/run/postgresql/*//*
*//*drwxrwsr-x 2 postgres postgres 100 Jul 31 20:45
/var/run/postgresql/*/

/*ls -l /var/run/postgresql/.s.PGSQL.5432*//*
*//*ls: cannot access '/var/run/postgresql/.s.PGSQL.5432': No such
file or directory*/


- what does `journalctl -xeu postgresql` say?

/*sudo journalctl -xeu postgresql*//*
*//*[sudo] password for *//*/**//*my_account*/: *//*
*//*░░ Support: https://www.debian.org/support*//*
*//*░░ *//*
*//*░░ A start job for unit postgresql.service has begun execution.*//*
*//*░░ *//*
*//*░░ The job identifier is 3496.*//*
*//*Jul 31 20:45:13 *//*tree.com systemd[1]: Finished
postgresql.service - PostgreSQL R>*//*
*//*░░ Subject: A start job for unit postgresql.service has finished
successfully*//*
*//*░░ Defined-By: systemd*//*
*//*░░ Support: https://www.debian.org/support*//*
*//*░░ *//*
*//*░░ A start job for unit postgresql.service has finished
successfully.*//*
*//*░░ *//*
*//*░░ The job identifier is 3496.*//*
*//*lines 4-16/16 (END)*/

- what does `tail -n 20 
/var/log/postgresql/postgresql-*-qgisclouddb.log` show?


/*sudo tail -n 20 /var/log/postgresql/postgresql-*-qgisclouddb.log*//*
*//*tail: cannot open
'/var/log/postgresql/postgresql-*-qgisclouddb.log' for reading: No
such file or directory*/


I hope I was able to answer all the interesting questions posted as 
reply to my original post.


/Thanks folks, I really appreciate the time you have dedicated to my 
question./



On 8/1/23 10:35 a.m., Adrian Klaver wrote:

On 8/1/23 03:22, Amn Ojee Uw wrote:

Using the following command on my Debian 12 machine:

/*sudo apt-get install postgresql postgresql-15 
postgresql-client-common postgresql-common postgresql-contrib 
postgresql-doc phppgadmin

*/


and following the instruction on this 
 web page I have 
installed PostgreSQL-15.

The installation went smooth, until the following command was issued :

/*sudo -u postgres psql*/

... I get an error message that reads:

/*could not change directory to "/home/my_account": Permission 
denied*//*
*//*psql: error: connection to server on socket 
"/var/run/postgresql/.s.PGSQL.5432" failed: No such file or 
directory*//*
*//*    Is the server running locally and accepting connections on 
that socket?*/


What can I do to resolve this issue?


Run

pg_lsclusters

and see what port the server is running on.



Thanks in advance.





--
Adrian Klaver
adrian.kla..

Re: PostgreSQL listens on localhost?

2023-08-01 Thread Frank Gunseor
Hi Adrian,

I have just started with PostgreSQL after years away from Micro$oft SQL
Server.
Thank you very much for the quick reference as I have also been trying to
get through the documentation (all 3063 pages of it!).

FDG

On Tue, Aug 1, 2023 at 11:42 AM Adrian Klaver 
wrote:

> On 8/1/23 09:12, Frank Gunseor wrote:
> > I have read that PostgreSQL listens on localhost is it possible to have
> > it listen on an IP address?
>
> Read:
>
>
> https://www.postgresql.org/docs/current/runtime-config-connection.html#RUNTIME-CONFIG-CONNECTION-SETTINGS
>
> >
> > Thank you.
> >
> > FDG
>
> --
> Adrian Klaver
> adrian.kla...@aklaver.com
>
>


Re: error: connection to server on socket...

2023-08-01 Thread Amn Ojee Uw

Thank you Adrian. It Worked!!!


On 8/1/23 2:55 p.m., Adrian Klaver wrote:

On 8/1/23 11:42, Amn Ojee Uw wrote:

Ah! Adrean, here is something interesting.

/*pg_lsclusters*/ displays the following information

/*Ver Cluster Port Status    Owner    Data 
directory  Log file*//*
*//*12  main    5432 down,binaries_missing postgres 
/var/lib/postgresql/12/main 
/var/log/postgresql/postgresql-12-main.log*//*
*//*15  main    5433 online    postgres 
/var/lib/postgresql/15/main /var/log/postgresql/postgresql-15-main.log*/


What is version 12 is doing there, I thought that I had completely 
removed it and replaced it with version 15!!


You didn't, read:

https://www.postgresql.org/message-id/20230731125247.puiaz7fjkfvljdwy%40alvherre.pgsql 



and

https://www.postgresql.org/message-id/33f0fc61-2d0f-60bd-e0ed-4cada3c30...@aklaver.com 



The clue is "binaries_missing".

You remove(ed) all the files except the conf files.



Should I remove that log file?


Run:

sudo apt purge postgresql-12

That will take care of removing all the conf files.


To connect you need to specify the correct port, 5433 or do:

sudo vi /etc/postgresql/15/main/postgresql.conf

and change

port = 5433

to

port = 5432

Then restart the server.

You then need to spend some time at the links in this message:

https://www.postgresql.org/message-id/c1ad730a-a84a-ae97-2f23-6891cb06ef26%40aklaver.com 





Regarding /p...@pfortin.com/ assertion, I am working with a _/Debian 
12/_ machine and /*ls -l /tmp/.s.PGSQL.5432*/
displays the following error message : /*ls: cannot access 
'/tmp/.s.PGSQL.5432': No such file or directory*/


As for Tomas Pospisek questions :
* as which user are you doing that (you can see that via `id`)?

    Due to matters of security let us assume that the output is :
    /*id*//*
    *//*uid=1000(my_account) gid=1000(my_account)
groups=1000(my_account),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),100(users),*/
/*106(netdev),111(bluetooth),113(lpadmin),116(scanner),122(postgres),1001(tomcat)*/

* in which directory are you executing it  (you can see that via `pwd`)?

    /*/home/*//*my_account*/

* what is the home directory of the postgres user (you can see that 
via `grep postgres /etc/passwd`) /*

*/

    /*~$ grep postgres /etc/passwd*//*
    *//*postgres:x:113:122:PostgreSQL
    administrator,,,:/var/lib/postgresql:/bin/bash*/

* what does `ls -ld /var/run/postgresql/; ls -l 
/var/run/postgresql/.s.PGSQL.5432` show?


    /*ls -ld /var/run/postgresql/*//*
    *//*drwxrwsr-x 2 postgres postgres 100 Jul 31 20:45
    /var/run/postgresql/*/

    /*ls -l /var/run/postgresql/.s.PGSQL.5432*//*
    *//*ls: cannot access '/var/run/postgresql/.s.PGSQL.5432': No such
    file or directory*/


- what does `journalctl -xeu postgresql` say?

    /*sudo journalctl -xeu postgresql*//*
    *//*[sudo] password for *//*/**//*my_account*/: *//*
    *//*░░ Support: https://www.debian.org/support*//*
    *//*░░ *//*
    *//*░░ A start job for unit postgresql.service has begun 
execution.*//*

    *//*░░ *//*
    *//*░░ The job identifier is 3496.*//*
    *//*Jul 31 20:45:13 *//*tree.com systemd[1]: Finished
    postgresql.service - PostgreSQL R>*//*
    *//*░░ Subject: A start job for unit postgresql.service has finished
    successfully*//*
    *//*░░ Defined-By: systemd*//*
    *//*░░ Support: https://www.debian.org/support*//*
    *//*░░ *//*
    *//*░░ A start job for unit postgresql.service has finished
    successfully.*//*
    *//*░░ *//*
    *//*░░ The job identifier is 3496.*//*
    *//*lines 4-16/16 (END)*/

- what does `tail -n 20 
/var/log/postgresql/postgresql-*-qgisclouddb.log` show?


    /*sudo tail -n 20 
/var/log/postgresql/postgresql-*-qgisclouddb.log*//*

    *//*tail: cannot open
    '/var/log/postgresql/postgresql-*-qgisclouddb.log' for reading: No
    such file or directory*/


I hope I was able to answer all the interesting questions posted as 
reply to my original post.


/Thanks folks, I really appreciate the time you have dedicated to my 
question./



On 8/1/23 10:35 a.m., Adrian Klaver wrote:

On 8/1/23 03:22, Amn Ojee Uw wrote:

Using the following command on my Debian 12 machine:

/*sudo apt-get install postgresql postgresql-15 
postgresql-client-common postgresql-common postgresql-contrib 
postgresql-doc phppgadmin

*/


and following the instruction on this 
 web page I have 
installed PostgreSQL-15.

The installation went smooth, until the following command was issued :

/*sudo -u postgres psql*/

... I get an error message that reads:

/*could not change directory to "/home/my_account": Permission 
denied*//*
*//*psql: error: connection to server on socket 
"/var/run/postgresql/.s.PGSQL.5432" failed: No such file or 
directory*//*
*//*    Is the server running locally and accepting connections on 
that socket?*/


What can I do to resolve this issue?


Run

pg_lsclusters

and see what port th