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

From Chao Li
Subject Re: Include extension path on pg_available_extensions
Date
Msg-id 96F4EB92-C8C3-4E60-A253-E6D789ED79B3@gmail.com
Whole thread Raw
In response to Re: Include extension path on pg_available_extensions  ("Matheus Alcantara" <matheusssilv97@gmail.com>)
Responses Re: Include extension path on pg_available_extensions
List pgsql-hackers
Hi Matheus,

I just reviewed and tested the patch again, got a few more comments:

> On Nov 11, 2025, at 20:47, Matheus Alcantara <matheusssilv97@gmail.com> wrote:
>
>
> On this new v5 version I also swap the order of "comment" and "location"
> columns as it was suggested by Michael.
>
> --
> Matheus Alcantara
> EDB: http://www.enterprisedb.com
>
> <v5-0001-Add-path-of-extension-on-pg_available_extensions.patch>

1 - commit comment
```
User-defined locations are only visible for users that has the
pg_read_extension_paths role, otherwise <insufficient privilege> is
returned as a column value, the same behaviour that we already have on
pg_stat_activity.
```

First, there is a typo: "for users that has” should be “have”.

Then, Is this still true? The code change shows:
```
+    /* We only want to show extension paths for superusers. */
+    if (superuser_arg(GetUserId()))
+    {
```

And the code change says:
```
+       GUC. Only superusers can see the contents of this column.
```

But the TAP test contains a case for normal user:
```
+# Create an user to test permissions to read extension locations.
+my $user = "user01";
+$node->safe_psql('postgres', "CREATE USER $user");
+
 my $ecp = $node->safe_psql('postgres', 'show extension_control_path;');

 is($ecp, "\$system$sep$ext_dir$sep$ext_dir2",
@@ -46,28 +54,46 @@ $node->safe_psql('postgres', "CREATE EXTENSION $ext_name2");
 my $ret = $node->safe_psql('postgres',
     "select * from pg_available_extensions where name = '$ext_name'");
 is( $ret,
-    "test_custom_ext_paths|1.0|1.0|Test extension_control_path",
+    "test_custom_ext_paths|1.0|1.0|$ext_dir_canonicalized/extension|Test extension_control_path",
     "extension is installed correctly on pg_available_extensions”);
```

And I tried to run the TAP test, it passed.

So I’m really confused here.

2
```
+    else
+        return "<insufficient privilege>";
+}
```

Why do we just show nothing (empty string)? Every row showing a long string of <insufficient privilege> just looks not
good,that’s a lot of duplications. 

```
evantest=> select * from pg_available_extension_versions;
        name        | version | installed | superuser | trusted | relocatable |   schema   |      requires       |
  location         |                                comment 

--------------------+---------+-----------+-----------+---------+-------------+------------+---------------------+--------------------------+------------------------------------------------------------------------
 refint             | 1.0     | f         | t         | f       | t           |            |                     |
<insufficientprivilege> | functions for implementing referential integrity (obsolete) 
 unaccent           | 1.1     | f         | t         | t       | t           |            |                     |
<insufficientprivilege> | text search dictionary that removes accents 
```

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/







pgsql-hackers by date:

Previous
From: shveta malik
Date:
Subject: Re: Proposal: Conflict log history table for Logical Replication
Next
From: Yugo Nagata
Date:
Subject: Re: Suggestion to add --continue-client-on-abort option to pgbench