[SCM] PostGIS branch master updated. 3.6.0rc2-493-g219496998
git at osgeo.org
git at osgeo.org
Fri May 29 10:58:55 PDT 2026
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".
The branch, master has been updated
via 21949699858347065db080de31687841ce834ea0 (commit)
via 34fa82354980b365d674faf38d4e971d2284ff03 (commit)
via 86ae2fb265311d1b3a27b8ade404780029545426 (commit)
from 5001c51659429ac9fe07723f18ece81a7cbd2deb (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 21949699858347065db080de31687841ce834ea0
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Fri May 29 10:58:46 2026 -0700
News item for #5988
diff --git a/NEWS b/NEWS
index 05e49ccf7..48dcf7ea2 100644
--- a/NEWS
+++ b/NEWS
@@ -72,6 +72,7 @@ This version requires GEOS 3.10 or higher
(Darafei Praliaskouski)
- GH-848, CG_AlphaShape now returns a MultiPolygon (Jean Felder)
- Flatgeobuf schema mismatch vulnerability (NeuroWinter)
+ - #5899, pg_upgrade issue for non-standard geography SRID (Paul Ramsey)
PostGIS 3.6.0
commit 34fa82354980b365d674faf38d4e971d2284ff03
Merge: 86ae2fb26 5001c5165
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Fri May 29 10:51:44 2026 -0700
Merge branch 'master' into master-srs-upgrade
commit 86ae2fb265311d1b3a27b8ade404780029545426
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Fri May 29 16:21:02 2026 +0000
pg_upgrade issue for non-standard geography SRID
When doing pg_upgrade on a table with Geography(type, srid)
column, where the SRID is specified, but not 4326, the SRID
lookup code will fail during schema transfer as the
spatial_ref_sys table may be missing and unable to lookup
the SRID number. This "fix" leans on the fact that most
SRID numbers in PostGIS are already EPSG numbers so the
lookup can be skipped most times.
diff --git a/libpgcommon/lwgeom_transform.c b/libpgcommon/lwgeom_transform.c
index 53fe0a5d3..fdb60b34a 100644
--- a/libpgcommon/lwgeom_transform.c
+++ b/libpgcommon/lwgeom_transform.c
@@ -176,6 +176,40 @@ GetProjStringsSPI(int32_t srid)
elog(ERROR, "Could not connect to database using SPI");
}
+ /*
+ * During pg_upgrade, geography typmod is parsed before spatial_ref_sys
+ * exists or is populated. Check both conditions via catalog before
+ * querying the table, to avoid a transaction-aborting error.
+ * If either check fails, return "EPSG:<srid>" directly so PROJ can
+ * resolve standard codes from its own database.
+ */
+ Oid nsp_oid = POSTGIS_CONSTANTS ? POSTGIS_CONSTANTS->install_nsp_oid : InvalidOid;
+ snprintf(proj_spi_buffer, spibufferlen,
+ "SELECT 1 FROM pg_class "
+ "WHERE relname = 'spatial_ref_sys' AND relnamespace = %u",
+ nsp_oid);
+ spi_result = SPI_execute(proj_spi_buffer, true, 1);
+ bool srs_exists = (spi_result == SPI_OK_SELECT && SPI_processed > 0);
+
+ bool srs_populated = false;
+ if (srs_exists)
+ {
+ snprintf(proj_spi_buffer, spibufferlen,
+ "SELECT 1 FROM %s LIMIT 1",
+ postgis_spatial_ref_sys());
+ spi_result = SPI_execute(proj_spi_buffer, true, 1);
+ srs_populated = (spi_result == SPI_OK_SELECT && SPI_processed > 0);
+ }
+
+ if (!srs_exists || !srs_populated)
+ {
+ char tmp[maxprojlen];
+ snprintf(tmp, maxprojlen, "EPSG:%d", srid);
+ strs.authtext = SPI_pstrdup(tmp);
+ SPI_finish();
+ return strs;
+ }
+
static char *proj_str_tmpl =
"SELECT proj4text, auth_name, auth_srid, srtext "
"FROM %s "
-----------------------------------------------------------------------
Summary of changes:
NEWS | 1 +
libpgcommon/lwgeom_transform.c | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 35 insertions(+)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list