On Wed, 2022-06-29 at 21:39 -0400, Robert Haas wrote:
> > This should either be elog or use errmsg_internal.
>
> Why?
I didn't see a response, so I'm still using ereport(). I attached a new
version though that doesn't emit the actual script filename; instead
just the from/to version.
The output looks nicer and I don't have to worry about whether the user
should be able to know the share directory or not.
Regards,
Jeff Davis
From 3024b3189156402e0d4250e43dcccec5aa5d01a3 Mon Sep 17 00:00:00 2001
From: Jeff Davis <[email protected]>
Date: Tue, 28 Jun 2022 12:06:03 -0700
Subject: [PATCH] Emit debug message when executing extension script.
Allows extension authors to more easily debug problems related to the
sequence of update scripts that are executed.
---
src/backend/commands/extension.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/backend/commands/extension.c b/src/backend/commands/extension.c
index 767d9b96190..a35c49ac7e7 100644
--- a/src/backend/commands/extension.c
+++ b/src/backend/commands/extension.c
@@ -887,6 +887,11 @@ execute_extension_script(Oid extensionOid, ExtensionControlFile *control,
filename = get_extension_script_filename(control, from_version, version);
+ if (from_version == NULL)
+ ereport(DEBUG1, errmsg("executing extension script for version '%s'", version));
+ else
+ ereport(DEBUG1, errmsg("executing extension update script from version '%s' to '%s'", from_version, version));
+
/*
* If installing a trusted extension on behalf of a non-superuser, become
* the bootstrap superuser. (This switch will be cleaned up automatically
--
2.17.1