Re: Include extension path on pg_available_extensions

From: "Matheus Alcantara" <matheusssilv97(at)gmail(dot)com>
To: "Quan Zongliang" <quanzongliang(at)yeah(dot)net>, "Matheus Alcantara" <matheusssilv97(at)gmail(dot)com>, "Pg Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Include extension path on pg_available_extensions
Date: 2025-10-23 18:12:12
Message-ID: DDPWL1B42NIW.NG8R2KXJULDD@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Matheus Alcantara 2025-10-23 18:13:46 Re: Include extension path on pg_available_extensions
Previous Message Sergey Prokhorenko 2025-10-23 17:34:13 Re: Add uuid_to_base32hex() and base32hex_to_uuid() built-in functions