Re: Small doc patch about pg_service.conf - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Small doc patch about pg_service.conf
Date
Msg-id 990.1420332966@sss.pgh.pa.us
Whole thread Raw
In response to Re: Small doc patch about pg_service.conf  (Noah Misch <noah@leadboat.com>)
Responses Re: Small doc patch about pg_service.conf
Re: Small doc patch about pg_service.conf
List pgsql-hackers
Noah Misch <noah@leadboat.com> writes:
> 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.

Ugh.  That makes things messy.  Still, we're probably better off
recommending `pg_config --sysconfdir` than anything else.  I doubt
that the theoretical ability to do a post-installation move is used
much, and it's certainly not used by people using a prepackaged build.
So the recommendation would only be wrong for someone who had done such
a move manually, and they'd probably know what to do anyway.

> 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.

Good point.  I'd be satisfied with leaving out the parenthetical remark
altogether.

> 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.)

Yeah.  We should make those builds all consistent IMO; the /etc case is
probably the best one to standardize on.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Proposal: Log inability to lock pages during vacuum
Next
From: Alvaro Herrera
Date:
Subject: Re: logical column ordering