From 29b7bcb2a7ea387028c974f4e0257648d255773f Mon Sep 17 00:00:00 2001 From: Jakob Miksch Date: Sat, 31 May 2025 01:24:30 +0200 Subject: [PATCH] use GeometryType function --- .../osm-feature-info/topics/geography_tables.lua | 2 +- data/initial_subdivide.sql | 2 +- data/trigger.sql | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/data/import-theme/osm-feature-info/topics/geography_tables.lua b/data/import-theme/osm-feature-info/topics/geography_tables.lua index eaaccc4..451b7fb 100644 --- a/data/import-theme/osm-feature-info/topics/geography_tables.lua +++ b/data/import-theme/osm-feature-info/topics/geography_tables.lua @@ -23,7 +23,7 @@ themepark:add_table{ }, { column = 'geom_type', create_only = true, - sql_type = 'text GENERATED ALWAYS AS (ST_GeometryType(geog::geometry)) STORED NOT NULL' + sql_type = 'text GENERATED ALWAYS AS (GeometryType(geog::geometry)) STORED NOT NULL' } }, indexes = {{ diff --git a/data/initial_subdivide.sql b/data/initial_subdivide.sql index beca111..e942ea9 100644 --- a/data/initial_subdivide.sql +++ b/data/initial_subdivide.sql @@ -24,4 +24,4 @@ FROM geometries WHERE ST_NPoints(geog::geometry) > max_vertices() - AND ST_GeometryType(geog::geometry) IN ('ST_Polygon', 'ST_MultiPolygon'); + AND GeometryType(geog::geometry) IN ('POLYGON', 'MULTIPOLYGON'); diff --git a/data/trigger.sql b/data/trigger.sql index 7b2c016..93403e9 100644 --- a/data/trigger.sql +++ b/data/trigger.sql @@ -3,7 +3,7 @@ OR REPLACE FUNCTION perform_polygon_subdivide () RETURNS TRIGGER AS $$ BEGIN IF ST_NPoints(NEW.geog::geometry) > max_vertices() - AND ST_GeometryType(NEW.geog::geometry) IN ('ST_Polygon', 'ST_MultiPolygon') + AND GeometryType(NEW.geog::geometry) IN ('POLYGON', 'MULTIPOLYGON') THEN INSERT INTO polygons_subdivided (osm_id, osm_type, geom) VALUES ( @@ -25,7 +25,7 @@ CREATE OR REPLACE FUNCTION delete_subdivided_polygon () RETURNS TRIGGER AS $$ BEGIN -- we do not check the vertices count like in the other statements, because it does not matter in this case - IF ST_GeometryType(OLD.geog::geometry) IN ('ST_Polygon', 'ST_MultiPolygon') + IF GeometryType(OLD.geog::geometry) IN ('POLYGON', 'MULTIPOLYGON') THEN DELETE FROM polygons_subdivided WHERE osm_id = OLD.osm_id; END IF; @@ -43,7 +43,7 @@ OR REPLACE FUNCTION update_subdivided_polygon () RETURNS TRIGGER AS $$ BEGIN IF ST_NPoints(NEW.geog::geometry) > max_vertices() THEN - IF ST_GeometryType(NEW.geog::geometry) IN ('ST_Polygon', 'ST_MultiPolygon') THEN + IF GeometryType(NEW.geog::geometry) IN ('POLYGON', 'MULTIPOLYGON') THEN DELETE FROM polygons_subdivided WHERE osm_id = OLD.osm_id; INSERT INTO polygons_subdivided (osm_id, osm_type, geom) VALUES (