diff options
author | Tom Lane | 2022-01-11 19:22:00 +0000 |
---|---|---|
committer | Tom Lane | 2022-01-11 19:22:00 +0000 |
commit | 6f6943fc94ada145c0af5f62f719abad73825e5b (patch) | |
tree | cfbbfcaaecebbff387c8bd5812081a955e3f589d | |
parent | 98e93a1fc93e9b54eb477d870ec744e9e1669f34 (diff) |
Improve error message for missing extension.
If we get ENOENT while trying to read an extension control file,
report that as a missing extension (with a HINT to install it)
rather than as a filesystem access problem. The message wording
was extensively bikeshedded in hopes of pointing people to the
idea that they need to do a software installation before they
can install the extension into the current database.
Nathan Bossart, with review/wording suggestions from Daniel
Gustafsson, Chapman Flack, and myself
Discussion: https://postgr.es/m/[email protected]
-rw-r--r-- | src/backend/commands/extension.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/backend/commands/extension.c b/src/backend/commands/extension.c index 345787fe2ce..a2e77c418a4 100644 --- a/src/backend/commands/extension.c +++ b/src/backend/commands/extension.c @@ -487,11 +487,22 @@ 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; + /* no complaint for missing auxiliary file */ + if (version) + { + pfree(filename); + return; + } + + /* missing control file indicates extension is not installed */ + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("extension \"%s\" is not available", control->name), + errdetail("Could not open extension control file \"%s\": %m.", + filename), + errhint("The extension must first be installed on the system where PostgreSQL is running."))); } ereport(ERROR, (errcode_for_file_access(), |