Postgres Minimum Version

AI-generated summary

The discussion revolves around the minimum required PostgreSQL version for Discourse. tmm1 reports an error with jsonb_build_object in PostgreSQL 9.4.18, indicating that the function was introduced in 9.5. pfaffman suggests using PostgreSQL 10, which is the version currently used in all installations. rishabh updates the README.md to require PostgreSQL 9.5, noting that Ubuntu 16.04 ships with 9.5 by default. However, Falco emphasizes that the requirement should be PostgreSQL 10, as it’s the standard across all installations. rishabh agrees and updates the documentation to reflect PostgreSQL 10 and Ubuntu 18.04, aligning with the official PostgreSQL installation guidelines for broader compatibility.

README states 9.3+ is required. But using 9.4.18 I am seeing errors in Jobs::UpdateUsername

PG::UndefinedFunction: ERROR: function jsonb_build_object(unknown, text, unknown, text, unknown, text, unknown, text) does not exist
LINE 4: jsonb_build_object(

It appears that jsonb_build_object was added in 9.5

2 Likes

Standard install:

# psql --version
psql (PostgreSQL) 10.3 (Ubuntu 10.3-1.pgdg16.04+1

That’s what I’d recommend. You can search here, but I think 10 is required.

2 Likes

@rishabh can you update readme as you have time.

2 Likes

I’ve updated README.md and a few other docs, Thanks @tmm1 :+1:

I’ve just bumped it from 9.3 to 9.5 for now because Ubuntu 16.04 still ships with 9.5 :thinking:

3 Likes

We should really point to 10, since it’s what we use on every install.

PostgreSQL officially supports Ubuntu 16.04: Apt - PostgreSQL wiki

6 Likes

Sure, I’ll change it back to 10!

I chose 9.5 because on a fresh 16.04 droplet:

apt install postgres → installs 9.5
apt install postgres-10 → doesn’t have an installation candidate

so our instructions here will not work on 16.04:
https://github.com/discourse/discourse/blob/master/docs/DEVELOPER-ADVANCED.md#preparing-a-fresh-ubuntu-install

Can I update that guide to say Postgres 10 & Ubuntu 18.04?

2 Likes

Yes, the guide should point to the official PostgreSQL docs for installation, so it will work in any distro/version.

6 Likes

Awesome, it is done: Change postgres version 9.5 to 10 in docs/ and README.md · discourse/discourse@0dd9898 · GitHub :balloon:

6 Likes