PostgreSQL cannot locate the required .control file for an extension. This happens when extension packages are missing or not properly installed on your system.
This error occurs when you attempt to create a PostgreSQL extension using CREATE EXTENSION, but PostgreSQL cannot find the extension's control file (.control) in the expected system directory. The control file is a metadata file that PostgreSQL uses to understand how to install and configure an extension. Without it, the extension cannot be loaded into the database.
First, determine where PostgreSQL expects to find extension files:
pg_config --sharedirThis command returns the path where PostgreSQL looks for extension control files (typically /usr/share/postgresql/13 or /usr/pgsql-13/share).
Most missing extensions are provided by the postgresql-contrib package. Install it for your PostgreSQL version:
On Ubuntu/Debian:
sudo apt install postgresql-contribOn RHEL/CentOS:
sudo yum install postgresql-contribOn macOS:
brew install postgresqlMake sure to match your PostgreSQL version number if needed (e.g., postgresql-13-contrib).
Some extensions require separate packages beyond contrib:
For PostGIS on Ubuntu:
sudo apt install postgresql-[VERSION]-postgis postgresql-[VERSION]-postgis-scriptsFor pgvector:
# pgvector usually requires compilation or pre-built packages
# Check your package manager or build from sourceReplace [VERSION] with your PostgreSQL version number (13, 14, 15, etc.).
After installation, check if the .control file is now present:
find /usr/share/postgresql -name "*.control" | grep [extension_name]For example, to find PostGIS:
find /usr/share/postgresql -name "postgis.control"If the file is found, the extension package was installed successfully.
Once the extension package is installed, create the extension in your database:
CREATE EXTENSION [extension_name];For example:
CREATE EXTENSION postgis;
CREATE EXTENSION pg_trgm;
CREATE EXTENSION vector;Note: For pgvector, use vector as the extension name, not pgvector.
If the .control file exists but PostgreSQL still cannot access it, verify permissions:
ls -l /usr/share/postgresql/[version]/extension/ | headThe directory and files should be readable by the PostgreSQL system user. If permissions are incorrect:
sudo chmod 644 /usr/share/postgresql/[version]/extension/*.control
sudo chmod 755 /usr/share/postgresql/[version]/extension/For custom PostgreSQL installations to non-standard locations, you may need to set the extension_control_path configuration parameter in postgresql.conf. Custom installations typically place extensions in paths like /usr/local/postgresql/share or /opt/postgresql/share. On Windows, the PostgreSQL Application Stack Builder (stackbuilder.exe) automatically installs optional extensions to the correct location—use this tool rather than manual installation for best results. Version mismatches are a common cause: ensure your extension version matches your PostgreSQL major version. Some older extension packages may not be available for newer PostgreSQL versions.
insufficient columns in unique constraint for partition key
How to fix "insufficient columns in unique constraint for partition key" in PostgreSQL
ERROR 42501: must be owner of table
How to fix "must be owner of table" in PostgreSQL
trigger cannot change partition destination
How to fix "Trigger cannot change partition destination" in PostgreSQL
SSL error: certificate does not match host name
SSL error: certificate does not match host name in PostgreSQL
No SSL connection
No SSL connection to PostgreSQL