Update to 3.0.x and pg_trgm

I’m attempting to move from 2.2.2 to 3.0, but running into issues when running update.php. There’s no pretty formatting, and it is unable to find pg_trgm:

As far as I can tell, I’m running an appropriate version of PostgreSQL (14) with pg_trgm installed:

farm=# \dx
                                    List of installed extensions
  Name   | Version |   Schema   |                            Description
---------+---------+------------+-------------------------------------------------------------------
 pg_trgm | 1.6     | public     | text similarity measurement and index searching based on trigrams
 plpgsql | 1.0     | pg_catalog | PL/pgSQL procedural language
 postgis | 3.2.0   | public     | PostGIS geometry and geography spatial types and functions
(3 rows)

The docker-compose.yml I’m using is this:

version: '3'
services:
  db:
    image: postgres:14
    volumes:
      - '.db:/var/lib/postgresql/data'
    ports:
      - '5432'
    extra_hosts:
      - 'host.docker.internal:host-gateway'
    environment:
      POSTGRES_USER: farm
      POSTGRES_PASSWORD: farm
      POSTGRES_DB: farm
    restart: always

  www:
    depends_on:
      - db
    image: farmos/farmos:3.0.1
    volumes:
      - './farmos/www:/opt/drupal/web/sites'
    ports:
      - '80:80'
    restart: always

Am I missing something obvious?

Welcome to the forum @mhpob!

Yea for an upgrade you need to manually enable the pg_trgm extension in your farm database.

Drupal has some logic to automatically enable it on NEW installs, but not on updates.

It’s very easy to do, though. Open up the farm=# prompt like you showed in your first comment and run:

CREATE EXTENSION pg_trgm;

That will enable the extension on your farm database. The extension is per-database, not a server-wide extension.

Hope that helps! If you still have issues with the “pretty formatting” after this let me know! :+1:

It gives me an error that the extension exists:

farm=# \c farm
You are now connected to database "farm" as user "farm".
farm=# CREATE EXTENSION pg_trgm;
ERROR:  extension "pg_trgm" already exists
farm=# \dx
                                    List of installed extensions
  Name   | Version |   Schema   |                            Description
---------+---------+------------+-------------------------------------------------------------------
 pg_trgm | 1.6     | public     | text similarity measurement and index searching based on trigrams
 plpgsql | 1.0     | pg_catalog | PL/pgSQL procedural language
 postgis | 3.2.0   | public     | PostGIS geometry and geography spatial types and functions
(3 rows)

Thanks for the welcome! I’ve been lurking for a while and appreciate all of the help that’s been doled out.

1 Like

Oh! In that case maybe try the upgrade again? Maybe it got enabled automatically, but that happened after the requirements check or something odd like that… :thinking: