Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qgkau-00HB1N-BA for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Sep 2023 11:33:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qgkas-007wjv-Ry for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Sep 2023 11:33:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qgkas-007wjg-HW for pgsql-hackers@lists.postgresql.org; Thu, 14 Sep 2023 11:33:10 +0000 Received: from udcm-wwu1.uni-muenster.de ([128.176.118.7]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qgkao-0051rj-V1 for pgsql-hackers@lists.postgresql.org; Thu, 14 Sep 2023 11:33:09 +0000 X-IronPort-AV: E=Sophos;i="6.02,145,1688421600"; d="scan'208";a="290140707" Received: from secmail.uni-muenster.de ([128.176.118.4]) by UDCM-RELAY1.UNI-MUENSTER.DE with ESMTP; 14 Sep 2023 13:33:06 +0200 Received: from [192.168.178.27] (dynamic-093-133-011-164.93.133.pool.telefonica.de [93.133.11.164]) by SECMAIL.UNI-MUENSTER.DE (Postfix) with ESMTPSA id E99E320EBC50; Thu, 14 Sep 2023 13:33:04 +0200 (CEST) Message-ID: <381eb298-92b3-9599-abe6-f04c9a151248@uni-muenster.de> Date: Thu, 14 Sep 2023 13:33:04 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: [PATCH] Add inline comments to the pg_hba_file_rules view To: Michael Paquier Cc: PostgreSQL Hackers , David Zhang References: <4d623899-36ac-71b5-311d-2a4672d75736@uni-muenster.de> Content-Language: en-US From: Jim Jones In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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