Re: Small doc patch about pg_service.conf

From: Noah Misch <noah(at)leadboat(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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:13:30
Message-ID: 20150104001330.GA2280861@tornado.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2015-01-04 00:31:22 Re: parallel mode and parallel contexts
Previous Message Andres Freund 2015-01-03 23:46:46 Re: logical column ordering