Subject: Re: RFC: Additional Directory for Extensions

From: "David E. Wheeler" <[email-masked]>
Date: Thu, 24 Apr 2025 18:59:12 -0400

On Mar 19, 2025, at 13:29, David E. Wheeler <[email-masked]> wrote:

> I think this should at least be documented, but generally feels unexpected to me. I’ve attached a patch that fleshes out the docs, along with an example of setting `extension_control_path` and `dynamic_library_path` to use the locations. It might not have the information right about the need for “postgresql” or “pgsql” in the path. Back in 2003[1] it was just “postgres”, but I couldn’t find the logic for it just now.

Here’s a rebase.

Best,

David

---

From: Christoph Berg <[email-masked]>
Date: Fri, 25 Apr 2025 13:33:22 +0200

Re: David E. Wheeler
> +<programlisting>
> +make install prefix=/etc/postgresql

I'd use /usr/local/postgresql there. "/etc" is just wrong.

> +</programlisting>
> +    This will install the control SQL files into
> +    <literal>/etc/postgresql/share</literal> and shared modules into
> +    <literal>/etc/postgresql/lib</literal>. If the prefix does not
> +    include the strings <literal>postgresql</literal> or

Just "postgres", see src/Makefile.global.in:86.

> +    <literal>pgsql</literal>, such as:
> +<programlisting>
> +make install prefix=/etc/extras

/usr/local/extras

> +</programlisting>
> +    Then the <literal>postgresql</literal> directory will be appended io the
> +    prefix, installing the control SQL files into

"the extension control and SQL files"

> +    <literal>/etc/extras/postgresql/share</literal> and shared modules into

.../postgresql/share/extension because ...

> +    <literal>/etc/extras/postgresql/lib</literal>. Either way, you'll need to
> +    set <xref linkend="guc-extension-control-path"/> and <xref
> +    linkend="guc-dynamic-library-path"/> to allow
> +    <productname>PostgreSQL</productname> to find the files:
> +</programlisting>
> +extension_control_path = '/etc/extras/postgresql/share/extension:$system'

... it's used here.

Christoph

---

From: "David E. Wheeler" <[email-masked]>
Date: Fri, 25 Apr 2025 15:23:47 -0400

> I'd use /usr/local/postgresql there. "/etc" is just wrong.

Thank you for the review. Here’s v3*.

Best,

David

* Also reviewable as a GitHub PR[1].

[1]: https://github.com/theory/postgres/pull/10

---

From: "David E. Wheeler" <[email-masked]>
Date: Mon, 28 Apr 2025 17:14:58 -0400

> Thank you for the review. Here’s v3*.

V4 removes “/extension” from the end of the `extension_control_path` value.

Best,

David

---

From: Peter Eisentraut <[email-masked]>
Date: Thu, 1 May 2025 13:50:37 +0200

> V4 removes “/extension” from the end of the `extension_control_path` value.

The documentation in config.sgml says:

     Note that the path elements should typically end in
     <literal>extension</literal> if the normal installation layouts are
     followed.

So I think your change here between v3 and v4 is incorrect.

---

From: "David E. Wheeler" <[email-masked]>
Date: Thu, 1 May 2025 10:31:28 -0400

> So I think your change here between v3 and v4 is incorrect.

Right, sorry, forgot about that, I updated it in anticipation of Matheus’s patch[1] being committed.

So v3 is fine for now, but if that patch is committed, we’ll need to reconcile those docs.

Best,

David

[1]: https://postgr.es/m/CAFY6G8dUXHRii5rNy7V8WmBrmBwp9W7y3g+HL6Tn-Lu8KkvK=[email-masked]

---

From: Peter Eisentraut <[email-masked]>
Date: Thu, 1 May 2025 22:24:20 +0200

> So v3 is fine for now, but if that patch is committed, we’ll need to reconcile those docs.

I see.  I have committed it now describing the current state.

Btw., the shown directory names that illustrate how "postgresql" is 
appended were not correct.  I have corrected that.

---

From: "David E. Wheeler" <[email-masked]>
Date: Thu, 1 May 2025 17:01:52 -0400

On May 1, 2025, at 16:24, Peter Eisentraut <[email-masked]> wrote:

> Btw., the shown directory names that illustrate how "postgresql" is appended were not correct. I have corrected that.

Thank you. I gotta say I find them confusing TBH.

Best,

David

---

From: "David E. Wheeler" <[email-masked]>
Date: Fri, 2 May 2025 12:48:35 -0400

> I see.  I have committed it now describing the current state.

Quick follow-up to tweak a couple of commas.

--- a/doc/src/sgml/extend.sgml
+++ b/doc/src/sgml/extend.sgml
@@ -1813,8 +1813,8 @@ include $(PGXS)
 
    <para>
     You can select a separate directory prefix in which to install your
-    extension's files, by setting the <command>make</command> variable
-    <varname>prefix</varname> when executing <literal>make install</literal>
+    extension's files by setting the <command>make</command> variable
+    <varname>prefix</varname> when executing <literal>make install</literal>,
     like so:
 <programlisting>
 make install prefix=/usr/local/postgresql

Best,

David