Search code examples
pythondjangodatabasepostgresqlheroku-postgres

Does Django 1.9.5 support PostgreSQL 11?


The end-of-life for Postgres 10 on Heroku is closer and closer, but I still have a legacy project on Django 1.9 using it there. Is it possible to migrate to Postgres 11 without troubles?


Solution

  • Going by the documentation:

    Django supports PostgreSQL 9.0 and higher. It requires the use of psycopg2 2.4.5 or higher (or 2.5+ if you want to use django.contrib.postgres).

    https://docs.djangoproject.com/en/1.8/ref/databases/#postgresql-notes

    The current psycopg2 implementation supports:

    • Python versions from 3.6 to 3.10
    • PostgreSQL server versions from 7.4 to 14
    • PostgreSQL client library version from 9.1

    https://www.psycopg.org/docs/install.html#prerequisites

    The earliest mentions of Postgres 11 in psycopg2 appear around 2.7.x, with 2.8 explicitly mentioning:

    • Dropped support for Python 2.6, 3.2, 3.3.

    • Wheel package compiled against OpenSSL 1.0.2r and PostgreSQL 11.2 libpq.

    https://www.psycopg.org/docs/news.html#what-s-new-in-psycopg-2-8

    So, the problem will be somewhere around psycopg, if anything. If you can run your Django project on Python 3.4+ with psycopg 2.8+, there should be no reason why it doesn't work. Older versions of psycopg2 may well work with Postgres 11+ just fine as well. You should simply test that on a local environment (e.g. Docker).