I tried the following and it failed
bash-3.2$ pg_ctl restart
pg_ctl: no database directory specified and environment variable PGDATA unset
I am using Macbook Pro and dont remember the directory where my data is stored and so can’t set PGDATA either, is there a way to restart Postgres at all without losing data?
Thank you
As you want to re-start Postgres I assume the server is already running.
Using the superuser account you can query the location of the data directory through SQL:
With that information you can supply the data directory to the pg_ctl command using the
-Dswitch (see the manual for details)