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

2023-09-28 Thread Jim Jones
Hi Daniel On 27.09.23 10:21, Daniel Gustafsson wrote: An annotation syntax specifically for this would address my concern, but the argument that pg_hba (and related code) is border-line too complicated as it is does hold some water. Complexity in code can lead to bugs, but complexity in syntax

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

2023-09-27 Thread Daniel Gustafsson
> On 26 Sep 2023, at 20:40, Jim Jones wrote: > Do you think that this feature is in general not a good idea? I wouldn't rule it out as a bad idea per se. As always when dealing with access rules and pg_hba there is a security angle to consider, but I think that could be addressed. > Or perhaps

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

2023-09-26 Thread Jim Jones
Hi! On 26.09.23 15:19, Peter Eisentraut wrote: On 04.09.23 11:54, Jim Jones wrote: This patch proposes the column "comment" to the pg_hba_file_rules view. It basically parses the inline comment (if any) of a valid pg_hba.conf entry and displays it in the new column. For such pg_hba entries .

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

2023-09-26 Thread Greg Sabino Mullane
Also a reluctant -1, as the comment-at-EOL style is very rare in my experience over the years of seeing many a pg_hba file.

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

2023-09-26 Thread Daniel Gustafsson
> On 26 Sep 2023, at 15:19, Peter Eisentraut wrote: > > On 04.09.23 11:54, Jim Jones wrote: >> This patch proposes the column "comment" to the pg_hba_file_rules view. It >> basically parses the inline comment (if any) of a valid pg_hba.conf entry >> and displays it in the new column. >> For suc

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

2023-09-26 Thread Peter Eisentraut
On 04.09.23 11:54, Jim Jones wrote: This patch proposes the column "comment" to the pg_hba_file_rules view. It basically parses the inline comment (if any) of a valid pg_hba.conf entry and displays it in the new column. For such pg_hba entries ... host db jim 127.0.0.1/32 md5 # foo host db ji

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

2023-09-19 Thread Jim Jones
Hi Michael On 16.09.23 06:18, Michael Paquier wrote: That was the idea. I forgot about strpos(), but if you do that, do we actually need a function in core to achieve that? I guess it depends who you ask :) I personally think it would be a good addition to the view, as it would provide a more

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

2023-09-15 Thread Michael Paquier
On Fri, Sep 15, 2023 at 09:37:23AM +0200, Jim Jones wrote: > SELECT type, database, user_name, address, c.comment > FROM  pg_hba_file_rules h, pg_read_conf_comments(h.file_name) c > WHERE user_name[1]='jim' AND h.line_number = c.line_number ; > >  type | database | user_name |  address  | comment

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

2023-09-15 Thread Jim Jones
On 15.09.23 01:28, Michael Paquier wrote: Yes, my suggestion was to define a new set-returning function that takes in input a file path and that returns as one row one comment and its line number from the configuration file. -- Michael Thanks! If reading the file again is an option, perhaps a

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

2023-09-14 Thread Michael Paquier
On Thu, Sep 14, 2023 at 01:33:04PM +0200, Jim Jones wrote: > 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

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

2023-09-14 Thread Jim Jones
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+ax...@paquier.xyz This patch touches hbafuncs.c and t

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

2023-09-10 Thread Michael Paquier
On Mon, Sep 04, 2023 at 12:54:15PM +0200, Jim Jones wrote: > The patch slightly changes the test 004_file_inclusion.pl to accommodate the > new column and the hba comments. > > Discussion: > https://www.postgresql.org/message-id/flat/3fec6550-93b0-b542-b203-b0054aaee83b%40uni-muenster.de Well, i

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

2023-09-09 Thread Jim Jones
Hi David On 09.09.23 01:52, David Zhang wrote: This is a very useful feature. I applied the patch to the master branch, and both make check and make check-world passed without any issues. Thanks for reviewing this patch! Since "only the first #" and "any leading spaces" are removed, IMO,

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

2023-09-08 Thread David Zhang
This is a very useful feature. I applied the patch to the master branch, and both make check and make check-world passed without any issues. Just one comment here, based on the example below, host db jim 127.0.0.1/32 md5 # #foo# ... it returns the following pg_hba_file_rules records: pos

[PATCH] Add inline comments to the pg_hba_file_rules view

2023-09-04 Thread Jim Jones
Hi, This patch proposes the column "comment" to the pg_hba_file_rules view. It basically parses the inline comment (if any) of a valid pg_hba.conf entry and displays it in the new column. For such pg_hba entries ... host db jim 127.0.0.1/32 md5 # foo host db jim 127.0.0.1/32 md5 #bar host d