pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pg_service file questions
3+ messages / 3 participants
[nested] [flat]

* pg_service file questions
@ 2023-06-20 06:11  JUN ZHI <zhi_jun95@hotmail.com>
  0 siblings, 2 replies; 3+ messages in thread

From: JUN ZHI @ 2023-06-20 06:11 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

Hi,

I was scanning through the postgresql documentations when i came across this webpage: PostgreSQL: Documentation: 15: 34.17. The Connection Service File<https://www.postgresql.org/docs/current/libpq-pgservice.html; . I am fairly new to database and i have a few questions regarding this:


  1.  Is pg_service.conf and .pg_service.conf (with a dot at the front) different files?
  2.  The documentation stated that the .pg_service.conf is named %APPDATA%\postgresql.pg_service.conf on windows which is a directory i can not find.
  3.  The documentation also stated that we can check for the sysconfigdir environment variable and point it to somewhere else, but when i checked for the sysconfigdir path, it is pointing to C:/PROGRA~1/POSTGR~1/15/etc which again, is a directory i can not find : to be specific, i can not find the etc file stated in the pathing.

So where should i put this pg_service file and does it link with the database itself?

Thank you
Best Regards
Jun

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: pg_service file questions
@ 2023-06-20 08:27  Ron <ronljohnsonjr@gmail.com>
  parent: JUN ZHI <zhi_jun95@hotmail.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Ron @ 2023-06-20 08:27 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

On 6/20/23 01:11, JUN ZHI wrote:
> Hi,
>
> I was scanning through the postgresql documentations when i came across 
> this webpage: PostgreSQL: Documentation: 15: 34.17. The Connection Service 
> File <https://www.postgresql.org/docs/current/libpq-pgservice.html> . I am 
> fairly new to database and i have a few questions regarding this:
>
>  1. Is pg_service.conf and .pg_service.conf (with a dot at the front)
>     different files?
>  2. The documentation stated that the .pg_service.conf is named
>     %APPDATA%\postgresql.pg_service.conf on windows which is a directory i
>     can not find.
>  3. The documentation also stated that we can check for the sysconfigdir
>     environment variable and point it to somewhere else, but when i
>     checked for the sysconfigdir path, it is pointing to
>     C:/PROGRA~1/POSTGR~1/15/etc which again, is a directory i can not find
>     : to be specific, i can not find the etc file stated in the pathing.
>
> So where should i put this pg_service file and does it link with the 
> database itself?

%APPDATA% is normally hidden to users.  Here's how to show it?

https://support.microsoft.com/en-us/windows/view-hidden-files-and-folders-in-windows-97fbc472-c603-9...

-- 
Born in Arizona, moved to Babylonia.

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: pg_service file questions
@ 2023-06-20 09:06  Erik Wienhold <ewie@ewie.name>
  parent: JUN ZHI <zhi_jun95@hotmail.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Erik Wienhold @ 2023-06-20 09:06 UTC (permalink / raw)
  To: JUN ZHI <zhi_jun95@hotmail.com>; pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

> On 20/06/2023 08:11 CEST JUN ZHI <zhi_jun95@hotmail.com> wrote:
>
> I was scanning through the postgresql documentations when i came across this
> webpage:PostgreSQL: Documentation: 15: 34.17. The Connection Service File
> (https://www.postgresql.org/docs/current/libpq-pgservice.html). I am fairly
> new to database and i have a few questions regarding this:
>
> 1. Is pg_service.conf and .pg_service.conf (with a dot at the front)
> different files?

Yes, they're different files.  pg_service.conf is the global service file and
.pg_service.conf the user-specific file in your home directory.

> 2. The documentation stated that the .pg_service.conf is named
> %APPDATA%\postgresql.pg_service.conf on windows which is a directory i can
> not find.

%APPDATA% should resolve to C:/Users/<username>/AppData/Roaming

You can run echo %APPDATA% in cmd.exe or echo $env:APPDATA in PowerShell to
show the actual path.  Or enter %APPDATA% in the File Explorer address bar.

You have to create directory %APPDATA%/postgresql.

> 3. The documentation also stated that we can check for the sysconfigdir
> environment variable and point it to somewhere else, but when i checked for
> the sysconfigdir path, it is pointing to C:/PROGRA~1/POSTGR~1/15/etc which
> again, is a directory i can not find : to be specific, i can not find the etc
> file stated in the pathing.

You have to create directory etc if you want to put config files there.

> So where should i put this pg_service file and does it link with the database
> itself?

I would go with the user service file because it takes precedence over the
system-wide file.  The default path of the system-wide file only works on the
database server where Postgres is running.

What do you mean with "link with the database"?  The service is file is read by
libpq before opening a database connection.

--
Erik





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2023-06-20 09:06 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-06-20 06:11 pg_service file questions JUN ZHI <zhi_jun95@hotmail.com>
2023-06-20 08:27 ` Ron <ronljohnsonjr@gmail.com>
2023-06-20 09:06 ` Erik Wienhold <ewie@ewie.name>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox