Re: Finding the bin path

From: John R Pierce <pierce(at)hogranch(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Finding the bin path
Date: 2009-12-26 23:00:46
Message-ID: 4B36959E.2090305@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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?

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2009-12-27 02:31:50 Re: dbi-link with Sybase
Previous Message Greg Smith 2009-12-26 22:54:26 Re: Finding the bin path