Re: Using hba_file parameter and relative path

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Don Seiler <don(at)seiler(dot)us>
Cc: pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Using hba_file parameter and relative path
Date: 2017-09-28 19:15:26
Message-ID: CAKFQuwbN=CHd05yTx5TAmkmFPL78veULTXcu5gnGxCgFVLpdyQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Thu, Sep 28, 2017 at 11:47 AM, Don Seiler <don(at)seiler(dot)us> wrote:

> In going through some parameter file cleanup and re-factoring, I've been
> using the hba_file parameter to specify a non-standard file location. I
> tried using a relative location, thinking it would be relative to $PGDATA
> but in actuality it is relative to the pwd of my bash session that starts
> the database.
>
> For example, if I'm in /tmp when I run "pg_ctl start", it will look for
> the hba_file value under /tmp. If I change to $PGDATA/pg_log, it will look
> under there.
>
> Obviously I can change to an absolute path and not worry about it, but I'm
> curious if this is the intended behavior.
>

​Its the documented behavior.

"​When setting any of these parameters, a relative path will be interpreted
with respect to the directory in which postgres is started."

https://www.postgresql.org/docs/9.6/static/runtime-config-file-locations.html

Why would we want that hba_file value to be relative to something as
> volatile as pwd?
>

Why do you want it under PGDATA but not in the root directory thereof?

Since there is no "config_directory" option the current behavior at least
allows the user to substitute "pwd" for "config_directory" and then set
"data_directory" separately. Seems like reasonable flexibility to cater to
the Debian-esque file system layout while leaving the typical core use case
to just set pwd == "data_directory" and drop everything in there.

In any case if you are going to use relative paths then "pwd" should be a
considered part of the architecture and not something that is considered
"volatile". That seems to be how most programs behave and I don't see much
advantage for PostgreSQL to be different in this regard.

David J.

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Don Seiler 2017-09-28 19:28:51 Re: Using hba_file parameter and relative path
Previous Message Don Seiler 2017-09-28 18:47:20 Using hba_file parameter and relative path