Re: Small doc patch about pg_service.conf

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Noah Misch <noah(at)leadboat(dot)com>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, Andrew Dunstan <andrew(at)dunslane(dot)net>, David Fetter <david(at)fetter(dot)org>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Small doc patch about pg_service.conf
Date: 2015-01-04 00:56:06
Message-ID: 990.1420332966@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Noah Misch <noah(at)leadboat(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2015-01-04 01:37:47 Re: logical column ordering
Previous Message Andres Freund 2015-01-04 00:53:24 Re: Proposal: Log inability to lock pages during vacuum