The database of our discourse instance is not a local container, instead we use a central database cluster. Recently the central postgresql was updated to version 18.3. I noticed that the discourse backup now fails:
[2026-05-19 03:37:37] [STARTED]
[2026-05-19 03:37:37] 'system' has started the backup!
[2026-05-19 03:37:37] Marking backup as running...
[2026-05-19 03:37:37] Making sure '/var/www/discourse/tmp/backups/default/2026-05-19-033737' exists...
[2026-05-19 03:37:37] Making sure '/var/www/discourse/public/backups/default' exists...
[2026-05-19 03:37:37] Updating metadata...
[2026-05-19 03:37:37] Dumping the public schema of the database...
[2026-05-19 03:37:37] pg_dump: error: aborting because of server version mismatch
[2026-05-19 03:37:37] pg_dump: detail: server version: 18.3 (Ubuntu 18.3-1.pgdg24.04+1); pg_dump version: 15.15 (Debian 15.15-1.pgdg12+1)
[2026-05-19 03:37:37] EXCEPTION: pg_dump failed
[2026-05-19 03:37:37] /var/www/discourse/lib/backup_restore/creator.rb:173:in 'BackupRestore::Creator#dump_public_schema'
/var/www/discourse/lib/backup_restore/creator.rb:36:in 'BackupRestore::Creator#run'
/var/www/discourse/lib/backup_restore.rb:13:in 'BackupRestore.backup!'
/var/www/discourse/app/jobs/regular/create_backup.rb:10:in 'Jobs::CreateBackup#execute'
This looks like a PostgreSQL client/server version mismatch.
The backup is being run from the Discourse container, where pg_dump is version 15.15, but the external PostgreSQL server is 18.3:
server version: 18.3; pg_dump version: 15.15
I’d be cautious about modifying the Discourse container unless the Discourse team recommends that. My first instinct would be to keep the external database cluster aligned with the PostgreSQL version Discourse currently expects/supports.
OK, understood. In this case I had no choice as we needed 18 for another project which uses the same database cluster. Hmm, sounds like we would need a separate database server with 15 exclusively for discourse.
I made a quick test with an external postgres 18 and a dummy discourse installation before, it showed no issues. But, to be honest, this was only “quick and dirty”, not a “deep” test. Anyway, it runs since 2 weeks, so I assume its fine. The Discourse-internal backup is the only issue so far. On the other hand, the database server itself (running on LXC) is also backuped separately.
The only challenge you might have is upgrade of client might require a release upgrade for Ubuntu unless you are prepared to build it (messy!)…
Update: yeah Ubuntu 26.04 already ships PostgreSQL 18 in the default archive so do a release upgrade to that and install the client if necessary. Then you should be good to go …