I got this pg_trgm PostgreSQL error after trying to run Drupal and Postgres using Docker compose for testing purposes. After taking the NYC subway to my home office I decided to look into this.

The solution for this error was to install the missing extension in Postgres. Not sure why this is not installed by default. Maybe that’s a topic for a different post.

To quickly install the missing postgres extension and fix this pg_trgm PostgreSQL error I logged into my docker container by running the below command:

docker exec -it <nameOfContainer> bash

I then logged into postgres using:


then switch to the database you want to install the extension:

\c <DB_NAME>

Run the below command to install the extension:


Logout and if you get further errors try installing the module for your Linux OS:


sudo apt install postgresql-contrib


sudo dnf install postgresql-contrib

Research your OS documentation for installing this postgres extension.

Leave a comment

Your email address will not be published. Required fields are marked *