Search Postgresql Archives

Re: No default for (user-specific) service file location on Windows?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 19, 2022 at 10:57:55AM +0200, Dominique Devienne wrote:
> On Thu, May 19, 2022 at 10:17 AM Julien Rouhaud <rjuju123@xxxxxxxxx> wrote:
> > > Or is it instead a lack of symmetry in the implementations of these
> > > two mechanisms?
> >
> > As far as I can see from the code it should be
> > %APPDATA%\postgresql\.pg_service.conf
> >
> > Does this one work?
>
> Yes it does! Thanks.

Ah great!

> > There is a discrepancy (apart from the documentation) as the default
> > file name is the same on Linux and Windows.
>
> The doc is explicit about Windows for the password file,
> probably should be for the service file as well IMHO.

Yeah I totally agree.  I'm attaching a patch for that.

> It's unfortunate that the naming conventions are different.
> Might need to be warned about in the doc too. My $0.02.

I agree that the discrepancy is annoying, but I don't think that we usually add
this kind of warning.  I didn't do anything about it for now.
>
> Could also be changed to try both on Windows, with or w/o the leading dot,
> but I suspect this kind of change won't be considered worth implementing :).

We can't change the default file in older branches obviously, but I'd be a bit
worried about changing the default in the next major version either as it would
add unnecessary pain for users that do know and rely on the current default.  I
guess we have to live with it, and properly document it.
>From 27853c7df7ea03b47e0a7f7b609693f8b0789723 Mon Sep 17 00:00:00 2001
From: Julien Rouhaud <julien.rouhaud@xxxxxxx>
Date: Thu, 19 May 2022 17:42:07 +0800
Subject: [PATCH v1] Document the default location of the PGSERVICEFILE on
 Windows.

Per report from Dominique Devienne.

Author: Julien Rouhaud
Discussion: https://postgr.es/m/CAFCRh-_mdLrh8eYVzhRzu4c8bAFEBn=rwoHOmFJcQOTsCy5nig@xxxxxxxxxxxxxx
---
 doc/src/sgml/libpq.sgml | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml
index 40035d7656..758e06e610 100644
--- a/doc/src/sgml/libpq.sgml
+++ b/doc/src/sgml/libpq.sgml
@@ -7788,8 +7788,11 @@ myEventProc(PGEventId evtId, void *evtInfo, void *passThrough)
       </indexterm>
       <envar>PGSERVICEFILE</envar> specifies the name of the per-user
       connection service file.  If not set, it defaults
-      to <filename>~/.pg_service.conf</filename>
-      (see <xref linkend="libpq-pgservice"/>).
+      to <filename>~/.pg_service.conf</filename>, or
+      <filename>%APPDATA%\postgresql\.pg_service.conf</filename> (where
+      <filename>%APPDATA%</filename> refers to the Application Data
+      subdirectory in the user's profile) on Microsoft Windows (see <xref
+      linkend="libpq-pgservice"/>).
      </para>
     </listitem>
 
@@ -8163,7 +8166,10 @@ myEventProc(PGEventId evtId, void *evtInfo, void *passThrough)
    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 <filename>~/.pg_service.conf</filename>; this can be overridden by
+   at <filename>~/.pg_service.conf</filename>, or
+   <filename>%APPDATA%\postgresql\.pg_service.conf</filename> (where
+   <filename>%APPDATA%</filename> refers to the Application Data subdirectory
+   in the user's profile) on Microsoft Windows; this can be overridden by
    setting the environment variable <envar>PGSERVICEFILE</envar>.
    The system-wide file is named <filename>pg_service.conf</filename>.
    By default it is sought in the <filename>etc</filename> directory
-- 
2.33.1


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux