# Supported postgresql versions

**URL:** https://meta.discourse.org/t/supported-postgresql-versions/174751
**Category:** Self-hosting
**Created:** [January 1, 2021, 4:58pm UTC](https://meta.discourse.org/t/supported-postgresql-versions/174751 "2021-01-01T16:58:29Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![sbernhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sbernhard/32/208186_2.png) [@sbernhard](https://meta.discourse.org/u/sbernhard)
#### Post date: [January 1, 2021, 4:58pm UTC](https://meta.discourse.org/t/supported-postgresql-versions/174751/1 "2021-01-01T16:58:29Z")

</div>

Is there somewhere a note, which postgresql db versions are supported?

Would be great to have something for each released discourse version - especially if a postgresql version is no longer supported.

---

<div class="post-metadata">

### Author: ![Ghan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ghan/32/177964_2.png) [@Ghan](https://meta.discourse.org/u/Ghan)
#### Post date: [January 1, 2021, 5:08pm UTC](https://meta.discourse.org/t/supported-postgresql-versions/174751/2 "2021-01-01T17:08:49Z")

</div>

Postgres is bundled in with the Docker container for Discourse, so this is generally hands-off. The Discourse team upgrades the Postgres version as new releases come out and they are properly tested. The most recent upgrade was to version 13. You can see the details of that upgrade here:

> [@PostgreSQL 13 update](https://meta.discourse.org/t/postgresql-13-update/172563):
>
> warning WARNING! If your database is very large, you will need a lot of extra disk space (2x database size) and should be very careful with this upgrade! We’ve just landed changes to upgrade our Docker image to PostgreSQL 13. Any site admins rebuilding Discourse from the command line will be upgraded to PostgreSQL 13 from the previous PostgreSQL 12. Note that if you held back from upgrading when the PostgreSQL 12 update [happened back in May](https://meta.discourse.org/t/postgresql-12-update/151236), you can skip that upgrade and go straight to P…

---

<div class="post-metadata">

### Author: ![sbernhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sbernhard/32/208186_2.png) [@sbernhard](https://meta.discourse.org/u/sbernhard)
#### Post date: [January 1, 2021, 6:06pm UTC](https://meta.discourse.org/t/supported-postgresql-versions/174751/3 "2021-01-01T18:06:25Z")

</div>

Well, not everyone is using the bundled postgres db.

---

<div class="post-metadata">

### Author: ![Ghan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ghan/32/177964_2.png) [@Ghan](https://meta.discourse.org/u/Ghan)
#### Post date: [January 1, 2021, 6:12pm UTC](https://meta.discourse.org/t/supported-postgresql-versions/174751/4 "2021-01-01T18:12:40Z")

</div>

The current install doc lists Postgres 10+ as the required version:

> <https://github.com/discourse/discourse/blob/main/docs/INSTALL.md>

That said, the only officially supported setups are using Docker containers.

---

<div class="post-metadata">

### Author: ![neounix](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neounix/32/215617_2.png) [@neounix](https://meta.discourse.org/u/neounix)
#### Post date: [January 2, 2021, 4:53am UTC](https://meta.discourse.org/t/supported-postgresql-versions/174751/5 "2021-01-02T04:53:01Z")

</div>

> [@sbernhard](#):
>
> Is there somewhere a note, which postgresql db versions are supported?

Yes, the versions of postgres which are “supported” (from a docker build perspective, not all “strongly supported”) are listed in the templates directory of `discourse_docker`

> **[discourse\_docker/templates at master · discourse/discourse\_docker](https://github.com/discourse/discourse_docker/tree/master/templates)**
>
> master/templates

Having said that, it is highly recommended to move to the latest version of postgres, currently version 13, as soon as you can.

However, if you are running Discourse on a host where you cannot run the latest version because of some local constraint in your organization; the `discourse_docker` templates directory is a good place to research.

---

<div class="post-metadata">

### Author: ![chkno](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chkno/32/347927_2.png) [@chkno](https://meta.discourse.org/u/chkno)
#### Post date: [December 9, 2023, 7:38pm UTC](https://meta.discourse.org/t/supported-postgresql-versions/174751/6 "2023-12-09T19:38:40Z")

</div>

Checking in three years later: [The docker template](https://github.com/discourse/discourse_docker/blob/main/image/base/slim.Dockerfile#L5) still says `PG_MAJOR=13`, but there are [new versions of PostgreSQL](https://www.postgresql.org/support/versioning/): 14 from 2021, 15 from 2022, and 16 from 2023.

So the recommendation is still to use version 13 (which will EOL in 2025) rather than the latest PostgreSQL 16 (which will EOL in 2028)?

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [December 10, 2023, 1:25pm UTC](https://meta.discourse.org/t/supported-postgresql-versions/174751/7 "2023-12-10T13:25:57Z")

</div>

> [@chkno](#):
>
> So the recommendation is still to use version 13

Yes, exactly.

We have some sites running version 15 already, and should get to updating from 13 next year.

---

<div class="post-metadata">

### Author: ![Thomas\_Rother](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thomas_rother/32/423597_2.png) [@Thomas\_Rother](https://meta.discourse.org/u/Thomas_Rother)
#### Post date: [June 12, 2024, 4:07pm UTC](https://meta.discourse.org/t/supported-postgresql-versions/174751/8 "2024-06-12T16:07:15Z")

</div>

Question: what is the current status here? I am running an external pg database and would like to upgrade the database server from 13. postgres 16 was released 2023-09-14. Can it be used with discourse? Will there be any migration steps required for the database itself? (aside from the global migration steps on the server side)

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [June 12, 2024, 4:40pm UTC](https://meta.discourse.org/t/supported-postgresql-versions/174751/9 "2024-06-12T16:40:23Z")

</div>

PostgreSQL 13 is still the officially supported version, with version 13.15 being released last month and still supported.

We have a good number of sites running version 15, and that is a known working version that we plan on shipping an update for self-hosted users eventually.

Version 16 is not widely tested outside of developer machines, but if you are feeling adventurous and want to give it a try and see if something breaks, let us know how it goes!

---

<div class="post-metadata">

### Author: ![Isambard](https://avatars.discourse-cdn.com/v4/letter/i/858c86/32.png) [@Isambard](https://meta.discourse.org/u/Isambard)
#### Post date: [June 13, 2024, 11:22am UTC](https://meta.discourse.org/t/supported-postgresql-versions/174751/10 "2024-06-13T11:22:35Z")

</div>

Does Discourse do anything out of the ordinary with Postgres which would imply that upgrades to new versions of Postgres might not work with a simple dump and restore?

---

<div class="post-metadata">

### Author: ![jimmy0017](https://avatars.discourse-cdn.com/v4/letter/j/76d3ee/32.png) [@jimmy0017](https://meta.discourse.org/u/jimmy0017)
#### Post date: [October 6, 2024, 9:14pm UTC](https://meta.discourse.org/t/supported-postgresql-versions/174751/11 "2024-10-06T21:14:20Z")

</div>

Bumping up this thread to see if there is a reason to try to upgrade to PostgreSQL 15 instead of 16 or 17?

And when should we expect to upgrade the PostgreSQL

---

<div class="post-metadata">

### Author: ![Wurzelseppi](https://avatars.discourse-cdn.com/v4/letter/w/eada6e/32.png) [@Wurzelseppi](https://meta.discourse.org/u/Wurzelseppi)
#### Post date: [December 13, 2024, 8:42am UTC](https://meta.discourse.org/t/supported-postgresql-versions/174751/12 "2024-12-13T08:42:31Z")

</div>

Hey guys, just moved to AWS RDS PostGre 16.4 and it seems to be working.

I´m on discourse version **3.4.0.beta3-dev**

Didn´t press on all buttons, yet 🙂 , but the board itself seems to be working, but…

I can´t create backups, due to

```plaintext
[2024-12-13 08:36:07] Making sure '/var/www/discourse/tmp/backups/default/2024-12-13-083607' exists...
[2024-12-13 08:36:07] Making sure '/var/www/discourse/public/backups/default' exists...
[2024-12-13 08:36:07] Updating metadata...
[2024-12-13 08:36:07] Dumping the public schema of the database...
[2024-12-13 08:36:08] pg_dump: error: server version: 16.4; pg_dump version: 13.18 (Debian 13.18-1.pgdg120+1)
[2024-12-13 08:36:08] pg_dump: error: aborting because of server version mismatch
[2024-12-13 08:36:08] EXCEPTION: pg_dump failed

```

strange thing is, that I could actually import the data with internal mechanisms:

What I did:

1. Set up db (user, database, grants)
2. Configured stuff in app.yml
3. Created backup from within discourse
4. Rebuild app (db migration was successful → db is empty then)
5. Restored backup from within container (launcher enter app, discourse enable\_restore, discourse restore …)
6. Finished (all successful, and everything seemed to be working, until I tried to create a new backup 🙂 )

any chance to tackle this somehow ?

Greetings,

JP

---

<div class="post-metadata">

### Author: ![Wurzelseppi](https://avatars.discourse-cdn.com/v4/letter/w/eada6e/32.png) [@Wurzelseppi](https://meta.discourse.org/u/Wurzelseppi)
#### Post date: [December 16, 2024, 10:10am UTC](https://meta.discourse.org/t/supported-postgresql-versions/174751/13 "2024-12-16T10:10:02Z")

</div>

Ok guys, now it´s getting interesting.  
I wasn´t working for a few days and didn´t check our new company board.

When I checkded today, the scheduled backup worked, then I tried to do the manual backup again, and that failed 🤔

scheduled:

```plaintext
Dumping the public schema of the database...
[2024-12-04 06:02:16] pg_dump: last built-in OID is 16383
[2024-12-04 06:02:16] pg_dump: reading extensions
[2024-12-04 06:02:16] pg_dump: identifying extension members
[2024-12-04 06:02:16] pg_dump: reading schemas
[2024-12-04 06:02:16] pg_dump: reading user-defined tables
[2024-12-04 06:02:16] pg_dump: reading user-defined functions
[2024-12-04 06:02:16] pg_dump: reading user-defined types
......
pg_dump: dumping contents of table "public.themes"
[2024-12-04 06:02:19] pg_dump: processing data for table "public.top_topics"
[2024-12-04 06:02:19] pg_dump: dumping contents of table "public.top_topics"
[2024-12-04 06:02:19] Finalizing backup...
[2024-12-04 06:02:19] Creating archive: scp-talk-2024-12-04-060216-v20241127034553.tar.gz
[2024-12-04 06:02:19] Making sure archive does not already exist...
[2024-12-04 06:02:19] Creating empty archive...
[2024-12-04 06:02:19] Archiving data dump...
[2024-12-04 06:02:19] Archiving uploads...
[2024-12-04 06:02:19] Removing tmp '/var/www/discourse/tmp/backups/default/2024-12-04-060216' directory...
[2024-12-04 06:02:19] Gzipping archive, this may take a while...
[2024-12-04 06:02:19] Executing the after_create_hook for the backup...
[2024-12-04 06:02:19] Deleting old backups...
[2024-12-04 06:02:19] Cleaning stuff up...
[2024-12-04 06:02:19] Removing '.tar' leftovers...
[2024-12-04 06:02:19] Marking backup as finished...
[2024-12-04 06:02:19] Refreshing disk stats...
[2024-12-04 06:02:19] Notifying '<me>' of the end of the backup...

```

manual:

```plaintext
[2024-12-16 10:03:54] '<me>' has started the backup!
[2024-12-16 10:03:54] Marking backup as running...
[2024-12-16 10:03:54] Making sure '/var/www/discourse/tmp/backups/default/2024-12-16-100354' exists...
[2024-12-16 10:03:54] Making sure '/var/www/discourse/public/backups/default' exists...
[2024-12-16 10:03:54] Updating metadata...
[2024-12-16 10:03:54] Dumping the public schema of the database...
[2024-12-16 10:03:54] pg_dump: error: server version: 16.4; pg_dump version: 13.18 (Debian 13.18-1.pgdg120+1)
[2024-12-16 10:03:54] pg_dump: error: aborting because of server version mismatch
[2024-12-16 10:03:54] EXCEPTION: pg_dump failed

```

hmmmmm, any ideas ?

Very strange ☹

---

<div class="post-metadata">

### Author: ![Ivan\_Rapekas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ivan_rapekas/32/248924_2.png) [@Ivan\_Rapekas](https://meta.discourse.org/u/Ivan_Rapekas)
#### Post date: [December 23, 2024, 11:28am UTC](https://meta.discourse.org/t/supported-postgresql-versions/174751/14 "2024-12-23T11:28:45Z")

</div>

I confirm that upgrading to 3.4.0.beta3 with external database makes backup fail.

I have two instances 3.4.0.beta3 (tag): 1) with Postgres-in-Docker (default); 2) with external Postgres (local self-hosted).

The first is able to backup both by schedule and by hands:

```plaintext
[2024-12-23 11:11:43] Marking backup as running...
[2024-12-23 11:11:44] Making sure '/var/www/discourse/tmp/backups/default/2024-12-23-111143' exists...
[2024-12-23 11:11:44] Making sure '/var/www/discourse/public/backups/default' exists...
[2024-12-23 11:11:44] Updating metadata...
[2024-12-23 11:11:44] Dumping the public schema of the database...
[2024-12-23 11:11:44] pg_dump: last built-in OID is 16383
[2024-12-23 11:11:44] pg_dump: reading extensions
[2024-12-23 11:11:44] pg_dump: identifying extension members
[2024-12-23 11:11:44] pg_dump: reading schemas
...

```

The second one fails:

```plaintext
[2024-12-21 03:35:21] Marking backup as running...
[2024-12-21 03:35:21] Making sure '/var/www/discourse/tmp/backups/default/2024-12-21-033521' exists...
[2024-12-21 03:35:21] Making sure '/var/www/discourse/public/backups/default' exists...
[2024-12-21 03:35:21] Updating metadata...
[2024-12-21 03:35:21] Dumping the public schema of the database...
[2024-12-21 03:35:22] pg_dump: error: server version: 16.6 (Ubuntu 16.6-0ubuntu0.24.04.1); pg_dump version: 13.18 (Debian 13.18-1.pgdg120+1)
[2024-12-21 03:35:22] pg_dump: error: aborting because of server version mismatch
[2024-12-21 03:35:22] EXCEPTION: pg_dump failed
...

```

---

<div class="post-metadata">

### Author: ![Isambard](https://avatars.discourse-cdn.com/v4/letter/i/858c86/32.png) [@Isambard](https://meta.discourse.org/u/Isambard)
#### Post date: [December 24, 2024, 9:34am UTC](https://meta.discourse.org/t/supported-postgresql-versions/174751/15 "2024-12-24T09:34:23Z")

</div>

I upgraded yesterday and confirm the scheduled backups fail due to version mis-match.

You can fix by entering docker and installing a newer postgresql-client.

```plaintext
/var/discourse/launcher enter app
apt update
apt install postgresql-client

```

---

<div class="post-metadata">

### Author: ![Wurzelseppi](https://avatars.discourse-cdn.com/v4/letter/w/eada6e/32.png) [@Wurzelseppi](https://meta.discourse.org/u/Wurzelseppi)
#### Post date: [February 2, 2025, 2:58pm UTC](https://meta.discourse.org/t/supported-postgresql-versions/174751/16 "2025-02-02T14:58:49Z")

</div>

Hey guys,

I´ve switched to encrypted PostGre DB´s in RDS now, and was doing the same thing yesterday (like I described in earlier steps (make backup, edit app.yml, rebuild, …) and it was working yesterday.

Today I tried that with PROD and now I´m getting this error ☹

> Creating missing functions in the discourse\_functions schema…  
> Restoring dump file… (this may take a while)  
> SET  
> SET  
> SET  
> ERROR: unrecognized configuration parameter “transaction\_timeout”  
> EXCEPTION: psql failed: ERROR: unrecognized configuration parameter “transaction\_timeout”

Tried that with DBeaver directly in the DB, and there I´m getting the same error (even for that database, which worked yesterday like a charm.  
The backup were in both case up to date.

Did you change anything overnight ? 😃

Thanks and Greetings,

WS

---

<div class="post-metadata">

### Author: ![Wurzelseppi](https://avatars.discourse-cdn.com/v4/letter/w/eada6e/32.png) [@Wurzelseppi](https://meta.discourse.org/u/Wurzelseppi)
#### Post date: [February 3, 2025, 5:54am UTC](https://meta.discourse.org/t/supported-postgresql-versions/174751/17 "2025-02-03T05:54:57Z")

</div>

Hi,

checked the dump being made in backup file:

It includes this on top

> SET statement\_timeout = 0;  
> SET lock\_timeout = 0;  
> SET idle\_in\_transaction\_session\_timeout = 0;  
> SET transaction\_timeout = 0;  
> SET client\_encoding = ‘UTF8’;  
> SET standard\_conforming\_strings = on;

The parameter transaction\_timeout is weird here 🤔  
as

`transaction_timeout` was added in [PostgreSQL 17](https://pgpedia.info/postgresql-versions/postgresql-17.html).

stated here:

[https://pgpedia.info/t/transaction\_timeout.html](https://pgpedia.info/t/transaction_timeout.html)

Need help 🙂

Thanks !

Cheers,

Wurzelseppi

---

<div class="post-metadata">

### Author: ![Isambard](https://avatars.discourse-cdn.com/v4/letter/i/858c86/32.png) [@Isambard](https://meta.discourse.org/u/Isambard)
#### Post date: [March 2, 2025, 11:25pm UTC](https://meta.discourse.org/t/supported-postgresql-versions/174751/18 "2025-03-02T23:25:12Z")

</div>

Is there a way to do this postgresql-client update as automated part of a rebuild by modifying the container yaml?
