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 1tAYxX-00GSGh-1I for pgsql-hackers@arkaria.postgresql.org; Mon, 11 Nov 2024 18:16:18 +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 1tAYxU-00Gnee-Hx for pgsql-hackers@arkaria.postgresql.org; Mon, 11 Nov 2024 18:16:17 +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 1tAYxT-00GneO-0d for pgsql-hackers@lists.postgresql.org; Mon, 11 Nov 2024 18:16:16 +0000 Received: from fhigh-b3-smtp.messagingengine.com ([202.12.124.154]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tAYxK-001Lj2-OG for pgsql-hackers@postgresql.org; Mon, 11 Nov 2024 18:16:14 +0000 Received: from phl-compute-12.internal (phl-compute-12.phl.internal [10.202.2.52]) by mailfhigh.stl.internal (Postfix) with ESMTP id 268C125401F0; Mon, 11 Nov 2024 13:16:05 -0500 (EST) Received: from phl-frontend-01 ([10.202.2.160]) by phl-compute-12.internal (MEProxy); Mon, 11 Nov 2024 13:16:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=justatheory.com; 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= 2016-12.pbsmtp; t=1731348964; x=1731435364; bh=1dQ4adKtx/5PiBxvH 3J5l9G9+nwZ67puMwWgWgMVq/g=; b=RLlTgy8PLms6tvVHdRaVZO5ZC6jbIiEiO yuAv5ytzgkaBrtTK24KGtBXuRSSVl0D0QgV2XAOue8WTUwXKPq52nS7NsD/tfuf+ ghOZ14yXpBwIOScwl5ni3KnBCKaoA+OMxnKIox0jSdUVWH6Er07i5g0+0B39s9C2 DU/Y6KILrU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pobox.com; 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=fm2; t=1731348964; x=1731435364; bh=1dQ4adKtx/5PiBxvH3J5l9G9+nwZ67puMwWgWgMVq/g=; b= FygmdrtQZL15fxBPDYnwZPBj0XT2PJ5f/dle0ThjmDH02WpIDrAC2oA9pPEcu9cT EEPFzT5tqT2AAbb/WMnILDZoYGoH45vDpdZu1ap5WDHPb3Kuf6OEk163xMcD7TA7 2aSZwJYAi39R9TSREDXFpCkPUVjkXhVVCYxqErEEM4NJV6DCwQ+8tYMjhhvJGrKw afq/7ygL8R9LwyF/Zbhf3pQWfZrBKkZFKeCbE0Qjxe4S81vF1gkysPAHXMymeNKB FaVt/51etNFVaGPMYBEYxBD0nvC16bWcZh0LUpMBjiJ74Y9aLrTrViLhpxhdAul6 yYp6TUwAgffzTZZI/u9yKw== 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=fm3; t=1731348964; x= 1731435364; bh=1dQ4adKtx/5PiBxvH3J5l9G9+nwZ67puMwWgWgMVq/g=; b=L 9+Ktzk4fqP810lyT4pluronIqp4LgP+5JyPV7HaZeCE5zradtPihZogr/mp5cT6j MUORxuPWSd/V1m7RbbubVIMP6cWoK483i4GL8ncQrE41aWyHg17Bo8jfNI9/W+0u 0FM3Nfo7t7jhEbQRFL82zZe3JRyi4KnqWd12Vf/wBglchwZl53yJ6wcxbgMKa5SM +ZI3M7yVhA8TuRdORUKKaWaI5ueC7j+AmI6emv7QrBtGM2bOci7Lkw37vf9IOORu u+JymTL2AGeFUFvJnExAm3q34fVYRjGEF5ixb2CUNxwylG7DvAJGojuikLOD+vDY sD/3YRD/7iV7Y78aYzMZg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddruddvgddutdelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurheptggguffhjgffvefgkfhfvffosehtqhhmtdhhtdej necuhfhrohhmpedfffgrvhhiugcugfdrucghhhgvvghlvghrfdcuoegurghvihgusehjuh hsthgrthhhvghorhihrdgtohhmqeenucggtffrrghtthgvrhhnpeefhfdvtedtgfeiueff gfefheefgefftdegfeegteejudfgieegveeiteeludfhleenucffohhmrghinhepghhith hhuhgsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhf rhhomhepuggrvhhiugesjhhushhtrghthhgvohhrhidrtghomhdpnhgspghrtghpthhtoh epiedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepphgvthgvrhesvghishgvnhht rhgruhhtrdhorhhgpdhrtghpthhtoheptghrrghighdrrhhinhhgvghrsegvnhhtvghrph hrihhsvggusgdrtghomhdprhgtphhtthhopehgrggsrhhivghlvgdrsggrrhhtohhlihhn ihesvghnthgvrhhprhhishgvuggsrdgtohhmpdhrtghpthhtoheprhhosggvrhhtmhhhrg grshesghhmrghilhdrtghomhdprhgtphhtthhopegrlhhvhhgvrhhrvgesrghlvhhhrdhn ohdqihhprdhorhhgpdhrtghpthhtohepphhgshhqlhdqhhgrtghkvghrshesphhoshhtgh hrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i7c334307:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 11 Nov 2024 13:16:04 -0500 (EST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.200.121\)) Subject: Re: RFC: Additional Directory for Extensions From: "David E. Wheeler" In-Reply-To: <0d384836-7e6e-4932-af3b-8dad1f6fee43@eisentraut.org> Date: Mon, 11 Nov 2024 13:15:53 -0500 Cc: Craig Ringer , Gabriele Bartolini , Robert Haas , Alvaro Herrera , PostgreSQL-development Content-Transfer-Encoding: quoted-printable Message-Id: <0D89C6B2-F294-4389-9DDA-07C381995292@justatheory.com> References: <202406251012.brdp2dobkf7n@alvherre.pgsql> <0d384836-7e6e-4932-af3b-8dad1f6fee43@eisentraut.org> To: Peter Eisentraut X-Mailer: Apple Mail (2.3826.200.121) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Nov 11, 2024, at 02:16, Peter Eisentraut = wrote: > I implemented a patch along the lines Craig had suggested. Oh, nice, thank you. > It's a new GUC variable that is a path for extension control files. = It's called extension_control_path, and it works exactly the same way as = dynamic_library_path. Except that the magic token is called $system = instead of $libdir. I assume we can bikeshed these names later. :-) > In fact, most of the patch is refactoring the routines in dfmgr.c to = not hardcode dynamic_library_path but allow searching for any file in = any path. Once a control file is found, the other extension support = files (script files and auxiliary control files) are looked for in the = same directory. What about shared libraries files? > This works pretty much fine for the use cases that have been presented = here, including installing extensions outside of the core installation = tree (for CNPG and Postgres.app) and for testing uninstalled extensions = (for Debian). If I understand correctly, shared modules still lie in = dynamic_library_path, yes? That makes things a bit more complicated, as = the CNPG use case has to set up multiple persistent volumes to persist = files put into various directories, notably sharedir and pkglibdir. > - You can install extensions into alternative directories using PGXS = like >=20 > make install datadir=3D/else/where/share pkglibdir=3D/else/where/lib >=20 > This works. I was hoping it would work to use >=20 > make install prefix=3D/else/where >=20 > but that doesn't because of some details in Makefile.global. I think = we can tweak that a little bit to make that work too. In the broader extension organization RFC I=E2=80=99ve been working = up[1], I propose a new Makefile prefix for the destination directory for = an extension. It hinges on the idea that an extension has all of its = files organized in a directory with the extension name, rather than = separate params for data, pkglib, bin, etc. > - With the current patch, if you install into = datadir=3D/else/where/share, then you need to set = extension_control_path=3D/else/where/share/extension. This is a bit = confusing. Maybe we want to make the "extension" part implicit. +1 > - The biggest problem is that many extensions set in their control = file >=20 > module_pathname =3D '$libdir/foo' >=20 > This disables the use of dynamic_library_path, so this whole idea of = installing an extension elsewhere won't work that way. The obvious = solution is that extensions change this to just 'foo'. But this will = require a lot updating work for many extensions, or a lot of patching by = packagers. Since that=E2=80=99s set at build/install time, couldn=E2=80=99t the = definition of `$libdir` here be changed to mean =E2=80=9Cthe directory = into which it=E2=80=99s being installed right now?=E2=80=9D. Doesn=E2=80=99= t seem necessary to search a path if the specific location is set at = install time. > Maybe we could devise some sort of rule that if the extension control = file is found via the path outside of $system, then the leading $libdir = is ignored. > This is what I propose,[1] yes. If we redefine the organization of = extension files to live in a single directory named for an extension, = then once you=E2=80=99ve found the control files all the other files are = there, too. But `$libdir` is presumably still meaningful, since the = first time you call an extension function in a new connection, it just = tries to load that location, it doesn=E2=80=99t go through the control = file search process, AFAIK. Perhaps I misunderstand, but I would like to talk through the = implications of a more radical rethinking of extension file location = along the lines of the other thread[2] and the RFC I=E2=80=99m working = up based on them both[1], especially since there are a few other use = cases that inform it. A notable one is the idea Gabriele shared with me in Athens to be able = to add an extension to a running CNPG pod by simply mounting a read-only = volume with all the files it requires. Best, David [1]: https://github.com/theory/justatheory/pull/7/files