From: | Christoph Berg <myon(at)debian(dot)org> |
---|---|
To: | Matheus Alcantara <matheusssilv97(at)gmail(dot)com> |
Cc: | "David E(dot) Wheeler" <david(at)justatheory(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: extension_control_path and "directory" |
Date: | 2025-04-24 10:21:06 |
Message-ID: | aAoQkqwktHQI5KLO@msg.df7cb.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers pgsql-hackers |
Re: Matheus Alcantara
> I've tested with the semver extension and it seems to work fine with
> this patch. Can you please check on your side to see if it's also
> working?
Hi Matheus,
thanks for the patch, it does indeed work.
diff --git a/src/backend/commands/extension.c b/src/backend/commands/extension.c
index 180f4af9be3..d68efd59118 100644
--- a/src/backend/commands/extension.c
+++ b/src/backend/commands/extension.c
@@ -376,6 +376,14 @@ get_extension_control_directories(void)
/* Substitute the path macro if needed */
mangled = substitute_path_macro(piece, "$system", system_dir);
+
+ /*
+ * Append "extension" suffix in case is a custom extension control
+ * path.
+ */
+ if (strcmp(piece, "$system") != 0)
+ mangled = psprintf("%s/extension", mangled);
This would look prettier if it was something like
mangled = substitute_path_macro(piece, "$system", system_dir "/extension");
... but I'm wondering if it wouldn't be saner if the control path
should be stored without "extension" in that struct. Then opening the
control file would be path + "extension/" + filename and the extra
directory would be path + directory, without any on-the-fly stripping
of trailing components.
The extension_control_path GUC could also be adjusted to refer to the
directory one level above the extension/foo.control location.
+ /*
+ * Assert that the control->control_dir end with /extension suffix so that
+ * we can replace with the value from control->directory.
+ */
+ Assert(ctrldir_len >= suffix_len &&
+ strcmp(control->control_dir + ctrldir_len - suffix_len, "extension") == 0);
If control_dir is coming from extension_control_path, it might have a
different suffix. Replace the Assert by elog(ERROR). (Or see above.)
Christoph
From | Date | Subject | |
---|---|---|---|
Next Message | Christoph Berg | 2025-04-24 13:25:55 | Re: vacuumdb --missing-stats-only and pg_upgrade from PG13 |
Previous Message | Amit Kapila | 2025-04-24 05:10:37 | pgsql: Fix data loss in logical replication. |
From | Date | Subject | |
---|---|---|---|
Next Message | shveta malik | 2025-04-24 10:27:22 | Re: Fix slot synchronization with two_phase decoding enabled |
Previous Message | Amit Kapila | 2025-04-24 09:57:56 | Re: Fix premature xmin advancement during fast forward decoding |