From 73fcba4a050e240d4e7c0a9e230e544ee6971a15 Mon Sep 17 00:00:00 2001 From: Nathan Bossart Date: Mon, 29 Nov 2021 21:35:59 +0000 Subject: [PATCH v2 1/1] Improve CREATE EXTENSION error message. --- src/backend/commands/extension.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/backend/commands/extension.c b/src/backend/commands/extension.c index eaa76af47b..e345f7fd52 100644 --- a/src/backend/commands/extension.c +++ b/src/backend/commands/extension.c @@ -487,11 +487,21 @@ parse_extension_control_file(ExtensionControlFile *control, if ((file = AllocateFile(filename, "r")) == NULL) { - if (version && errno == ENOENT) + if (errno == ENOENT) { - /* no auxiliary file for this version */ - pfree(filename); - return; + /* auxiliary files are optional */ + if (version) + { + pfree(filename); + return; + } + + /* missing control file indicates extension is not installed */ + ereport(ERROR, + (errcode_for_file_access(), + errmsg("could not open extension control file \"%s\": %m", + filename), + errhint("This means the extension is not available on the system."))); } ereport(ERROR, (errcode_for_file_access(), -- 2.16.6