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 1ts20X-00DUqy-K5 for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Mar 2025 15:59:05 +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 1ts20W-001VwW-B2 for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Mar 2025 15:59:04 +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 1ts20V-001Vu9-Db for pgsql-hackers@lists.postgresql.org; Tue, 11 Mar 2025 15:59:04 +0000 Received: from fout-a4-smtp.messagingengine.com ([103.168.172.147]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ts20T-002FsH-0J for pgsql-hackers@postgresql.org; Tue, 11 Mar 2025 15:59:02 +0000 Received: from phl-compute-08.internal (phl-compute-08.phl.internal [10.202.2.48]) by mailfout.phl.internal (Postfix) with ESMTP id 0EFEB1382D55; Tue, 11 Mar 2025 11:59:00 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-08.internal (MEProxy); Tue, 11 Mar 2025 11:59:00 -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=1741708740; x=1741795140; bh=ztuTz3MmUqsaSK63tUfo4a9VpJDaE5UL 5MOp3NSmCwQ=; b=YZO6xpRqA4HgPnl/xEheJsAvwb8OlPnD7097EW+MqmVZjjMm J5FMKnIp9hnSHLLahc9Ru8ExnLkRpICqsckot0XUF4ajZaJP5Dg9Rvp9FeXnQjbo wc5J2GACoHmTMyYFNP5iOoWdYTmlNbIV+bZHs2mpwU1QueuJuzjDy2uPCHcvwui9 HhAmcDwySFi30H+rPl4chlAD+ZBuAKbEqDE0tRkSaDg8Xvnb0tgecwfJCHxuW6Bv 76Nvb/uKzCiEKOsqUevXC7rQsYxNTAU1iZcenk9f7EuuZJg/qM1NESAyK6CQE0YJ ltUu8Z+BAu1P3ntUPa6HVMXLAdpYZczZlKKQFg== 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=1741708740; x= 1741795140; bh=ztuTz3MmUqsaSK63tUfo4a9VpJDaE5UL5MOp3NSmCwQ=; b=c cIVywyLrKuV1Ya404OM+AYHhEw+mH12p4y+ddoQ8AYcyPuvJ6PAHnJljK3kYAFoD VDmZnS7S3Jp2N7D1yYemIO40JPTB6+UFRC8kPbHQ5xpjCSYlp2tjXfpXL3H2sCQS MQvA3DRuGF2wTDSxNfPKxITbp5G/FrdoLveQ2VjvOptpWv49aBwvbWgsQBteFUaZ lFkmh1djaDmM2WdsiBiMcTsKwzmwyHwqgJijQE4l2df3zg3golGnlTPYk3+RUnXJ t+HENFieuZ1Rs/e6a7r0HwRQ7ME5FtK8goJez3jP4IKYBaFO9d+muykbm9akDqWI HYq8J6yLm7OhgjGl0BKNA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduvddvieehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddt vdejnecuhfhrohhmpefrvghtvghrucfgihhsvghnthhrrghuthcuoehpvghtvghrsegvih hsvghnthhrrghuthdrohhrgheqnecuggftrfgrthhtvghrnhepjefhveehtdetgfffhffh feefgffghffflefgieeuueekhedvhedvfeehffdvfeeunecuvehluhhsthgvrhfuihiivg 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; Tue, 11 Mar 2025 11:58:57 -0400 (EDT) Message-ID: <7c178ff3-20a5-493e-a704-e6b3263e782f@eisentraut.org> Date: Tue, 11 Mar 2025 16:58:55 +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> Content-Language: en-US From: Peter Eisentraut 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 On 10.03.25 21:25, Matheus Alcantara wrote: > On Thu, Mar 6, 2025 at 10:46 AM Peter Eisentraut wrote: >> This looks very good to me. I have one issue to point out: The logic >> in get_extension_control_directories() needs to be a little bit more >> careful to align with the rules in find_in_path(). For example, it >> should use first_path_var_separator() to get the platform-specific path >> separator, and probably also substitute_path_macro() and >> canonicalize_path() etc., to keep everything consistent. >> > I fixed this hardcoded path separator issue on the TAP test and forgot > to fix it also on code, sorry, fixed on this new version. >> (Maybe it would be ok to move the function to dfmgr.c to avoid having >> to export too many things from there.) >> > I've exported substitute_path_macro because adding a new function on > dfmgr would require #include nodes/pg_list.h and I'm not sure what > approach would be better, please let me know what you think. Yes, that structure looks ok. But you can remove one level of block in get_extension_control_directories(). I found a bug that was already present in my earlier patch versions: @@ -423,7 +424,7 @@ find_extension_control_filename(ExtensionControlFile *control) ecp = Extension_control_path; if (strlen(ecp) == 0) ecp = "$system"; - result = find_in_path(basename, Extension_control_path, "extension_control_path", "$system", system_dir); + result = find_in_path(basename, ecp, "extension_control_path", "$system", system_dir); Without this, it won't work if you set extension_control_path empty. (Maybe add a test for that?) I think this all works now, but I think the way pg_available_extensions() works is a bit strange and inefficient. After it finds a candidate control file, it calls read_extension_control_file() with the extension name, that calls parse_extension_control_file(), that calls find_extension_control_filename(), and that calls find_in_path(), which searches that path again! 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.