From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Show inline comments from pg_hba lines in the pg_hba_file_rules view |
Date: | 2023-09-01 01:18:59 |
Message-ID: | ZPE8A7EnUH+ax5kw@paquier.xyz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Sep 01, 2023 at 12:01:37AM +0200, Jim Jones wrote:
> Often we make changes in the pg_hba.conf and leave a #comment there, just in
> case we forget why the change was done. To avoid having to open the
> configuration file every time just to check the comments, it would be quite
> nice to have the option to read these comments in the pg_hba_file_rules
> view. Something like adding it in the end of the line and wrapping it with
> characters like "", '', {}, [], etc
>
> For instance, this pg_hba.conf ...
>
> # TYPE DATABASE USER ADDRESS METHOD
> local all all trust [foo]
> host all all 127.0.0.1/32 trust
> host all all ::1/128 trust [bar]
> local replication all trust
> host replication all 127.0.0.1/32 trust
> hostssl replication all ::1/128 cert map=abc [this will fail
> :)]
>
> ... could be displayed like this
hba.c is complex enough these days (inclusion logic, tokenization of
the items) that I am not in favor of touching its code paths for
anything like that. This is not something that can apply only to
pg_hba.conf, but to all configuration files. And this touches in
adding support for a second type of comment format. This is one of
these areas where we may want a smarter version of pg_read_file that
returns a SRF for (line_number, line_contents) of a file read? Note
that it is possible to add comments at the end of a HBA entry already,
like:
local all all trust # My comment, and this is a correct HBA entry.
--
Michael
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Geoghegan | 2023-09-01 01:25:05 | Re: Eliminate redundant tuple visibility check in vacuum |
Previous Message | Jeff Davis | 2023-09-01 00:57:25 | Re: sandboxing untrusted code |