Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lm5I3-0006WX-9d for pgsql-docs@arkaria.postgresql.org; Thu, 27 May 2021 01:58:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lm5I2-0004vp-9y for pgsql-docs@arkaria.postgresql.org; Thu, 27 May 2021 01:58:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lm5I2-0004uT-41 for pgsql-docs@lists.postgresql.org; Thu, 27 May 2021 01:58:26 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lm5Hv-0006Oq-2j for pgsql-docs@lists.postgresql.org; Thu, 27 May 2021 01:58:25 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 14R1wEDs1681253; Wed, 26 May 2021 21:58:14 -0400 From: Tom Lane To: Michael Paquier cc: "tanghy.fnst@fujitsu.com" , Bruce Momjian , "pgsql-docs@lists.postgresql.org" Subject: Re: pg_type_d.h location incorrect In-reply-to: References: <162149020918.26174.7150424047314144297@wrigleys.postgresql.org> <1424852.1621999180@sss.pgh.pa.us> Comments: In-reply-to Michael Paquier message dated "Wed, 26 May 2021 17:03:46 +0900" MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <1681208.1622080621.0@sss.pgh.pa.us> Date: Wed, 26 May 2021 21:58:14 -0400 Message-ID: <1681252.1622080694@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1681208.1622080621.1@sss.pgh.pa.us> Michael Paquier writes: > On Wed, May 26, 2021 at 05:40:45AM +0000, tanghy.fnst@fujitsu.com wrote: >> You're right, backtick notation doesn't work at my windows machine. >> But I made the fix in accordance with the pg-doc as below. So maybe >> we need a fix there, too? >> >> https://www.postgresql.org/docs/current/libpq-pgservice.html >> a system-wide file at `pg_config --sysconfdir`/pg_service.conf > Using catalog/pg_type_d.h sounds enough to me as well. While on it, > we could adjust include/common/relpath.h in pgbuffercache.sgml? We > tend to include the full path for things not generated. I doubt we can drop the reference to pg_config in libpq-pgservice.html, because otherwise we'd have to just say "etc/" which is not very definite. However, we should avoid the use of backticks since that's a platform-specific thing. I set out to rewrite that, but the more I looked at that section the more help it seemed to need. I thought the para was quite confusing about which environment variables affect what; and I also noticed that nowhere do we explain how service-file settings interact with other settings. (If that had been better specified to begin with, maybe I'd not have made the mistake fixed in ea8013854.) So I ended up with the attached --- what do you think? Also, looking at this, I note that "~/.pg_service.conf" is still a platform-ism. We could make that slightly better by writing "$HOME/.pg_service.conf", but is that good enough? regards, tom lane ------- =_aaaaaaaaaa0 Content-Type: text/x-diff; name="improve-pgservice-docs.patch"; charset="us-ascii" Content-ID: <1681208.1622080621.2@sss.pgh.pa.us> Content-Description: improve-pgservice-docs.patch Content-Transfer-Encoding: quoted-printable diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml index 875950b83c..ca231f43c4 100644 --- a/doc/src/sgml/libpq.sgml +++ b/doc/src/sgml/libpq.sgml @@ -8091,26 +8091,30 @@ myEventProc(PGEventId evtId, void *evtInfo, void *= passThrough) The connection service file allows libpq connection parameters to be associated with a single service name. That service name can then be - specified by a libpq connection, and the associated settings will be + specified in a libpq connection string, and the associated settings wi= ll be used. This allows connection parameters to be modified without requiri= ng - a recompile of the libpq application. The service name can also be + a recompile of the libpq-using application. The service name can also = be specified using the PGSERVICE environment variable. = - The connection service file can be a per-user service file - at ~/.pg_service.conf or the location - specified by the environment variable PGSERVICEFILE, - or it can be a system-wide file - at `pg_config --sysconfdir`/pg_service.conf or in= the directory - specified by the environment variable - PGSYSCONFDIR. If service definitions with the same - name exist in the user and the system file, the user file takes - precedence. + Service names can be defined in either a per-user service file or a + system-wide file. If the same service name exists in both the user + and the system file, the user file takes precedence. + By default, the per-user service file is located + at ~/.pg_service.conf; this can be overridden by + setting the environment variable PGSERVICEFILE. + The system-wide file is named pg_service.conf. + By default it is sought in the etc directory + of the PostgreSQL installation + (use pg_config --sysconfdir to identify this + directory precisely). Another directory, but not a different file + name, can be specified by setting the environment variable + PGSYSCONFDIR. = - The file uses an INI file format where the section + Either service file uses an INI file format where the s= ection name is the service name and the parameters are connection parameters; see for a list. F= or example: @@ -8121,9 +8125,22 @@ host=3Dsomehost port=3D5433 user=3Dadmin - An example file is provided at + An example file is provided in + the PostgreSQL installation at share/pg_service.conf.sample. + + + Connection parameters obtained from a service file are combined with + parameters obtained from other sources. A service file setting + overrides the corresponding environment variable, and in turn can be + overridden by a value given directly in the connection string. + For example, using the above service file, a connection string + service=3Dmydb port=3D5434 will use + host somehost, port 5434, + user admin, and other parameters as set by + environment variables or built-in defaults. + = = ------- =_aaaaaaaaaa0--