I have two postgresql installations:
$ sudo /etc/init.d/postgresql status
9.1/main (port 5432): online
9.2/main (port 5433): online
I was used to restarting the postgres database doing a:
$ sudo /etc/init.d/postgresql restart
... but now that there's two of them, how to choose which one to restart?
UPDATE: following the answer I received from Micah Yoder I did a:
/usr/lib/postgresql/9.2/bin/pg_ctl -D /var/lib/postgresql/9.2/main restart
which was met with "could not open PID file /var/lib/postgresql/9.2/main/main/postmaster.pid permission denied". When I tried to run pg_ctl in a sudo-i session I was met with:
pg_ctl: cannot be run as root
Please log in (using, e.g., "su") as the (unprivileged) user that will
own the server process.
How am I supposed to run the pg_ctl program? Also I don't see why I have to indicate the data file for a restart. Doesn't the process know which data file it is using?
UPDATE 2 Finally I gave up on the pg_ctl and did a:
sudo /etc/init.d/postgresql restart 9.2
.. as per the accepted answer.