Hi Michael
On 01.09.23 03:18, Michael Paquier wrote:
> 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.
It is indeed possible to extrapolate it to any configuration file, but
my point was rather to visualize comments purposefully left by the DBA
regarding user access (pg_hba and pg_ident).
> 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.
I also considered parsing the inline #comments - actually it was my
first idea - but I thought it would leave no option to make an inline
comment without populating pg_hba_file_rules. But I guess in this case
one could always write the comment in the line above :)
Would you be in favor of parsing #comments instead? Given that # is
currently already being parsed (ignored), it shouldn't add too much
complexity to the code.
Thanks for the feedback.
Jim