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 1tun8h-00Bamv-It for pgsql-hackers@arkaria.postgresql.org; Wed, 19 Mar 2025 06:42:56 +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 1tun8f-00F3TL-G0 for pgsql-hackers@arkaria.postgresql.org; Wed, 19 Mar 2025 06:42:53 +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 1tun8e-00F3Sq-LQ for pgsql-hackers@lists.postgresql.org; Wed, 19 Mar 2025 06:42:53 +0000 Received: from fhigh-b4-smtp.messagingengine.com ([202.12.124.155]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tun8c-003eHe-1q for pgsql-hackers@postgresql.org; Wed, 19 Mar 2025 06:42:51 +0000 Received: from phl-compute-07.internal (phl-compute-07.phl.internal [10.202.2.47]) by mailfhigh.stl.internal (Postfix) with ESMTP id 410E72540160; Wed, 19 Mar 2025 02:42:49 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-07.internal (MEProxy); Wed, 19 Mar 2025 02:42:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eisentraut.org; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=fm3; t=1742366569; x=1742452969; bh=BwomJET/azXDMC3WaeWvFReoQnojTDQ2 /1rhIA6UXHA=; b=Bj+9VhowcQ4+uKk+zLMreJQqpU9F0JHXo7TtICjfmGLLrlKP yASgwDJxhadPd0WbWBiDaRARZtumPaeMByl7BYePIUKb0QJbRxESpWjGrHSW1qg1 rTbtiDtY7e86axzvL0HSlYU63udn+845uvGz6I4KtAiBRuoFbg5acnHpUGgfc7nZ EaLmRC43kWbmkd4w23m5ZueSFwATq3rgVoOQ0lNYwOiD5yxw/ooT0DqporUGl3zR GFTnfy35v4aBX6OHNDvzQ2KfinSOFqClHPzhWi4mc3wozBkgI6MbeP7N1d+DLJx/ Wcg2h680mY7A5oR+z0n1ekZ081DtlqPEvCqqeg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1742366569; x= 1742452969; bh=BwomJET/azXDMC3WaeWvFReoQnojTDQ2/1rhIA6UXHA=; b=q RPkJGdYK9bH8xByYObdZEipddBVs1LonOOZu4qAMtDoCRmIBv8KC/lk91USqR3hC 3xTp2EXpe/1e1SHcjLX7/y94YEv178zsNQ7V52vbNYbZ97r3oBjZ+qJ2euqcfRQd c2cb0+NVjPUL0qWbIf/gj2B+6+Xz0rrohTNegx4wwJiZ95Xid1cNRjRfnBKLWtJP X/KTIyDWrzS+7+1uAeiSGHS5hon/RDTSfCpyRICuelF3Dupzf5QDNHZ8d/pacRnF w+0FFR411K1h87fUsHZfMubH+bIw90wVSrNLbauSoZQkhLD9nJVwk+zHd0xDodlq lfWioU+pIloZJwvYyFICg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddugeegieegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddt vdejnecuhfhrohhmpefrvghtvghrucfgihhsvghnthhrrghuthcuoehpvghtvghrsegvih hsvghnthhrrghuthdrohhrgheqnecuggftrfgrthhtvghrnhepgfejtdfhkeeftdeugfei leehteeljeeghfeuledthfeutedvffdukeefjefhgeehnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomhepphgvthgvrhesvghishgvnhhtrhgruhht rdhorhhgpdhnsggprhgtphhtthhopeekpdhmohguvgepshhmthhpohhuthdprhgtphhtth hopehmrghthhgvuhhsshhsihhlvheljeesghhmrghilhdrtghomhdprhgtphhtthhopegr nhgurhgvfiesughunhhslhgrnhgvrdhnvghtpdhrtghpthhtohepghgrsghrihgvlhgvrd gsrghrthholhhinhhisegvnhhtvghrphhrihhsvggusgdrtghomhdprhgtphhtthhopegt rhgrihhgrdhrihhnghgvrhesvghnthgvrhhprhhishgvuggsrdgtohhmpdhrtghpthhtoh epuggrvhhiugesjhhushhtrghthhgvohhrhidrtghomhdprhgtphhtthhopehrohgsvghr thhmhhgrrghssehgmhgrihhlrdgtohhmpdhrtghpthhtoheprghlvhhhvghrrhgvsegrlh hvhhdrnhhoqdhiphdrohhrghdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgvrhhssehp ohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: ie0a040ee:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 19 Mar 2025 02:42:47 -0400 (EDT) Message-ID: <28e98657-9369-4539-9e06-9124d1e77853@eisentraut.org> Date: Wed, 19 Mar 2025 07:42:44 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: RFC: Additional Directory for Extensions To: Matheus Alcantara Cc: Andrew Dunstan , Gabriele Bartolini , Craig Ringer , "David E. Wheeler" , Robert Haas , Alvaro Herrera , PostgreSQL-development References: <0d384836-7e6e-4932-af3b-8dad1f6fee43@eisentraut.org> <4f7209ba-1ca2-475e-9a70-0f3fe0be6378@eisentraut.org> <12312928-5516-49b8-81c1-a7b56fd01bc8@dunslane.net> <38c53446-6b65-4222-b76b-351e56f4841c@eisentraut.org> <7c178ff3-20a5-493e-a704-e6b3263e782f@eisentraut.org> Content-Language: en-US From: Peter Eisentraut In-Reply-To: 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 12.03.25 14:17, Matheus Alcantara wrote: >> There should be a simpler way into this. Maybe >> pg_available_extensions() should fill out the ExtensionControlFile >> structure itself, set ->control_dir with where it found it, then call >> directly to parse_extension_control_file(), and that should skip the >> finding if the directory is already set. Or something similar. >> > Good catch. I fixed this by creating a new function to construct the > ExtensionControlFile and changed the pg_available_extensions to set the > control_dir. The read_extension_control_file was also changed to just > call this new function constructor. I implemented the logic to check if > the control_dir is already set on parse_extension_control_file because > it seems to me that make more sense to not call > find_extension_control_filename instead of putting this logic there > since we already set the control_dir when we find the control file, and > having the logic to set the control_dir or skip the find_in_path seems > more confusing on this function instead of on > parse_extension_control_file. Please let me know what you think. Committed that, thanks. A small tweak I made was to replace palloc+snprintf by psprintf. Maybe you were not aware that that function exists. I also simplified the error handling in parse_extension_control_file() a bit. If we pass in a control directory (which is the new code we're adding), then we can assume that we already found the file earlier, and then if we now don't find it, then we should just report the file system error instead of the "you should install this extension first" error. It's kind of a "can't happen" error anyway, so the different is small.