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 1siaNR-006d1J-5R for pgsql-hackers@arkaria.postgresql.org; Mon, 26 Aug 2024 14:07:25 +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 1siaNO-00AZHK-KJ for pgsql-hackers@arkaria.postgresql.org; Mon, 26 Aug 2024 14:07:23 +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 1siaNN-00AZGE-Vw for pgsql-hackers@lists.postgresql.org; Mon, 26 Aug 2024 14:07:22 +0000 Received: from pb-smtp21.pobox.com ([173.228.157.53]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1siaNL-001Wwx-1C for pgsql-hackers@postgresql.org; Mon, 26 Aug 2024 14:07:20 +0000 Received: from pb-smtp21.pobox.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 0F64019D10; Mon, 26 Aug 2024 10:07:17 -0400 (EDT) (envelope-from david@justatheory.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h= content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=sasl; bh= GriVfgEU5iHnN+/1a4usw/gmlYwK6kG+KF0PfaT8i9c=; b=IrlN9eROthaaHaLy hWX+Tk30Z1DzGvljGs3/m1f0P9okg5/xBDfP8Tjw+oQvVpVorvjfTSAixktQZcxH Ze3JbVJKJ8+ZzAxEMJVTGPs/uXqhRQ6SPgwQqIyRapw2W88sOhQqaqeCWkkA5Eb4 PyLye47s0VwOprW1HTiAR6OiCrY= Received: from pb-smtp21.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 089F919D0F; Mon, 26 Aug 2024 10:07:17 -0400 (EDT) (envelope-from david@justatheory.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=justatheory.com; h=content-type:mime-version:subject:from:in-reply-to:date:cc:content-transfer-encoding:message-id:references:to; s=2016-12.pbsmtp; bh=GriVfgEU5iHnN+/1a4usw/gmlYwK6kG+KF0PfaT8i9c=; b=BRMnMlRrMHJ6rXs2kI82lozBYv83O8H2p+Ej+NZ3oc515eIDZtsm9rpuM1ThFy757qOz85CCh3JBuycVRVTyrbmm+VJGgmVd7XSJvOhCpdD3M5KzbB9g+uc25qKW7Rm9FlvdchB327NscehbW5iRwA6t5z0sl4p7S6T7q55/XXM= Received: from smtpclient.apple (unknown [158.222.197.125]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp21.pobox.com (Postfix) with ESMTPSA id 8ACF719D0E; Mon, 26 Aug 2024 10:07:12 -0400 (EDT) (envelope-from david@justatheory.com) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51\)) Subject: Re: RFC: Additional Directory for Extensions From: "David E. Wheeler" In-Reply-To: Date: Mon, 26 Aug 2024 10:06:59 -0400 Cc: Gabriele Bartolini , Robert Haas , Alvaro Herrera , PostgreSQL-development Content-Transfer-Encoding: quoted-printable Message-Id: References: <202406251012.brdp2dobkf7n@alvherre.pgsql> To: Craig Ringer X-Mailer: Apple Mail (2.3776.700.51) X-Pobox-Relay-ID: 7E0CB5CA-63B4-11EF-B6F5-E92ED1CD468F-76319746!pb-smtp21.pobox.com List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Hackers, Apologies for the delay in reply; I=E2=80=99ve been at the XOXO Festival = and almost completely unplugged for the first time in ages. Happy to see = this thread coming alive, though. Thank you Gabriele, Craig, and Jelte! On Aug 21, 2024, at 19:07, Craig Ringer = wrote: > So IMO this should be a _path_ to search for extension control files > and SQL scripts. >=20 > If the current built-in default extension dir was exposed as a var > $extdir like we do for $libdir, this might look something like this > for local development and testing while working with a packaged > postgres build: >=20 > SET extension_search_path =3D $extsdir, /opt/myapp/extensions, > /usr/local/postgres/my-custom-extension/extensions; > SET dynamic_library_path =3D $libdir, /opt/myapp/lib, > /usr/local/postgres/my-custom-extension/lib I would very much like something like this, but I=E2=80=99m not sure how = feasible it is for a few reasons. The first, and most important, is that = extensions are not limited to just a control file and SQL file. They = also very often include: * one or more shared library files * documentation files * binary files And maybe more? How many of these directories might an extension install = files into: =E2=9C=A6 =E2=9D=AF pg_config | grep DIR | awk '{print $1}' BINDIR DOCDIR HTMLDIR INCLUDEDIR PKGINCLUDEDIR INCLUDEDIR-SERVER LIBDIR PKGLIBDIR LOCALEDIR MANDIR SHAREDIR SYSCONFDIR I would assume BINDIR, DOCDIR, HTMLDIR, PKGLIBDIR, MANDIR, SHAREDIR, and = perhaps LOCALEDIR. But even if it=E2=80=99s just one or two, the only proper way an = extension directory would work, IME, is to define a directory-based = structure for extensions, where every file for an extension is in a = directory named for the extension, and subdirectories are defined for = each of the above requisite file types. Something like: extension_name =E2=94=9C=E2=94=80=E2=94=80 control.ini =E2=94=9C=E2=94=80=E2=94=80 bin =E2=94=9C=E2=94=80=E2=94=80 doc =E2=94=9C=E2=94=80=E2=94=80 html =E2=94=9C=E2=94=80=E2=94=80 lib =E2=94=9C=E2=94=80=E2=94=80 local =E2=94=9C=E2=94=80=E2=94=80 man =E2=94=94=E2=94=80=E2=94=80 share This would allow multiple paths to work and keep all the files for an = extension bundled together. It could also potentially allow for multiple = versions of an extension to be installed at once, if we required the = version to be part of the directory name. I think this would be a much nicer layout for packaging, installing, and = managing extensions versus the current method of strewing files around = to a slew of different directories. But it would come at some cost, in = terms of backward with the existing layout (or migration to it), = significant modification of the server to use the new layout (and = extension_search_path), and other annoyances like PATH and MANPATH = management. Long term I think it would be worthwhile, but the current patch feels = like a decent interim step we could live with, solving most of the = integration problems (immutable servers, packaging testing, etc.) at the = cost of a slightly unexpected directory layout. What I mean by that is = that the current patch is pretty much just using extension_destdir as a = prefix to all of those directories from pg_config, so they never have to = change, but it does mean that you end up installing extensions in = something like /mnt/extensions/pg16/usr/share/postgresql/16 /mnt/extensions/pg16/usr/include/postgresql etc. Best, David