Re: [PATCH] Add inline comments to the pg_hba_file_rules view

From: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, David Zhang <david(dot)zhang(at)highgo(dot)ca>
Subject: Re: [PATCH] Add inline comments to the pg_hba_file_rules view
Date: 2023-09-14 11:33:04
Message-ID: 381eb298-92b3-9599-abe6-f04c9a151248@uni-muenster.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

On 11.09.23 00:33, Michael Paquier wrote:
> Well, it looks like what I wrote a couple of days ago was perhaps
> confusing:
> https://www.postgresql.org/message-id/ZPHAiNp%2ByKMsa/vc%40paquier.xyz
> https://www.postgresql.org/message-id/ZPE8A7EnUH+ax5kw@paquier.xyz
>
> This patch touches hbafuncs.c and the system view pg_hba_file_rules,
> but I don't think this stuff should touch any of these code paths.
> That's what I meant in my second message: the SQL portion should be
> usable for all types of configuration files, even pg_ident.conf and
> postgresql.conf, and not only pg_hba.conf. A new SQL function
> returning a SRF made of the comments extracted and the line numbers
> can be joined with all the system views of the configuration files,
> like sourcefile and sourceline in pg_settings, etc.
> --
> Michael

Thanks for the feedback.

I indeed misunderstood what you meant in the other thread, as you
explicitly only mentioned hba.c.

The change to hbafunc.c was mostly a function call and a new column to
the view:

comment = GetInlineComment(hba->rawline);
if(comment)
   values[index++] = CStringGetTextDatum(comment);
else
   nulls[index++] = true;

Just to make sure I got what you have in mind: you suggest to read the
pg_hba.conf a second time via a new (generic) function like
pg_read_file() that returns line numbers and their contents (+comments),
and the results of this new function would be joined pg_hba_file_rules
in SQL. Is that correct?

Thanks

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message jacktby jacktby 2023-09-14 11:47:14 What's the eviction algorithm of newest pg version?
Previous Message Kuwamura Masaki 2023-09-14 11:21:51 bug fix and documentation improvement about vacuumdb