PostgreSQL ERROR: could not open extension control file

In this article, we will see the cause and solution for “PostgreSQL ERROR: could not open extension control file”.

PostgreSQL ERROR could not open extension control file

Reason: At the time of installation PostgreSQL server, we have to install postgresql-contrib with the version number like yum/apt install postgresql14-contrib. Here 14 is the version PostgreSQL server.

Solution:

We have to PostgreSQL contrib like

yum install postgresql14-contrib

================================================================================ Package Arch Version Repository Size ================================================================================ Installing: postgresql14-contrib x86_64 14.1-1PGDG.rhel8 pgdg14 722 k Transaction Summary ================================================================================ Install 1 Package Total download size: 722 k Installed size: 2.5 M Is this ok [y/N]: y Downloading Packages: postgresql14-contrib-14.1-1PGDG.rhel8.x86_64.rp 172 kB/s | 722 kB 00:04 -------------------------------------------------------------------------------- Total 172 kB/s | 722 kB 00:04 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : postgresql14-contrib-14.1-1PGDG.rhel8.x86_64 1/1 Running scriptlet: postgresql14-contrib-14.1-1PGDG.rhel8.x86_64 1/1 Verifying : postgresql14-contrib-14.1-1PGDG.rhel8.x86_64 1/1 Installed products updated. Installed: postgresql14-contrib-14.1-1PGDG.rhel8.x86_64 Complete!

Now create extension as below.

create extension pg_stat_statements;