On Sat, Jan 03, 2015 at 02:36:50PM -0500, Noah Misch wrote:
> The directory libpq consults is `pg_config --sysconfdir`

I was wrong there.  `pg_config --sysconfig` uses get_etc_path(), which adjusts
to post-installation moves of the installation tree.  parseServiceInfo() uses
the build-time SYSCONFDIR directly.

On Sat, Jan 03, 2015 at 05:33:32PM -0500, Tom Lane wrote:
> I'd suggest wording along the lines of
> 
>   ... or it can be a system-wide file, which is named
>   <filename>pg_service.conf</filename> and located in the directory
>   specified by the environment variable <envar>PGSYSCONFDIR</envar>.
>   If that variable is not set, the system-wide file is sought in the
>   directory displayed by <command>pg_config --sysconfig</command>
>   (by default, <filename><replaceable>installprefix</>/etc</filename>).

The default sysconfdir is more complicated; see Makefile.global.in.  With a
prefix of /usr/local/pgsql, the default sysconfdir is /usr/local/pgsql/etc.
With a prefix of /usr/local, it is /usr/local/etc/postgresql.  In the minor
nit department, the term "installprefix" is heretofore unattested in our
source tree.

> However, I don't know whether that advice also works for Windows;
> can anyone check?

More or less.  I haven't tested, but I have no reason to suspect the relevant
parseServiceInfo() code behaves any differently.  However, the value of
SYSCONFDIR is different depending on your choice of libpq build system:

gmake: same as non-Windows gmake build, based on "configure" arguments
src/tools/msvc: #define SYSCONFDIR "/etc"
win32.mak: #define SYSCONFDIR ""
bcc32.mak: #define SYSCONFDIR ""

A src/tools/msvc build, the most common case, would look relative to the root
of the current drive, e.g. X:/etc/pg_service.conf.  Borland and nmake builds
would look for X:/pg_service.conf.  (I doubt that reflects a coherent plan,
though I can't think of a single clearly-better location known at build time.)


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

Reply via email to