]> granicus.if.org Git - postgis/commitdiff
Accept more feature type names from AddTopoGeometryColumn (#1470)
authorSandro Santilli <strk@keybit.net>
Mon, 13 Feb 2012 16:29:30 +0000 (16:29 +0000)
committerSandro Santilli <strk@keybit.net>
Mon, 13 Feb 2012 16:29:30 +0000 (16:29 +0000)
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

topology/test/regress/addtopogeometrycolumn.sql
topology/test/regress/addtopogeometrycolumn_expected
topology/topology.sql.in.c

index a6d9ade84b0178c552c16ed635c896f2dee1a54c..628e273cb439ab5f78e5b3293798a1ec1ddbe0f3 100644 (file)
@@ -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
index 90af18deb3502d7f43d031982c2672b57160ac82..c893a2484f9a418d26a2169c15c79c59b50cdf90 100644 (file)
@@ -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
index 1f5e43cdf43d98e6a1701bba0c0797b7e2f507a1..5c36b99af163f5ff0b5560045fdf66afe200f4ad 100644 (file)
@@ -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';