From e9817355e94724bc197470bd3a883388fd7d40e3 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Mon, 13 Feb 2012 16:29:30 +0000 Subject: [PATCH] Accept more feature type names from AddTopoGeometryColumn (#1470) With this commit you can pass return of ST_GeometryType or return GeometryType as input to the function. git-svn-id: http://svn.osgeo.org/postgis/trunk@9172 b70326c6-7e19-0410-871a-916f4a2858ee --- .../test/regress/addtopogeometrycolumn.sql | 24 +++++++++++++++++++ .../regress/addtopogeometrycolumn_expected | 20 ++++++++++++++++ topology/topology.sql.in.c | 8 +++---- 3 files changed, 48 insertions(+), 4 deletions(-) diff --git a/topology/test/regress/addtopogeometrycolumn.sql b/topology/test/regress/addtopogeometrycolumn.sql index a6d9ade84..628e273cb 100644 --- a/topology/test/regress/addtopogeometrycolumn.sql +++ b/topology/test/regress/addtopogeometrycolumn.sql @@ -13,6 +13,30 @@ select 'T1', addtopogeometrycolumn('tt','public','feature','tg','POINT'); -- Check that you can add a second topogeometry column to the same table select 'T2', addtopogeometrycolumn('tt','public','feature','tg2','LINE'); +-- Check polygonal +select 'T3', addtopogeometrycolumn('tt','public','feature','tg3','POLYGON'); + +-- Check collection +select 'T4', addtopogeometrycolumn('tt','public','feature','tg4','COLLECTION'); + +-- Check alternate names +select 'T5', addtopogeometrycolumn('tt','public','feature', + 'tg5','ST_MultiPoint'); +select 'T6', addtopogeometrycolumn('tt','public','feature', + 'tg6','ST_MultiLineString'); +select 'T7', addtopogeometrycolumn('tt','public','feature', + 'tg7','ST_MultiPolygon'); +select 'T8', addtopogeometrycolumn('tt','public','feature', + 'tg8','GEOMETRYCOLLECTION'); +select 'T9', addtopogeometrycolumn('tt','public','feature', + 'tg9','PUNtal'); +select 'T10', addtopogeometrycolumn('tt','public','feature', + 'tg10','Lineal'); +select 'T11', addtopogeometrycolumn('tt','public','feature', + 'tg11','Areal'); +select 'T12', addtopogeometrycolumn('tt','public','feature', + 'tg12','GEOMETRY'); + select l.layer_id, l.schema_name, l.table_name, l.feature_column, l.feature_type, l.level, l.child_id from topology.layer l, topology.topology t diff --git a/topology/test/regress/addtopogeometrycolumn_expected b/topology/test/regress/addtopogeometrycolumn_expected index 90af18deb..c893a2484 100644 --- a/topology/test/regress/addtopogeometrycolumn_expected +++ b/topology/test/regress/addtopogeometrycolumn_expected @@ -4,6 +4,26 @@ ERROR: Layer type must be one of POINT,LINE,POLYGON,COLLECTION ERROR: Child layer 0 does not exist in topology "tt" T1|1 T2|2 +T3|3 +T4|4 +T5|5 +T6|6 +T7|7 +T8|8 +T9|9 +T10|10 +T11|11 +T12|12 1|public|feature|tg|1|0| 2|public|feature|tg2|2|0| +3|public|feature|tg3|3|0| +4|public|feature|tg4|4|0| +5|public|feature|tg5|1|0| +6|public|feature|tg6|2|0| +7|public|feature|tg7|3|0| +8|public|feature|tg8|4|0| +9|public|feature|tg9|1|0| +10|public|feature|tg10|2|0| +11|public|feature|tg11|3|0| +12|public|feature|tg12|4|0| Topology 'tt' dropped diff --git a/topology/topology.sql.in.c b/topology/topology.sql.in.c index 1f5e43cdf..5c36b99af 100644 --- a/topology/topology.sql.in.c +++ b/topology/topology.sql.in.c @@ -560,13 +560,13 @@ BEGIN RAISE EXCEPTION 'Topology % does not exist', toponame; END IF; - IF ltype = 'POINT' THEN + IF ltype ILIKE '%POINT%' OR ltype ILIKE 'PUNTAL' THEN intltype = 1; - ELSIF ltype = 'LINE' THEN + ELSIF ltype ILIKE '%LINE%' OR ltype ILIKE 'LINEAL' THEN intltype = 2; - ELSIF ltype = 'POLYGON' THEN + ELSIF ltype ILIKE '%POLYGON%' OR ltype ILIKE 'AREAL' THEN intltype = 3; - ELSIF ltype = 'COLLECTION' THEN + ELSIF ltype ILIKE '%COLLECTION%' OR ltype ILIKE 'GEOMETRY' THEN intltype = 4; ELSE RAISE EXCEPTION 'Layer type must be one of POINT,LINE,POLYGON,COLLECTION'; -- 2.40.0