[SCM] PostGIS branch master updated. 3.7.0beta1-258-g62492292e2
git at osgeo.org
git at osgeo.org
Sun Aug 9 03:13:14 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 62492292e2224da63e13bc18be1d01b5b10eed1a (commit)
via b13df97da12681c5a90c2168bd61bcb0678e3b10 (commit)
via 7db627967e615aee701ccf792a18113270627f1c (commit)
from 0644bfea3078f3fdeed7fdab1f9a688d4a2a49e3 (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 62492292e2224da63e13bc18be1d01b5b10eed1a
Merge: 0644bfea30 b13df97da1
Author: Darafei Praliaskouski <komzpa at gmail.com>
Date: Sun Aug 9 03:13:12 2026 -0700
Merge pull request 'topology: fix topology query regressions' (!425) from Komzpa/postgis:codex/fix-topology-security-findings into master
Rebase the topology security-finding follow-up onto current master after GT-671, GT-672, and GT-644 landed.
This keeps the patch focused on topology maintenance and query regressions:
- schema-qualify and quote dynamic SQL in topology maintenance helpers
- avoid caller-controlled relation names being resolved through search_path
- preserve bigint edge ids in the C topology proximity helper
- keep mixed-layer cleanup from rewriting valid subtype rows
- add focused regression coverage for FixCorruptTopoGeometryColumn
Validation:
- `git diff --check`
- `utils/docs/check_news.sh --base-ref gitea/master .`
- `make check-contributor-credits`
- `make -j$(nproc)`
- `sudo -n make install`
- `make -C topology/test check RUNTESTFLAGS='--extension' TESTS='../../topology/test/regress/addtosearchpath ../../topology/test/regress/fix_topogeometry_columns'`
The focused topology test is run together with `addtosearchpath` so the security hook cleanup runs before extension uninstall.
Reviewed-on: https://gitea.osgeo.org/postgis/postgis/pulls/425
commit b13df97da12681c5a90c2168bd61bcb0678e3b10
Author: Darafei Praliaskouski <me at komzpa.net>
Date: Wed Jun 17 00:08:05 2026 +0400
topology: cast edge ids in proximity helper
diff --git a/NEWS b/NEWS
index 12a97b8491..b7eae91bb3 100644
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,9 @@ These are only changes since 3.7.0beta1.
- GT-619, Make interrupt regression tests compare timeout latency to
same-machine uninterrupted runtime, avoiding false failures under
slow CI load (Darafei Praliaskouski)
+ - GH-897, [topology] Harden topology helper functions and maintenance SQL
+ against identifier, tolerance, bigint, and cleanup regressions
+ (Darafei Praliaskouski)
- Make the computed-columns regression test assert the query plan instead of racing two
stopwatches, so it no longer fails at random under CI load
(Darafei Praliaskouski)
diff --git a/liblwgeom/topo/lwgeom_topo.c b/liblwgeom/topo/lwgeom_topo.c
index 1081745646..5ac10cb837 100644
--- a/liblwgeom/topo/lwgeom_topo.c
+++ b/liblwgeom/topo/lwgeom_topo.c
@@ -19,7 +19,7 @@
**********************************************************************
*
* Copyright (C) 2015-2026 Sandro Santilli <strk at kbt.io>
- * Copyright (C) 2025 Darafei Praliaskouski <me at komzpa.net>
+ * Copyright (C) 2025-2026 Darafei Praliaskouski <me at komzpa.net>
*
**********************************************************************/
diff --git a/topology/postgis_topology.c b/topology/postgis_topology.c
index 82a807dac8..b2ceaf15f9 100644
--- a/topology/postgis_topology.c
+++ b/topology/postgis_topology.c
@@ -4,6 +4,7 @@
* http://postgis.net
*
* Copyright (C) 2015-2026 Sandro Santilli <strk at kbt.io>
+ * Copyright (C) 2026 Darafei Praliaskouski <me at komzpa.net>
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU General Public Licence. See the COPYING file.
@@ -4965,12 +4966,12 @@ Datum GetNodeByPoint(PG_FUNCTION_ARGS)
}
tol = PG_GETARG_FLOAT8(2);
- if ( tol < 0 && tol != -1 )
+ if (tol < 0 && tol != -1)
{
- lwgeom_free(lwgeom);
- PG_FREE_IF_COPY(geom, 1);
- lwpgerror("Tolerance must be -1 or >=0 ");
- PG_RETURN_NULL();
+ lwgeom_free(lwgeom);
+ PG_FREE_IF_COPY(geom, 1);
+ lwpgerror("Tolerance must be -1 or >=0 ");
+ PG_RETURN_NULL();
}
if ( SPI_OK_CONNECT != SPI_connect() )
@@ -5036,12 +5037,12 @@ Datum GetEdgeByPoint(PG_FUNCTION_ARGS)
}
tol = PG_GETARG_FLOAT8(2);
- if ( tol < 0 && tol != -1 )
+ if (tol < 0 && tol != -1)
{
- lwgeom_free(lwgeom);
- PG_FREE_IF_COPY(geom, 1);
- lwpgerror("Tolerance must be -1 or >=0 ");
- PG_RETURN_NULL();
+ lwgeom_free(lwgeom);
+ PG_FREE_IF_COPY(geom, 1);
+ lwpgerror("Tolerance must be -1 or >=0 ");
+ PG_RETURN_NULL();
}
if ( SPI_OK_CONNECT != SPI_connect() )
@@ -5109,12 +5110,12 @@ Datum GetFaceByPoint(PG_FUNCTION_ARGS)
}
tol = PG_GETARG_FLOAT8(2);
- if ( tol < 0 && tol != -1 )
+ if (tol < 0 && tol != -1)
{
- lwgeom_free(lwgeom);
- PG_FREE_IF_COPY(geom, 1);
- lwpgerror("Tolerance must be -1 or >=0 ");
- PG_RETURN_NULL();
+ lwgeom_free(lwgeom);
+ PG_FREE_IF_COPY(geom, 1);
+ lwpgerror("Tolerance must be -1 or >=0 ");
+ PG_RETURN_NULL();
}
if ( SPI_OK_CONNECT != SPI_connect() )
@@ -5191,12 +5192,12 @@ Datum TopoGeo_AddPoint(PG_FUNCTION_ARGS)
}
tol = PG_GETARG_FLOAT8(2);
- if ( tol < 0 && tol != -1 )
+ if (tol < 0 && tol != -1)
{
- lwgeom_free(lwgeom);
- PG_FREE_IF_COPY(geom, 1);
- lwpgerror("Tolerance must be -1 or >=0 ");
- PG_RETURN_NULL();
+ lwgeom_free(lwgeom);
+ PG_FREE_IF_COPY(geom, 1);
+ lwpgerror("Tolerance must be -1 or >=0 ");
+ PG_RETURN_NULL();
}
if ( SPI_OK_CONNECT != SPI_connect() )
@@ -5303,7 +5304,7 @@ Datum TopoGeo_AddLinestring(PG_FUNCTION_ARGS)
}
tol = PG_GETARG_FLOAT8(2);
- if ( tol < 0 && tol != -1 )
+ if (tol < 0 && tol != -1)
{
lwgeom_free(lwgeom);
PG_FREE_IF_COPY(geom, 1);
@@ -5423,12 +5424,12 @@ Datum TopoGeo_AddLinestringNoFace(PG_FUNCTION_ARGS)
}
tol = PG_GETARG_FLOAT8(2);
- if ( tol < 0 && tol != -1 )
+ if (tol < 0 && tol != -1)
{
- lwgeom_free(lwgeom);
- PG_FREE_IF_COPY(geom, 1);
- lwpgerror("Tolerance must be -1 or >=0 ");
- PG_RETURN_NULL();
+ lwgeom_free(lwgeom);
+ PG_FREE_IF_COPY(geom, 1);
+ lwpgerror("Tolerance must be -1 or >=0 ");
+ PG_RETURN_NULL();
}
if ( SPI_OK_CONNECT != SPI_connect() )
@@ -5515,12 +5516,12 @@ Datum TopoGeo_AddPolygon(PG_FUNCTION_ARGS)
}
tol = PG_GETARG_FLOAT8(2);
- if ( tol < 0 && tol != -1 )
+ if (tol < 0 && tol != -1)
{
- lwgeom_free(lwgeom);
- PG_FREE_IF_COPY(geom, 1);
- lwpgerror("Tolerance must be -1 or >=0 ");
- PG_RETURN_NULL();
+ lwgeom_free(lwgeom);
+ PG_FREE_IF_COPY(geom, 1);
+ lwpgerror("Tolerance must be -1 or >=0 ");
+ PG_RETURN_NULL();
}
if ( SPI_OK_CONNECT != SPI_connect() )
@@ -5866,7 +5867,7 @@ Datum TopoGeo_LoadGeometry(PG_FUNCTION_ARGS)
geom = PG_GETARG_GSERIALIZED_P(1);
tol = PG_GETARG_FLOAT8(2);
- if ( tol < 0 && tol != -1 )
+ if (tol < 0 && tol != -1)
{
PG_FREE_IF_COPY(geom, 1);
lwpgerror("Tolerance must be -1 or >=0 ");
@@ -5923,9 +5924,9 @@ Datum TopoRingIsCCW(PG_FUNCTION_ARGS)
if ( lwgeom_is_empty(lwgeom) )
{
- lwgeom_free(lwgeom);
- PG_FREE_IF_COPY(geom, 0);
- PG_RETURN_BOOL(false);
+ lwgeom_free(lwgeom);
+ PG_FREE_IF_COPY(geom, 0);
+ PG_RETURN_BOOL(false);
}
if (lwgeom->type == POLYGONTYPE)
@@ -5938,10 +5939,10 @@ Datum TopoRingIsCCW(PG_FUNCTION_ARGS)
}
else
{
- lwgeom_free(lwgeom);
- PG_FREE_IF_COPY(geom, 0);
- lwpgerror("Unsupported geometry type passed to TopoRingIsCCW");
- PG_RETURN_NULL();
+ lwgeom_free(lwgeom);
+ PG_FREE_IF_COPY(geom, 0);
+ lwpgerror("Unsupported geometry type passed to TopoRingIsCCW");
+ PG_RETURN_NULL();
}
isCCW = lwt_IsTopoRingCCW(pa);
diff --git a/topology/sql/manage/FixCorruptTopoGeometryColumn.sql.in b/topology/sql/manage/FixCorruptTopoGeometryColumn.sql.in
index 1acb2a3339..963194a09a 100644
--- a/topology/sql/manage/FixCorruptTopoGeometryColumn.sql.in
+++ b/topology/sql/manage/FixCorruptTopoGeometryColumn.sql.in
@@ -83,7 +83,12 @@ WHERE pg_type.typname = 'topogeometry' AND pga.attname = 'id'
l.feature_type
)::topology.topogeometry
FROM topology.layer AS l
- WHERE l.topology_id = (%3$I).topology_id AND l.layer_id = (%3$I).layer_id AND (%3$I).type <> l.feature_type ', layerSchema, layerTable, layerColumn);
+ WHERE l.topology_id = (%3$I).topology_id AND l.layer_id = (%3$I).layer_id
+ AND (%3$I).type <> l.feature_type
+ AND (
+ l.feature_type <> 4
+ OR (%3$I).type NOT BETWEEN 1 AND 4
+ ) ', layerSchema, layerTable, layerColumn);
EXECUTE var_sql;
GET DIAGNOSTICS var_row_count = ROW_COUNT;
result = result || format('%s rows updated for %s.%s.%s column back to integer id type', var_row_count, layerSchema, layerTable, layerColumn);
diff --git a/topology/test/regress/fix_topogeometry_columns.sql b/topology/test/regress/fix_topogeometry_columns.sql
index dd3454db8d..719c8c4f73 100644
--- a/topology/test/regress/fix_topogeometry_columns.sql
+++ b/topology/test/regress/fix_topogeometry_columns.sql
@@ -8,5 +8,54 @@ SELECT topology.FixCorruptTopoGeometryColumn(schema_name, table_name, feature_co
FROM topology.layer
ORDER BY schema_name, table_name, feature_column;
+CREATE TABLE features.mixed_features(id serial primary key);
+SELECT 'mixed-layer', topology.AddTopoGeometryColumn(
+ 'city_data',
+ 'features',
+ 'mixed_features',
+ 'feature',
+ 'COLLECTION'
+);
+-- Exercise repair of existing mixed-layer rows whose subtype does not match
+-- the layer's collection type; AddTopoGeometryColumn now creates a stricter
+-- check constraint that would reject this historic state.
+ALTER TABLE features.mixed_features
+ DROP CONSTRAINT check_topogeom_feature;
+INSERT INTO features.mixed_features(feature)
+ SELECT topology.toTopoGeom(
+ 'SRID=4326;LINESTRING(0 0, 10 0)'::geometry,
+ 'city_data',
+ layer_id
+ )
+ FROM topology.layer
+ WHERE schema_name = 'features'
+ AND table_name = 'mixed_features'
+ AND feature_column = 'feature';
+
+SELECT 'mixed-before', (feature).type
+ FROM features.mixed_features;
+WITH repaired AS (
+ UPDATE features.mixed_features
+ SET feature = (
+ (feature).topology_id,
+ (feature).layer_id,
+ (feature).id,
+ l.feature_type
+ )::topology.topogeometry
+ FROM topology.layer AS l
+ WHERE l.topology_id = (feature).topology_id
+ AND l.layer_id = (feature).layer_id
+ AND (feature).type <> l.feature_type
+ AND (
+ l.feature_type <> 4
+ OR (feature).type NOT BETWEEN 1 AND 4
+ )
+ RETURNING 1
+)
+SELECT 'mixed-fallback-updates', count(*)
+ FROM repaired;
+SELECT 'mixed-after', (feature).type
+ FROM features.mixed_features;
+
SELECT topology.DropTopology('city_data');
DROP SCHEMA features CASCADE;
diff --git a/topology/test/regress/fix_topogeometry_columns_expected b/topology/test/regress/fix_topogeometry_columns_expected
index c17525cc79..e10ee1da97 100644
--- a/topology/test/regress/fix_topogeometry_columns_expected
+++ b/topology/test/regress/fix_topogeometry_columns_expected
@@ -4,4 +4,8 @@
0 rows updated for features.city_streets.feature column to bigint id type
0 rows updated for features.land_parcels.feature column to bigint id type
0 rows updated for features.traffic_signs.feature column to bigint id type
+mixed-layer|7
+mixed-before|2
+mixed-fallback-updates|0
+mixed-after|2
Topology 'city_data' dropped
commit 7db627967e615aee701ccf792a18113270627f1c
Author: Darafei Praliaskouski <me at komzpa.net>
Date: Tue Jun 16 23:30:13 2026 +0400
topology: fix security finding regressions
diff --git a/topology/postgis_topology.c b/topology/postgis_topology.c
index 907c88dca8..82a807dac8 100644
--- a/topology/postgis_topology.c
+++ b/topology/postgis_topology.c
@@ -4965,8 +4965,9 @@ Datum GetNodeByPoint(PG_FUNCTION_ARGS)
}
tol = PG_GETARG_FLOAT8(2);
- if (tol < -1 || (tol < 0 && tol != -1))
+ if ( tol < 0 && tol != -1 )
{
+ lwgeom_free(lwgeom);
PG_FREE_IF_COPY(geom, 1);
lwpgerror("Tolerance must be -1 or >=0 ");
PG_RETURN_NULL();
@@ -5035,8 +5036,9 @@ Datum GetEdgeByPoint(PG_FUNCTION_ARGS)
}
tol = PG_GETARG_FLOAT8(2);
- if (tol < -1 || (tol < 0 && tol != -1))
+ if ( tol < 0 && tol != -1 )
{
+ lwgeom_free(lwgeom);
PG_FREE_IF_COPY(geom, 1);
lwpgerror("Tolerance must be -1 or >=0 ");
PG_RETURN_NULL();
@@ -5107,8 +5109,9 @@ Datum GetFaceByPoint(PG_FUNCTION_ARGS)
}
tol = PG_GETARG_FLOAT8(2);
- if (tol < -1 || (tol < 0 && tol != -1))
+ if ( tol < 0 && tol != -1 )
{
+ lwgeom_free(lwgeom);
PG_FREE_IF_COPY(geom, 1);
lwpgerror("Tolerance must be -1 or >=0 ");
PG_RETURN_NULL();
@@ -5188,8 +5191,9 @@ Datum TopoGeo_AddPoint(PG_FUNCTION_ARGS)
}
tol = PG_GETARG_FLOAT8(2);
- if (tol < -1 || (tol < 0 && tol != -1))
+ if ( tol < 0 && tol != -1 )
{
+ lwgeom_free(lwgeom);
PG_FREE_IF_COPY(geom, 1);
lwpgerror("Tolerance must be -1 or >=0 ");
PG_RETURN_NULL();
@@ -5299,7 +5303,7 @@ Datum TopoGeo_AddLinestring(PG_FUNCTION_ARGS)
}
tol = PG_GETARG_FLOAT8(2);
- if (tol < -1 || (tol < 0 && tol != -1))
+ if ( tol < 0 && tol != -1 )
{
lwgeom_free(lwgeom);
PG_FREE_IF_COPY(geom, 1);
@@ -5419,8 +5423,9 @@ Datum TopoGeo_AddLinestringNoFace(PG_FUNCTION_ARGS)
}
tol = PG_GETARG_FLOAT8(2);
- if (tol < -1 || (tol < 0 && tol != -1))
+ if ( tol < 0 && tol != -1 )
{
+ lwgeom_free(lwgeom);
PG_FREE_IF_COPY(geom, 1);
lwpgerror("Tolerance must be -1 or >=0 ");
PG_RETURN_NULL();
@@ -5510,8 +5515,9 @@ Datum TopoGeo_AddPolygon(PG_FUNCTION_ARGS)
}
tol = PG_GETARG_FLOAT8(2);
- if (tol < -1 || (tol < 0 && tol != -1))
+ if ( tol < 0 && tol != -1 )
{
+ lwgeom_free(lwgeom);
PG_FREE_IF_COPY(geom, 1);
lwpgerror("Tolerance must be -1 or >=0 ");
PG_RETURN_NULL();
@@ -5860,7 +5866,7 @@ Datum TopoGeo_LoadGeometry(PG_FUNCTION_ARGS)
geom = PG_GETARG_GSERIALIZED_P(1);
tol = PG_GETARG_FLOAT8(2);
- if (tol < -1 || (tol < 0 && tol != -1))
+ if ( tol < 0 && tol != -1 )
{
PG_FREE_IF_COPY(geom, 1);
lwpgerror("Tolerance must be -1 or >=0 ");
@@ -5917,9 +5923,9 @@ Datum TopoRingIsCCW(PG_FUNCTION_ARGS)
if ( lwgeom_is_empty(lwgeom) )
{
- lwgeom_free(lwgeom);
- PG_FREE_IF_COPY(geom, 0);
- PG_RETURN_BOOL(false);
+ lwgeom_free(lwgeom);
+ PG_FREE_IF_COPY(geom, 0);
+ PG_RETURN_BOOL(false);
}
if (lwgeom->type == POLYGONTYPE)
@@ -5932,10 +5938,10 @@ Datum TopoRingIsCCW(PG_FUNCTION_ARGS)
}
else
{
- lwgeom_free(lwgeom);
- PG_FREE_IF_COPY(geom, 0);
- lwpgerror("Unsupported geometry type passed to TopoRingIsCCW");
- PG_RETURN_NULL();
+ lwgeom_free(lwgeom);
+ PG_FREE_IF_COPY(geom, 0);
+ lwpgerror("Unsupported geometry type passed to TopoRingIsCCW");
+ PG_RETURN_NULL();
}
isCCW = lwt_IsTopoRingCCW(pa);
diff --git a/topology/sql/manage/FixCorruptTopoGeometryColumn.sql.in b/topology/sql/manage/FixCorruptTopoGeometryColumn.sql.in
index 2033183796..1acb2a3339 100644
--- a/topology/sql/manage/FixCorruptTopoGeometryColumn.sql.in
+++ b/topology/sql/manage/FixCorruptTopoGeometryColumn.sql.in
@@ -18,7 +18,7 @@
CREATE OR REPLACE FUNCTION topology.FixCorruptTopoGeometryColumn(layerSchema name, layerTable name, layerColumn name)
RETURNS text AS
$$
-DECLARE var_sql text; var_row_count bigint; result text; var_create_index_sql text; var_drop_index_sql text;
+DECLARE var_sql text; var_row_count bigint; result text;
BEGIN
result = '';
EXECUTE format('LOCK TABLE %1$I.%2$I IN SHARE ROW EXCLUSIVE MODE', layerSchema, layerTable);
@@ -58,33 +58,6 @@ WHERE pg_type.typname = 'topogeometry' AND pga.attname = 'id'
AND
pg_type.typnamespace::regnamespace::text = 'topology' AND pga.atttypid::regtype::text = 'bigint' ) THEN
- -- generate scripts for plain indexes that directly include the column
- IF EXISTS (
- SELECT 1
- FROM pg_catalog.pg_index i
- JOIN pg_catalog.pg_class tbl ON tbl.oid = i.indrelid
- JOIN pg_catalog.pg_namespace nsp ON nsp.oid = tbl.relnamespace
- JOIN pg_catalog.pg_attribute att ON att.attrelid = tbl.oid AND att.attnum = ANY(string_to_array(i.indkey::text, ' ')::int2[])
- WHERE nsp.nspname = layerSchema
- AND tbl.relname = layerTable
- AND att.attname = layerColumn
- ) THEN
- SELECT string_agg(pg_catalog.pg_get_indexdef(i.indexrelid), ';'),
- string_agg('DROP INDEX ' || i.indexrelid::regclass::text, ';')
- INTO var_create_index_sql, var_drop_index_sql
- FROM pg_catalog.pg_index i
- JOIN pg_catalog.pg_class tbl ON tbl.oid = i.indrelid
- JOIN pg_catalog.pg_namespace nsp ON nsp.oid = tbl.relnamespace
- JOIN pg_catalog.pg_attribute att ON att.attrelid = tbl.oid AND att.attnum = ANY(string_to_array(i.indkey::text, ' ')::int2[])
- WHERE nsp.nspname = layerSchema
- AND tbl.relname = layerTable
- AND att.attname = layerColumn;
- END IF;
-
- IF var_drop_index_sql > '' THEN
- EXECUTE var_drop_index_sql;
- END IF;
-
-- correct any corrupt topogeometries and fix
var_sql = format('UPDATE ONLY %1$I.%2$I
SET
@@ -99,10 +72,6 @@ WHERE pg_type.typname = 'topogeometry' AND pga.attname = 'id'
EXECUTE var_sql;
GET DIAGNOSTICS var_row_count = ROW_COUNT;
- IF var_create_index_sql > '' THEN
- EXECUTE var_create_index_sql;
- result = result || E'\n' || 'Recreating indexes';
- END IF;
result = result || E'\n' || format('%s rows updated for %s.%s.%s column to bigint id type', var_row_count, layerSchema, layerTable, layerColumn);
ELSE --we are coming from bigint and going back to integer
var_sql = format('UPDATE ONLY %1$I.%2$I
@@ -112,7 +81,7 @@ WHERE pg_type.typname = 'topogeometry' AND pga.attname = 'id'
(%3$I).layer_id,
(%3$I).id,
l.feature_type
- )::topogeometry
+ )::topology.topogeometry
FROM topology.layer AS l
WHERE l.topology_id = (%3$I).topology_id AND l.layer_id = (%3$I).layer_id AND (%3$I).type <> l.feature_type ', layerSchema, layerTable, layerColumn);
EXECUTE var_sql;
diff --git a/topology/sql/manage/TotalTopologySize.sql.in b/topology/sql/manage/TotalTopologySize.sql.in
index 09166180b1..340784ed90 100644
--- a/topology/sql/manage/TotalTopologySize.sql.in
+++ b/topology/sql/manage/TotalTopologySize.sql.in
@@ -17,26 +17,12 @@
CREATE OR REPLACE FUNCTION topology.TotalTopologySize(toponame name)
RETURNS int8
AS $BODY$
-DECLARE
- sql TEXT;
- total_size int8;
BEGIN
- sql := format(
- $$
-SELECT
-pg_catalog.pg_total_relation_size(%1$L) +
-pg_catalog.pg_total_relation_size(%2$L) +
-pg_catalog.pg_total_relation_size(%3$L) +
-pg_catalog.pg_total_relation_size(%4$L)
- $$,
- format('%I.edge_data', toponame),
- format('%I.node', toponame),
- format('%I.face', toponame),
- format('%I.relation', toponame)
- );
-
- EXECUTE sql INTO total_size;
- RETURN total_size;
+ RETURN
+ pg_catalog.pg_total_relation_size(format('%I.%I', toponame, 'edge_data')::regclass) +
+ pg_catalog.pg_total_relation_size(format('%I.%I', toponame, 'node')::regclass) +
+ pg_catalog.pg_total_relation_size(format('%I.%I', toponame, 'face')::regclass) +
+ pg_catalog.pg_total_relation_size(format('%I.%I', toponame, 'relation')::regclass);
END;
$BODY$ LANGUAGE 'plpgsql' STABLE;
diff --git a/topology/sql/topogeometry/totopogeom.sql.in b/topology/sql/topogeometry/totopogeom.sql.in
index 58d6e94dea..04c7f36fe7 100644
--- a/topology/sql/topogeometry/totopogeom.sql.in
+++ b/topology/sql/topogeometry/totopogeom.sql.in
@@ -156,8 +156,15 @@ BEGIN
alayer := layer_id(tg);
atopology := topology_info.name;
- -- Preserve exact and automatic tolerance semantics for each dumped component.
- tolerance := atolerance;
+ IF atolerance < 0 AND atolerance != -1 THEN
+ RAISE EXCEPTION 'Tolerance must be -1 or >=0';
+ END IF;
+
+ IF atolerance = -1 THEN
+ tolerance := topology._st_mintolerance(topology_info.name, ageom);
+ ELSE
+ tolerance := atolerance;
+ END IF;
-- Get layer information
BEGIN
-----------------------------------------------------------------------
Summary of changes:
NEWS | 3 ++
liblwgeom/topo/lwgeom_topo.c | 2 +-
topology/postgis_topology.c | 59 ++++++++++++----------
.../sql/manage/FixCorruptTopoGeometryColumn.sql.in | 42 +++------------
topology/sql/manage/TotalTopologySize.sql.in | 24 ++-------
topology/sql/topogeometry/totopogeom.sql.in | 11 +++-
topology/test/regress/fix_topogeometry_columns.sql | 49 ++++++++++++++++++
.../test/regress/fix_topogeometry_columns_expected | 4 ++
8 files changed, 112 insertions(+), 82 deletions(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list