]> granicus.if.org Git - postgis/commitdiff
Fix postgis_type_name with (GEOMETRYM,3)
authorRaúl Marín Rodríguez <rmrodriguez@carto.com>
Fri, 29 Mar 2019 14:23:00 +0000 (14:23 +0000)
committerRaúl Marín Rodríguez <rmrodriguez@carto.com>
Fri, 29 Mar 2019 14:23:00 +0000 (14:23 +0000)
Patch by Matt Bretl

Closes https://github.com/postgis/postgis/pull/387
References #4361

git-svn-id: http://svn.osgeo.org/postgis/trunk@17365 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/postgis.sql.in
regress/core/postgis_type_name.sql
regress/core/postgis_type_name_expected

index f887757c1ac84458a1036825927d8ec4cad9e3ca..504cda7902444fd548c30a6474d58451c70a7a23 100644 (file)
@@ -5616,89 +5616,91 @@ CREATE OR REPLACE FUNCTION postgis_type_name(geomname varchar, coord_dimension i
        RETURNS varchar
 AS
 $$
- SELECT CASE WHEN $3 THEN new_name ELSE old_name END As geomname
      SELECT CASE WHEN $3 THEN new_name ELSE old_name END As geomname
        FROM
-       ( VALUES
-                ('GEOMETRY', 'Geometry', 2) ,
-                       ('GEOMETRY', 'GeometryZ', 3) ,
-                       ('GEOMETRY', 'GeometryZM', 4) ,
-                       ('GEOMETRYCOLLECTION', 'GeometryCollection', 2) ,
-                       ('GEOMETRYCOLLECTION', 'GeometryCollectionZ', 3) ,
-                       ('GEOMETRYCOLLECTIONM', 'GeometryCollectionM', 3) ,
-                       ('GEOMETRYCOLLECTION', 'GeometryCollectionZM', 4) ,
-
-                       ('POINT', 'Point',2) ,
-                       ('POINTM','PointM',3) ,
-                       ('POINT', 'PointZ',3) ,
-                       ('POINT', 'PointZM',4) ,
-
-                       ('MULTIPOINT','MultiPoint',2) ,
-                       ('MULTIPOINT','MultiPointZ',3) ,
-                       ('MULTIPOINTM','MultiPointM',3) ,
-                       ('MULTIPOINT','MultiPointZM',4) ,
-
-                       ('POLYGON', 'Polygon',2) ,
-                       ('POLYGON', 'PolygonZ',3) ,
-                       ('POLYGONM', 'PolygonM',3) ,
-                       ('POLYGON', 'PolygonZM',4) ,
-
-                       ('MULTIPOLYGON', 'MultiPolygon',2) ,
-                       ('MULTIPOLYGON', 'MultiPolygonZ',3) ,
-                       ('MULTIPOLYGONM', 'MultiPolygonM',3) ,
-                       ('MULTIPOLYGON', 'MultiPolygonZM',4) ,
-
-                       ('MULTILINESTRING', 'MultiLineString',2) ,
-                       ('MULTILINESTRING', 'MultiLineStringZ',3) ,
-                       ('MULTILINESTRINGM', 'MultiLineStringM',3) ,
-                       ('MULTILINESTRING', 'MultiLineStringZM',4) ,
-
-                       ('LINESTRING', 'LineString',2) ,
-                       ('LINESTRING', 'LineStringZ',3) ,
-                       ('LINESTRINGM', 'LineStringM',3) ,
-                       ('LINESTRING', 'LineStringZM',4) ,
-
-                       ('CIRCULARSTRING', 'CircularString',2) ,
-                       ('CIRCULARSTRING', 'CircularStringZ',3) ,
-                       ('CIRCULARSTRINGM', 'CircularStringM',3) ,
-                       ('CIRCULARSTRING', 'CircularStringZM',4) ,
-
-                       ('COMPOUNDCURVE', 'CompoundCurve',2) ,
-                       ('COMPOUNDCURVE', 'CompoundCurveZ',3) ,
-                       ('COMPOUNDCURVEM', 'CompoundCurveM',3) ,
-                       ('COMPOUNDCURVE', 'CompoundCurveZM',4) ,
-
-                       ('CURVEPOLYGON', 'CurvePolygon',2) ,
-                       ('CURVEPOLYGON', 'CurvePolygonZ',3) ,
-                       ('CURVEPOLYGONM', 'CurvePolygonM',3) ,
-                       ('CURVEPOLYGON', 'CurvePolygonZM',4) ,
-
-                       ('MULTICURVE', 'MultiCurve',2 ) ,
-                       ('MULTICURVE', 'MultiCurveZ',3 ) ,
-                       ('MULTICURVEM', 'MultiCurveM',3 ) ,
-                       ('MULTICURVE', 'MultiCurveZM',4 ) ,
-
-                       ('MULTISURFACE', 'MultiSurface', 2) ,
-                       ('MULTISURFACE', 'MultiSurfaceZ', 3) ,
-                       ('MULTISURFACEM', 'MultiSurfaceM', 3) ,
-                       ('MULTISURFACE', 'MultiSurfaceZM', 4) ,
-
-                       ('POLYHEDRALSURFACE', 'PolyhedralSurface',2) ,
-                       ('POLYHEDRALSURFACE', 'PolyhedralSurfaceZ',3) ,
-                       ('POLYHEDRALSURFACEM', 'PolyhedralSurfaceM',3) ,
-                       ('POLYHEDRALSURFACE', 'PolyhedralSurfaceZM',4) ,
-
-                       ('TRIANGLE', 'Triangle',2) ,
-                       ('TRIANGLE', 'TriangleZ',3) ,
-                       ('TRIANGLEM', 'TriangleM',3) ,
-                       ('TRIANGLE', 'TriangleZM',4) ,
+       ( VALUES
+                       ('GEOMETRY', 'Geometry', 2),
+                       ('GEOMETRY', 'GeometryZ', 3),
+                       ('GEOMETRYM', 'GeometryM', 3),
+                       ('GEOMETRY', 'GeometryZM', 4),
+
+                       ('GEOMETRYCOLLECTION', 'GeometryCollection', 2),
+                       ('GEOMETRYCOLLECTION', 'GeometryCollectionZ', 3),
+                       ('GEOMETRYCOLLECTIONM', 'GeometryCollectionM', 3),
+                       ('GEOMETRYCOLLECTION', 'GeometryCollectionZM', 4),
+
+                       ('POINT', 'Point', 2),
+                       ('POINT', 'PointZ', 3),
+                       ('POINTM','PointM', 3),
+                       ('POINT', 'PointZM', 4),
+
+                       ('MULTIPOINT','MultiPoint', 2),
+                       ('MULTIPOINT','MultiPointZ', 3),
+                       ('MULTIPOINTM','MultiPointM', 3),
+                       ('MULTIPOINT','MultiPointZM', 4),
+
+                       ('POLYGON', 'Polygon', 2),
+                       ('POLYGON', 'PolygonZ', 3),
+                       ('POLYGONM', 'PolygonM', 3),
+                       ('POLYGON', 'PolygonZM', 4),
+
+                       ('MULTIPOLYGON', 'MultiPolygon', 2),
+                       ('MULTIPOLYGON', 'MultiPolygonZ', 3),
+                       ('MULTIPOLYGONM', 'MultiPolygonM', 3),
+                       ('MULTIPOLYGON', 'MultiPolygonZM', 4),
+
+                       ('MULTILINESTRING', 'MultiLineString', 2),
+                       ('MULTILINESTRING', 'MultiLineStringZ', 3),
+                       ('MULTILINESTRINGM', 'MultiLineStringM', 3),
+                       ('MULTILINESTRING', 'MultiLineStringZM', 4),
+
+                       ('LINESTRING', 'LineString', 2),
+                       ('LINESTRING', 'LineStringZ', 3),
+                       ('LINESTRINGM', 'LineStringM', 3),
+                       ('LINESTRING', 'LineStringZM', 4),
+
+                       ('CIRCULARSTRING', 'CircularString', 2),
+                       ('CIRCULARSTRING', 'CircularStringZ', 3),
+                       ('CIRCULARSTRINGM', 'CircularStringM' ,3),
+                       ('CIRCULARSTRING', 'CircularStringZM', 4),
+
+                       ('COMPOUNDCURVE', 'CompoundCurve', 2),
+                       ('COMPOUNDCURVE', 'CompoundCurveZ', 3),
+                       ('COMPOUNDCURVEM', 'CompoundCurveM', 3),
+                       ('COMPOUNDCURVE', 'CompoundCurveZM', 4),
+
+                       ('CURVEPOLYGON', 'CurvePolygon', 2),
+                       ('CURVEPOLYGON', 'CurvePolygonZ', 3),
+                       ('CURVEPOLYGONM', 'CurvePolygonM', 3),
+                       ('CURVEPOLYGON', 'CurvePolygonZM', 4),
+
+                       ('MULTICURVE', 'MultiCurve', 2),
+                       ('MULTICURVE', 'MultiCurveZ', 3),
+                       ('MULTICURVEM', 'MultiCurveM', 3),
+                       ('MULTICURVE', 'MultiCurveZM', 4),
+
+                       ('MULTISURFACE', 'MultiSurface', 2),
+                       ('MULTISURFACE', 'MultiSurfaceZ', 3),
+                       ('MULTISURFACEM', 'MultiSurfaceM', 3),
+                       ('MULTISURFACE', 'MultiSurfaceZM', 4),
+
+                       ('POLYHEDRALSURFACE', 'PolyhedralSurface', 2),
+                       ('POLYHEDRALSURFACE', 'PolyhedralSurfaceZ', 3),
+                       ('POLYHEDRALSURFACEM', 'PolyhedralSurfaceM', 3),
+                       ('POLYHEDRALSURFACE', 'PolyhedralSurfaceZM', 4),
+
+                       ('TRIANGLE', 'Triangle', 2),
+                       ('TRIANGLE', 'TriangleZ', 3),
+                       ('TRIANGLEM', 'TriangleM', 3),
+                       ('TRIANGLE', 'TriangleZM', 4),
 
                        ('TIN', 'Tin', 2),
                        ('TIN', 'TinZ', 3),
-                       ('TIN', 'TinM', 3),
+                       ('TINM', 'TinM', 3),
                        ('TIN', 'TinZM', 4) )
                         As g(old_name, new_name, coord_dimension)
-               WHERE (upper(old_name) = upper($1) OR upper(new_name) = upper($1))
-                       AND coord_dimension = $2;
+       WHERE (upper(old_name) = upper($1) OR upper(new_name) = upper($1))
+               AND coord_dimension = $2;
 $$
 LANGUAGE 'sql' IMMUTABLE STRICT _PARALLEL _COST_HIGH;
 
index f52c3dc17b7412d36a524cf7d72a0c687b2a205f..f0a03d80d59d84ae7ba8def9e5757ef6c158563a 100644 (file)
@@ -1,3 +1,15 @@
+SELECT 'GEOMETRY(0)', postgis_type_name('GEOMETRY', 0);
+SELECT 'GEOMETRY(1)', postgis_type_name('GEOMETRY', 1);
+SELECT 'GEOMETRY(2)', postgis_type_name('GEOMETRY', 2);
+SELECT 'GEOMETRY(3)', postgis_type_name('GEOMETRY', 3);
+SELECT 'GEOMETRY(4)', postgis_type_name('GEOMETRY', 4);
+SELECT 'GEOMETRY(5)', postgis_type_name('GEOMETRY', 5);
+SELECT 'GEOMETRYM(2)', postgis_type_name('GEOMETRYM', 2);
+SELECT 'GEOMETRYM(3)', postgis_type_name('GEOMETRYM', 3);
+SELECT 'GEOMETRYZ(3)', postgis_type_name('GEOMETRYZ', 3);
+SELECT 'GEOMETRYZM(3)', postgis_type_name('GEOMETRYZM', 3);
+SELECT 'GEOMETRYZM(4)', postgis_type_name('GEOMETRYZM', 4);
+
 SELECT 'POINT(0)', postgis_type_name('POINT', 0);
 SELECT 'POINT(1)', postgis_type_name('POINT', 1);
 SELECT 'POINT(2)', postgis_type_name('POINT', 2);
index 43852233057a4d9d1ec37efbc6da4fd8e317c9ad..e218990439ad10fc00551d91e166c9a702ebff18 100644 (file)
@@ -1,3 +1,14 @@
+GEOMETRY(0)|
+GEOMETRY(1)|
+GEOMETRY(2)|Geometry
+GEOMETRY(3)|GeometryZ
+GEOMETRY(4)|GeometryZM
+GEOMETRY(5)|
+GEOMETRYM(2)|
+GEOMETRYM(3)|GeometryM
+GEOMETRYZ(3)|GeometryZ
+GEOMETRYZM(3)|
+GEOMETRYZM(4)|GeometryZM
 POINT(0)|
 POINT(1)|
 POINT(2)|Point