postgres-flex: database "postgres" has a collation version mismatch

Just recently a new release of postgres-flex was published. Because the Debian version of the base image has been updated, you may see a message like this: database [DATABASE NAME] has a collation version mismatch.

There are a few things you need to do here, but in many cases you should be able to resolve this in the following steps:

  1. Update the app’s image to the latest available version: fly image update ...

  2. List all available databases: postgres=# \l
    If you’re not sure about the backslash commands you run, you can check here: PostgreSQL: Documentation: 15: psql
    Search \? in the document page and go ahead.

  3. Connect to database: postgres=# \c [DATABASE NAME]

  4. Consult: PostgreSQL: Documentation: 15: ALTER COLLATION
    postgres=# REINDEX DATABASE [DATABASE NAME]; ALTER DATABASE [DATABASE NAME] REFRESH COLLATION VERSION;

13 Likes

Thanks for sharing this with the community!

1 Like

awesome! thanks @smorimoto

1 Like

My friend was pretty struggling with this and I just thought it would be nice to share this here :sweat_smile:

2 Likes