Buy our books! https://postgis.us/page_buy_book
![]() |
![]() |
![]() |
![]() |
Mastodon: https://mapstodon.space/@robe
pgRouting (a practical guide) 2nd Ed (Locate Press) in Progress. Subscribe at locatepress.com/subscribe |
I had PostgreSQL 16 installed, and then upgraded to PostgreSQL 17. Why does the extension I compiled/installed for 16 not work on 17. It's the same server!
apt install postgresql-17-postgis-3 postgresql-17-pgrouting
yum install pgrouting_17 postgis35_17
pg_upgrade refuses to upgrade me from PostgreSQL 16 to PostgreSQL 17, says my libpgrouting-3.6 is missing.
Note to extension authors, pg_upgrade doesn't care what new version the user has installed on their new PostgreSQL, it wants the version that was present in the old server. By that I mean the library must be named the same AND all the functions exposed via the SQL API, better be present in that library. BUT it better be compiled against the new version of PostgreSQL!
yum.postgresql.org
yum search postgis
It is possible for multiple versions of an extension to support multiple versions of PostgreSQL. It's up to the packager to allow this. But, installing one might break another so proceed with caution.
postgis30_13.x86_64 : Geographic Information Systems Extensions to PostgreSQL
postgis31_13.x86_64 : Geographic Information Systems Extensions to PostgreSQL
postgis31_14.x86_64 : Geographic Information Systems Extensions to PostgreSQL
postgis32_13.x86_64 : Geographic Information Systems Extensions to PostgreSQL
postgis32_14.x86_64 : Geographic Information Systems Extensions to PostgreSQL
postgis32_15.x86_64 : Geographic Information Systems Extensions to PostgreSQL
postgis33_13.x86_64 : Geographic Information Systems Extensions to PostgreSQL
postgis33_14.x86_64 : Geographic Information Systems Extensions to PostgreSQL
postgis33_15.x86_64 : Geographic Information Systems Extensions to PostgreSQL
postgis33_16.x86_64 : Geographic Information Systems Extensions to PostgreSQL
postgis33_17.x86_64 : Geographic Information Systems Extensions to PostgreSQL
postgis34_13.x86_64 : Geographic Information Systems Extensions to PostgreSQL
postgis34_14.x86_64 : Geographic Information Systems Extensions to PostgreSQL
postgis34_15.x86_64 : Geographic Information Systems Extensions to PostgreSQL
postgis34_16.x86_64 : Geographic Information Systems Extensions to PostgreSQL
postgis34_17.x86_64 : Geographic Information Systems Extensions to PostgreSQL
postgis35_13.x86_64 : Geographic Information Systems Extensions to PostgreSQL
postgis35_14.x86_64 : Geographic Information Systems Extensions to PostgreSQL
postgis35_15.x86_64 : Geographic Information Systems Extensions to PostgreSQL
postgis35_16.x86_64 : Geographic Information Systems Extensions to PostgreSQL
postgis35_17.x86_64 : Geographic Information Systems Extensions to PostgreSQL
apt search postgis
apt.postgresql.org, generally only allows one version of an extension per version of PostgreSQL.
postgresql-16-postgis-3/now 3.4.2+dfsg-1 amd64 [installed,local]
Geographic objects support for PostgreSQL 16
postgresql-16-postgis-3-scripts/now 3.4.2+dfsg-1 all [installed,local]
Geographic objects support for PostgreSQL 16 -- SQL scripts
postgresql-17-postgis-3/testing 3.5.2+dfsg-1 amd64
Geographic objects support for PostgreSQL 17
postgresql-17-postgis-3-scripts/testing 3.5.2+dfsg-1 all
Geographic objects support for PostgreSQL 17 -- SQL scripts
postgresql-postgis/testing 3.5.2+dfsg-1 amd64
Geographic objects support for PostgreSQL -- Metapackage
postgresql-postgis-scripts/testing 3.5.2+dfsg-1 all
Geographic objects support for PostgreSQL -- SQL scripts metapackage
Versions that need to be generated managed by upgradeable_versions.mk
UPGRADEABLE_VERSIONS = \
2.0.0 \
2.0.1 \
2.0.2 \
2.0.3 \
..
In the past these were symlinks (but symlinks don't work well on windows and possibly some other systems). So we decided to switch to essentially 0-byte files. If you look at the list most have nothing in them except for the ANY--3.5.2 and --3.5.2 where 3.5.2 is the version we are releasing.
:
-rw-r--r-- 1 lr lr 112 Mar 22 20:20 postgis--3.2.4--ANY.sql
-rw-r--r-- 1 lr lr 112 Mar 22 20:20 postgis--3.2.5--ANY.sql
-rw-r--r-- 1 lr lr 112 Mar 22 20:20 postgis--3.2.6--ANY.sql
-rw-r--r-- 1 lr lr 112 Mar 22 20:20 postgis--3.2.7--ANY.sql
-rw-r--r-- 1 lr lr 112 Mar 22 20:20 postgis--3.3.0--ANY.sql
-rw-r--r-- 1 lr lr 112 Mar 22 20:20 postgis--3.3.1--ANY.sql
-rw-r--r-- 1 lr lr 112 Mar 22 20:20 postgis--3.3.2--ANY.sql
-rw-r--r-- 1 lr lr 112 Mar 22 20:20 postgis--3.3.3--ANY.sql
:
-rw-r--r-- 1 lr lr 112 Mar 22 20:20 postgis--3.4.0--ANY.sql
-rw-r--r-- 1 lr lr 112 Mar 22 20:20 postgis--3.4.1--ANY.sql
-rw-r--r-- 1 lr lr 112 Mar 22 20:20 postgis--3.4.2--ANY.sql
-rw-r--r-- 1 lr lr 112 Mar 22 20:20 postgis--3.4.3--ANY.sql
:
-rw-r--r-- 1 lr lr 112 Mar 22 20:20 postgis--3.5.0--ANY.sql
-rw-r--r-- 1 lr lr 112 Mar 22 20:20 postgis--3.5.1--ANY.sql
-rw-r--r-- 1 lr lr 7.2M Mar 22 20:19 postgis--3.5.2.sql
-rw-r--r-- 1 lr lr 7.5M Mar 22 20:19 postgis--ANY--3.5.2.sql
Handles upgrading of all packaged postgis extensions. Also allows upgrade from same version to same version. ALTER EXTENSION assumes if source and target version are the same, nothing needs to be done.
SELECT postgis_extensions_upgrade();
SELECT postgis_full_version();
PostgreSQL in contrib of source code are not versioned at all e.g. hstore.so, pg_trgm.so and so on.
Line in postgis.sql.in |
---|
|
→ |
Generates lines in ANY--postgis-3.5.2 |
---|
|
/** throws an error if these are called, but pg_upgrade can load it**/
POSTGIS_DEPRECATE("2.5.0", pgis_abs_in)
POSTGIS_DEPRECATE("3.5.0", check_authorization)
postgis_before_upgrade.sql, postgis_after_upgrade.sql
#if POSTGIS_PGSQL_VERSION >= 120
/** do stuff for newer versions **/
#end if
If your extension behavior changes when version of PostgreSQL changes, make sure you've got a sql function that tells you what version was running when it was installed.
CREATE OR REPLACE FUNCTION _postgis_scripts_pgsql_version() RETURNS text
AS _POSTGIS_SQL_SELECT_POSTGIS_PGSQL_VERSION
LANGUAGE 'sql' IMMUTABLE;
How do you schema qualify your references to other extensions if you don't know what schema they are installed in?
New feature in PostgreSQL 16, introduced by meno_relocate = 'postgis,pgrouting'
to prevent relocation of a dependent extension. These should be a subset of your requires.requires = 'postgis,pgrouting'
and will check for schema qualification of required extensions@extschema:reqextname@
. e.g. @extschema:postgis@.ST_Intersects(..)
Discussion is here and draft patch - Support % wildcard in extension upgrade filenames
Many extensions that don't follow a linear model have same issue as PostGIS.
Many extensions have their own extension version function, that lists the true version of the library or sql api installed. Would be nice if perhaps as part of the control file, extensions can specify what this function is and PostgreSQL can have a function like pg_extension_true_version('postgis') that calls this.
e.g PostGIS has postgis_full_version()
and postgis_version()
, pgRouting has a pgr_version()
, pgr_full_version()
It's hard to remember all these function names when you need to inspect what you are really running.
Easier way for other extensions to call lib functions in another extension lib without resorting to go thru the SQL API, which can be very slow. E.g. MobilityDb extension embeds a bit of PostGIS to get around this issue.
Instead of loading the functions from the current DB, would be nice, if pg_upgrade had a switch to allow CREATE EXTENSION, that way errors like pgrouting-3.6 can't be found will be a thing of the past. Also wouldn't need to run ALTER EXTENSION ... UPDATE for every single extension you have after upgrade.