string, the default <literal>'$system'</literal> is also assumed.
</para>
+ <para>
+ 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.
+ </para>
+
<para>
This parameter can be changed at run time by superusers and users
with the appropriate <literal>SET</literal> privilege, but a
List *locations;
DIR *dir;
struct dirent *de;
+ List *found_ext = NIL;
/* Build tuplestore to hold the result rows */
InitMaterializedSRF(fcinfo, 0);
{
ExtensionControlFile *control;
char *extname;
+ String *extname_str;
Datum values[3];
bool nulls[3];
if (strstr(extname, "--"))
continue;
+ /*
+ * Ignore already-found names. They are not reachable by the
+ * path search, so don't shown them.
+ */
+ extname_str = makeString(extname);
+ if (list_member(found_ext, extname_str))
+ continue;
+ else
+ found_ext = lappend(found_ext, extname_str);
+
control = new_ExtensionControlFile(extname);
control->control_dir = pstrdup(location);
parse_extension_control_file(control, NULL);
List *locations;
DIR *dir;
struct dirent *de;
+ List *found_ext = NIL;
/* Build tuplestore to hold the result rows */
InitMaterializedSRF(fcinfo, 0);
{
ExtensionControlFile *control;
char *extname;
+ String *extname_str;
if (!is_extension_control_filename(de->d_name))
continue;
if (strstr(extname, "--"))
continue;
+ /*
+ * Ignore already-found names. They are not reachable by the
+ * path search, so don't shown them.
+ */
+ extname_str = makeString(extname);
+ if (list_member(found_ext, extname_str))
+ continue;
+ else
+ found_ext = lappend(found_ext, extname_str);
+
/* read the control file */
control = new_ExtensionControlFile(extname);
control->control_dir = pstrdup(location);
$node->init;
-# Create a temporary directory for the extension control file
+# Create temporary directories for the extension control files
my $ext_dir = PostgreSQL::Test::Utils::tempdir();
mkpath("$ext_dir/extension");
+my $ext_dir2 = PostgreSQL::Test::Utils::tempdir();
+mkpath("$ext_dir2/extension");
my $ext_name = "test_custom_ext_paths";
create_extension($ext_name, $ext_dir);
+create_extension($ext_name, $ext_dir2);
my $ext_name2 = "test_custom_ext_paths_using_directory";
mkpath("$ext_dir/$ext_name2");
my $sep = $windows_os ? ";" : ":";
$node->append_conf(
'postgresql.conf', qq{
-extension_control_path = '\$system$sep@{[ $windows_os ? ($ext_dir =~ s/\\/\\\\/gr) : $ext_dir ]}'
+extension_control_path = '\$system$sep@{[ $windows_os ? ($ext_dir =~ s/\\/\\\\/gr) : $ext_dir ]}$sep@{[ $windows_os ? ($ext_dir2 =~ s/\\/\\\\/gr) : $ext_dir2 ]}'
});
# Start node
my $ecp = $node->safe_psql('postgres', 'show extension_control_path;');
-is($ecp, "\$system$sep$ext_dir",
+is($ecp, "\$system$sep$ext_dir$sep$ext_dir2",
"custom extension control directory path configured");
$node->safe_psql('postgres', "CREATE EXTENSION $ext_name");