improve CREATE EXTENSION error message

Nathan Bossart <bossartn@amazon.com>

From: "Bossart, Nathan" <bossartn@amazon.com>
To: "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2021-11-29T19:54:56Z
Lists: pgsql-hackers

Attachments

Hi hackers,

Currently, if you attempt to use CREATE EXTENSION for an extension
that is not installed, you'll see something like the following:

        postgres=# CREATE EXTENSION does_not_exist;
        ERROR:  could not open extension control file "/usr/local/pgsql/share/extension/does_not_exist.control": No such file or directory

I suspect this ERROR message is confusing for novice users, so perhaps
we should add a HINT.  With the attached patch, you'd see the
following:

        postgres=# CREATE EXTENSION does_not_exist;
        ERROR:  could not open extension control file "/usr/local/pgsql/share/extension/does_not_exist.control": No such file or directory
        HINT:  This typically indicates that the specified extension is not installed on the system.

Thoughts?

Nathan

Commits

  1. Improve error message for missing extension.