Greg Smith wrote:
I'm not sure which question Rob meant to ask here:

1) Where can I find the PostgreSQL in my PATH right now? The best I think you can do here is to try the above pg_config bit first, then if it doesn't work try guess based on "which postmaster".

2) Given a running server, what PostgreSQL binary was used to start it? You can get some info about a running server using this query (which just suggests what SHOW can give you):

  select name,setting from pg_settings where category='File Locations';

But there's no binary location listed there. You can dig it out of ps using something like this:

  ps -C postgres -o cmd 2>&1 | grep "/postgres" | cut -d" " -f1
  (Tested on Linux)

You'll need to test on all the UNIX-ish OSes you want to support though, getting ps calls to work perfectly everywhere is harder than it should be.

Only the pg_config technique will be easy to use from Windows I think, but at least there you shouldn't have as many concerns about what subsets of the package are installed--I don't think it's sliced up nearly as fine as you can make the RPM or deb installs for example, such that you can easily have a server running but not pg_config. I could be wrong about that though.

and for extra confusion, its perfectly feasible for more than one postgres server to be running at the same time, from different paths.

I do wonder... why would an application -care- where the server daemon is running from?



--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to