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 1twHsV-00CUjH-7R for pgsql-hackers@arkaria.postgresql.org; Sun, 23 Mar 2025 09:44:23 +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 1twHsT-00DQgo-Jh for pgsql-hackers@arkaria.postgresql.org; Sun, 23 Mar 2025 09:44:21 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1twHsT-00DQgg-7T for pgsql-hackers@lists.postgresql.org; Sun, 23 Mar 2025 09:44:21 +0000 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1twHsR-000eQ1-20 for pgsql-hackers@postgresql.org; Sun, 23 Mar 2025 09:44:20 +0000 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-43d04dc73b7so36733415e9.3 for ; Sun, 23 Mar 2025 02:44:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742723058; x=1743327858; darn=postgresql.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=ZZF655cLYEZkEH1AAxEID1ahOP5txVajfRNOBAXQWnU=; b=nCWMIuj2FxY+9IzshMF0tQ2+iGvgCYMdE/H/KqhoGdbyqN/FFzQWnlEwkdEi6pwlhI Lp30YuFHL+/Eq0X++USDq5JYgpgSGjY2KjTQ75a4ocYMU9Qebosh/ojZUTrWHQMQcwQw V+E5ck9A1HsLqz/TRd/P4d0paCpR0tbO2XMtZD/P4RFbeP7W1fU+d4QU8IeSV8nxRIn8 5/uzg025GrSX3aVVaLkdpAJ0CHAu1QgcV7gf/xIkvczCzdoiBj1NVCFuThcOTBBhR1EV ClpG5F49NBtnd8TFn/9TsTR/QfX3NpIfJhuhOk1QSvIN9PE02bblCAhEHi6tTJDtNYkt 0dYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742723058; x=1743327858; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZZF655cLYEZkEH1AAxEID1ahOP5txVajfRNOBAXQWnU=; b=n+sN1R2oigyxQhJsKAd3WNgfs37NBwGqQOf2dGCzw/TJVfVkID0dX1sG1kNzEKM/FF xn97FWdyetJPUaxTQIXJA+zpimbXQRT55nO61kGdabbjFk3S7m+OyUnZlrAV1V6/RHZY N0FEDeLeM0UWNpnecivFNif+jPsIgsWWkOxhJUAUS5+jGQ7ktc+VvgrpERBJ1TEIza3i ZH1DDwockPY6xKCLvpk8OXnTx1GJw4b6Obr3BFFoTnW4wCAIg29e5RxcJT2KBQxksV5G 0SQeXk3ek9qAiWJcPoJbUlZ/b7xwDMo1EodHUb9sdRIxYNmZZy4VkFClP+fZfuPNS1Qc YaiA== X-Forwarded-Encrypted: i=1; AJvYcCUQxeckgbRwd2fapYQCokVGIvOvBKgBAPY6JudD3Vf/EdkvZd6bfpVvWZhQrbbCSRodWyQkgVhEoYPQoVz5@postgresql.org X-Gm-Message-State: AOJu0Yx9O7NzSwLa3jLbXFVw8H9IT4zLpLghutOC7oUnNMNmhttjlgmK qrvgV4NZHBv4GthOiBVUNUgPr9ipQ594l1228VKQpW+cJq4c1b7r X-Gm-Gg: ASbGncu/FLmbQkO376Rkh5PEXiNpiBEz68CFz17kNeqZEoW7tGq45s40ZmeDSpxVTUB ktpAuHI+LdEeqwE6ODXPFZIwbeeT/VoQSk5KWk3I41vk2dwXHm6Cz3RT+pDXugmHeeauCRdptEi m1tyJirJTTZjGwbxIl8A7vAyE/TtBU0MXB2ptMkLH5mlUlOPZwXGoaelp1sl+HcoKoSGgIsY344 F1YuOTk3obfUGAA/wxrNQ0UkE6cNmPO6kR9WUWskSZw+R70CF69vylnH+JDYmSEdmwi20WAp92h d77xOLTMvrL/knQfy5ItGH2eq2SVslIwXhnhlnR9tPDTFZQldGhnwNM9+9aQb/V5J4y6SZQA9SA IICc= X-Google-Smtp-Source: AGHT+IE1vV2Ac017zUbBswwJxXi10xBLjcObXZ9nuY4jY9+eapudp4jBfixF4fMx6ZHZ7VKR1D/uWg== X-Received: by 2002:a05:600c:4e4a:b0:43d:2313:7b54 with SMTP id 5b1f17b1804b1-43d509e0d14mr96154845e9.3.1742723057510; Sun, 23 Mar 2025 02:44:17 -0700 (PDT) Received: from [192.168.0.89] (84.123.232.230.dyn.user.ono.com. [84.123.232.230]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43d43d7c6a5sm132842315e9.0.2025.03.23.02.44.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 23 Mar 2025 02:44:17 -0700 (PDT) Message-ID: Date: Sun, 23 Mar 2025 10:44:16 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Add Postgres module info To: Tom Lane Cc: Michael Paquier , Alexander Korotkov , Yurii Rashkovskii , PostgreSQL-development References: <506788.1733941263@sss.pgh.pa.us> <2c215c98-f713-4c5b-b21a-a4b8fa41890b@gmail.com> <556341.1733967371@sss.pgh.pa.us> <0844622e-9967-409a-8038-470a36f1039c@gmail.com> <8b81a3c0-761f-4cfb-97c6-68819fe4d282@gmail.com> <982748.1734059835@sss.pgh.pa.us> <0e82bf8c-ae70-498d-861e-dba2bb154cad@gmail.com> <29d29c3e-ac9e-48cc-87b4-b1cfd8c2ede8@gmail.com> <992ec366-5c0d-4f23-a02e-30e663613f44@gmail.com> <4476e8cd-6427-4470-98a8-8d61b82d8b1e@gmail.com> <441661.1742683797@sss.pgh.pa.us> Content-Language: en-AU From: Andrei Lepikhov In-Reply-To: <441661.1742683797@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 3/22/25 23:49, Tom Lane wrote: > I spent awhile reviewing the v5 patch, and here's a proposed v6. > Some notes: > > * I didn't like depending on offsetof(Pg_magic_struct, module_extra) > to determine which parts of the struct are checked for compatibility. > It just seems way too easy to break that with careless insertion > of new fields, and such breakage might not cause obvious failures. > I think the right thing is to break out the ABI-checking fields as > their own sub-struct, rather than breaking out the new fields as a > sub-struct. Agree. It is a clear approach. I like it. > > * I renamed the inquiry function to pg_get_loaded_modules, since > it only works on loaded modules but that's hardly clear from the > previous name. +1 > > * It is not clear to me what permission restrictions we should put > on pg_get_loaded_modules, ... I vote for the idea of stripping the full path to just a filename. My initial use cases were: 1. User reports the issue and need to provide me all loaded modules at the moment of query execution. Higher privileges needs administrative procedures that is a long way and not all the time possible. 2. A module needs to detect another loaded module - it is not a frequent case so far, but concurrency on queryId with pg_stat_statements is at least one of my examples happening sometimes. Also, permissions here should be in agreement with permissions on pg_available_extensions(), right? > > * I didn't like anything about the test setup. ... Ok, thanks. I just played with alternatives. > > Still TBD: > > * I'm not happy with putting pg_get_loaded_modules into dfmgr.c. > It feels like the wrong layer to have a SQL-callable function, > and the large expansion in its #include list is evidence that we're > adding functionality that doesn't belong there. But I'm not quite > sure where to put it instead. Also, the naive way to do that would > require exporting DynamicFileList which doesn't feel nice either. > Maybe we could make dfmgr.c export some sort of iterator function? I just attempted to reduce number of exported objects here. If it is ok to introduce an iterator, the pg_get_loaded_modules() may live in extension.c > > * Should we convert our existing modules to use PG_MODULE_MAGIC_EXT? > I'm mildly in favor of that, but I think we'd need some automated way > to manage their version strings, and I don't know what that ought to > look like. Maybe it'd be enough to make all the in-core modules use > PG_VERSION as their version string, but I think that might put a dent > in the idea of the version strings following semantic versioning > rules. Yes, additional burden to bump version string was a stopper for me to propose such a brave idea. -- regards, Andrei Lepikhov