Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6f6943f

Browse filesBrowse files
committed
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/3950D56A-4E47-48E7-BF9B-F5F22E268BE7@amazon.com
1 parent 98e93a1 commit 6f6943f
Copy full SHA for 6f6943f

File tree

Expand file treeCollapse file tree

1 file changed

+15
-4
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+15
-4
lines changed

‎src/backend/commands/extension.c

Copy file name to clipboardExpand all lines: src/backend/commands/extension.c
+15-4Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -487,11 +487,22 @@ parse_extension_control_file(ExtensionControlFile *control,
487487

488488
if ((file = AllocateFile(filename, "r")) == NULL)
489489
{
490-
if (version && errno == ENOENT)
490+
if (errno == ENOENT)
491491
{
492-
/* no auxiliary file for this version */
493-
pfree(filename);
494-
return;
492+
/* no complaint for missing auxiliary file */
493+
if (version)
494+
{
495+
pfree(filename);
496+
return;
497+
}
498+
499+
/* missing control file indicates extension is not installed */
500+
ereport(ERROR,
501+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
502+
errmsg("extension \"%s\" is not available", control->name),
503+
errdetail("Could not open extension control file \"%s\": %m.",
504+
filename),
505+
errhint("The extension must first be installed on the system where PostgreSQL is running.")));
495506
}
496507
ereport(ERROR,
497508
(errcode_for_file_access(),

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.