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:

psql -U <DB_USERNAME>

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

\c <DB_NAME>

Run the below command to install the extension:

CREATE EXTENSION pg_trgm;

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

Ubuntu/Debian:

sudo apt install postgresql-contrib

Fedora:

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 *