Re: RFC: Additional Directory for Extensions

David E. Wheeler <david@justatheory.com>

From: "David E. Wheeler" <david@justatheory.com>
To: Andrew Dunstan <andrew@dunslane.net>
Cc: Peter Eisentraut <peter@eisentraut.org>, PostgreSQL-development <pgsql-hackers@postgresql.org>, Gabriele Bartolini <gabriele.bartolini@enterprisedb.com>, Craig Ringer <craig.ringer@enterprisedb.com>, Robert Haas <robertmhaas@gmail.com>, Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: 2025-02-05T18:13:25Z
Lists: pgsql-hackers
Hi Andrew,

On Feb 4, 2025, at 15:34, Andrew Dunstan <andrew@dunslane.net> wrote:

>> I see. I confirm that works. Still, don’t all the other parameters work when passed to any/all targets? Should this one have an extension-specific name?
> 
> IDK, I don't understand what you think you're saying when you specify --prefix to an extension build (as opposed to an install).

I am unfamiliar with that option. Although `prefix` is mentioned in the PGXS docs[1] in the context of other variables, it is not itself documented, neither as `prefix=` as Peter suggests, nor as `--prefix`.

At any rate, all the other PGXS variables I’ve used have worked with all the make targets, though they obviously don’t necessarily change the behavior of all of the targets.

>> ISTM it does more harm than good. The location of extension files should be highly predictable. I think the search path functionality mitigates the need for this parameter, and it should be dropped.
> 
> I agree that we should either drop the "directory" directive or fix this patch so it doesn't break it. I have never used the directive, not sure I was even aware of its existence, so I have no objection to dropping it.

I only just started using it, thinking it keeps things better organized. But it’s honestly a bit confusing, in that one must set both the `MODULEDIR` variable in the `Makefile` and the `directory` variable in the control file.

Best,

David

[1]: https://www.postgresql.org/docs/current/extend-pgxs.html

Commits

  1. doc: Flesh out extension docs for the "prefix" make variable

  2. Fix extension control path tests

  3. extension_control_path