I have a question regarding compatibility between versions of QGIS and PostgreSQL including PostGIS. Our IT security is switching to PostgreSQL version 13 (probably minor version 13.7) with PostGIS 3.1.4 soon. We are partly using QGIS version 3.4.5, mostly QGIS 3.10.4 as well as 3.22.10. Could there be any problems after the switch? Are there any analyses about this?
2 Answers
As discussed in an older question, QGIS supports connections to PostgreSQL/PostGIS through the use of the GDAL/OGR library. The version compatibility of the OGR vector drivers then determine the level of support for connections to PostgreSQL/PostGIS databases.
The PostgreSQL/PostGIS driver in GDAL/OGR is dependent on libpq, a client library provided as part of PostgreSQL releases.
There is no clear statement of version compatibility for the libpq library that I could find in its documentation, but an old discussion thread about this (one copy here) states that
If your binary is just a client application that uses libpq to speak to the server, you can use any (supported) version of libpq with any (supported) server version.
I believe that statement would apply to QGIS built using GDAL/OGR. This discussion explicitly refers to PostgreSQL's versioning policy which states that PostgreSQL major versions are supported for 5 years after initial release.
PostGIS has its own version support statement and compatibility matrix stating that the
project strives to support each minor version of PostGIS for 2-4 years after initial release and at the very least until the lowest PostgreSQL version supported by the PostGIS minor version is EOL'd.
For the particular versions mentioned by the OP, PostgreSQL versions 11 through 15 are currently supported (so use of PG 13.x should be fine and is supported until Nov. 2025) and PostGIS 3.1.4 supports PostgreSQL versions 11 through 14 (see matrix). Beyond that, check the version of GDAL you are using. The documentation for PostGIS says some newer features may be disabled if older dependencies (GDAL, Geos, Proj) are in use.
-
You are correct, but for the sake of exhaustivity (and to make things even less simple), qgis also needs to directly support postgresql, because it uses its metaschema. For instance, this has been necessary to support pg12 in qgis. So even if your version of gdal is high enough, you still need qgis >= 3.12 for pg12.– autraCommented Jan 3, 2023 at 10:32
-
In short, beware of github.com/qgis/QGIS/issues/32321 for qgis < 3.12– autraCommented Jan 3, 2023 at 10:34
There won't be any issue with compatibility between QGIS and PostGIS. I have used with QGIS 3.2.5, PostgreSQL 14.x, and PostGIS 3.22.x, and there wasn't any issue with any workflow in QGIS.