Re: Include extension path on pg_available_extensions - Mailing list pgsql-hackers

From Matheus Alcantara
Subject Re: Include extension path on pg_available_extensions
Date
Msg-id DDPWL1B42NIW.NG8R2KXJULDD@gmail.com
Whole thread Raw
In response to Re: Include extension path on pg_available_extensions  (Quan Zongliang <quanzongliang@yeah.net>)
List pgsql-hackers
Thanks for testing this!

On Wed Oct 22, 2025 at 9:19 PM -03, Quan Zongliang wrote:
> On 9/16/25 8:18 AM, Matheus Alcantara wrote:
>
>> Any opinions on this?
>>
>> [1] https://www.postgresql.org/message-id/CAKFQuwbR1Fzr8yRuMW%3DN1UMA1cTpFcqZe9bW_-ZF8%3DBa2Ud2%3Dw%40mail.gmail.com
>>
> Just as the discussion here. Adding extension location is a good idea.
> Suppose there is an amcheck 1.5 located in the $system directory. There
> is also an amcheck 1.4.5 located in another path.
>
> Strange results will then occur:
> postgres=# SHOW extension_control_path;
>   extension_control_path
> ------------------------
>   $system
> (1 row)
>
> postgres=# CREATE EXTENSION amcheck;
> CREATE EXTENSION
> postgres=# select * from pg_available_extensions;
>
>                                 name    | default_version |
> installed_version |                  comment                   | location
> ------------+-----------------+-------------------+--------------------------------------------+----------
>   amcheck    | 1.5             | 1.5               | functions for
> verifying relation integrity | $system
>
> This seems to be fine.
>
> However, if another path is added, strange results will occur.
>
> postgres=# SET extension_control_path TO
> '/Users/quanzl/build/pg-availext:$system';
> SET
> postgres=# select * from pg_available_extensions;
>      name    | default_version | installed_version |
> comment                   |                 location
>
------------+-----------------+-------------------+--------------------------------------------+-------------------------------------------
>   amcheck    | 1.4.5           | 1.5               | functions for
> verifying relation integrity | /Users/quanzl/build/pg-availext/extension
>
> The results shown here will cause confusion. It is better to show the
> path used at creation.
>
I agree that this sounds strange but the documentation [1] mention the
following:
    If extensions with equal names are present in multiple directories
    in the configured path, only the instance found first in the path
    will be used.

So I think that users should not use different paths to install the same
extension with different versions in practice.

> So, it would be a better option to add a new column to the pg_extension
> table.
>
You mean add the location column on pg_extension instead of
pg_available_extensions? I'm not sure if I get the point here.

[1] https://www.postgresql.org/docs/18/runtime-config-client.html#GUC-EXTENSION-CONTROL-PATH

--
Matheus Alcantara




pgsql-hackers by date:

Previous
From: Sergey Prokhorenko
Date:
Subject: Re: Add uuid_to_base32hex() and base32hex_to_uuid() built-in functions
Next
From: "Matheus Alcantara"
Date:
Subject: Re: Include extension path on pg_available_extensions