# Discourse\_docker default templates and postgres version are out of sync

**URL:** https://meta.discourse.org/t/discourse-docker-default-templates-and-postgres-version-are-out-of-sync/310440
**Category:** Self-hosting
**Created:** [June 4, 2024, 1:09am UTC](https://meta.discourse.org/t/discourse-docker-default-templates-and-postgres-version-are-out-of-sync/310440 "2024-06-04T01:09:14Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![mqmenchaca](https://avatars.discourse-cdn.com/v4/letter/m/90ced4/32.png) [@mqmenchaca](https://meta.discourse.org/u/mqmenchaca)
#### Post date: [June 4, 2024, 1:09am UTC](https://meta.discourse.org/t/discourse-docker-default-templates-and-postgres-version-are-out-of-sync/310440/1 "2024-06-04T01:09:14Z")

</div>

Hello all, as I look into adding the “pglogical” extension to our Postgres DB, I am noticing some discrepancies between the version of postgres installed and the version cited by the postgres template and configuration files.

The version of postgres currently installed is v16.2 (released Feb. 2024), but the config files all are still associated with v13, e.g.,

```plaintext
root@ip-172-31-62-223-app:/var/www/discourse# sudo -u postgres psql discourse
psql (16.2 (Debian 16.2-1.pgdg110+2), server 13.14 (Debian 13.14-1.pgdg110+2))
Type "help" for help.

discourse=# SHOW config_file;
               config_file               
-----------------------------------------
 /etc/postgresql/13/main/postgresql.conf
(1 row)

```

or the postgres.template file, which only goes up to v13.

This is only an issue for me right now because the pglogical library is located in the v16 folders, but not the v13 folders. I tried symlinking with

> for i in $(ls /usr/share/postgresql/16/extension/pglogical\*); do ln -s i /usr/share/postgresql/13/extension/(basename $i); done  
> ln -s /usr/lib/postgresql/16/lib/pglogical.so /usr/lib/postgresql/13/lib/

but that just leads to this error

> FATAL: could not load library “/usr/lib/postgresql/13/lib/pglogical.so”:/usr/lib/postgresql/13/lib/pglogical.so: undefined symbol: shmem\_request\_hook

So the library files aren’t a 1:1 replacement between the different postgres versions.

In the end, it looks like there is a bit of a gap between the installed postgres version and the version the docker launcher things it’s building.

My end goal here is to get `pglogical` installed, and it would be most ideal to find a solution that is reproducible when rebuilding the container (i.e., files or lines that can be easily added to the template files). I definitely game and able to do more of the needed DevOps work here (as it is a requirement for my org), but am just curious if others have run into this gap and what you’ve done about it.

Thank you for reading!

---

<div class="post-metadata">

### Author: ![mqmenchaca](https://avatars.discourse-cdn.com/v4/letter/m/90ced4/32.png) [@mqmenchaca](https://meta.discourse.org/u/mqmenchaca)
#### Post date: [June 4, 2024, 8:02pm UTC](https://meta.discourse.org/t/discourse-docker-default-templates-and-postgres-version-are-out-of-sync/310440/2 "2024-06-04T20:02:40Z")

</div>

Silly, silly, silly me. The reason the pglogical files are there are because I ran

`sudo apt-get install postgresql-16-pglogical`

to put them there. (It was a long day of DevOps yesterday.) Running a `dpkg -L postgresql-16-pglogical` pointed that out for me…

Running

`sudo apt-get install postgresql-13-pglogical`

got pglogical up and running for me no problem. I am going to keep exploring this further, but at least I am unblocked on my urgent task.

However, I think the point I make above about the versions in discourse\_docker and postgres remains.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [June 4, 2024, 10:46pm UTC](https://meta.discourse.org/t/discourse-docker-default-templates-and-postgres-version-are-out-of-sync/310440/3 "2024-06-04T22:46:00Z")

</div>

Note that `psql --version` and `docker exec data su postgres -c "echo 'select version();'|psql"|grep PostgreSQL|cut -d " " -f 3` are not the same thing.

I think that the image has up-to-date client tools (that work for people who are running later versions of postgres that Discourse (probably) supports) and hasn’t force everyone to update to PG15 or whatever the plan is just yet.

---

<div class="post-metadata">

### Author: ![mqmenchaca](https://avatars.discourse-cdn.com/v4/letter/m/90ced4/32.png) [@mqmenchaca](https://meta.discourse.org/u/mqmenchaca)
#### Post date: [February 14, 2025, 10:33pm UTC](https://meta.discourse.org/t/discourse-docker-default-templates-and-postgres-version-are-out-of-sync/310440/4 "2025-02-14T22:33:59Z")

</div>

I’d also like to note that that adding this pglogical library most definitely breaks the postgres upgrade that was introduced in January in the discourse + discourse\_docker repos.
