From 2f54094b8702720e21831eb4ab528fc1a6fb73f9 Mon Sep 17 00:00:00 2001 From: Paul Ramsey Date: Wed, 22 Jul 2015 15:29:46 +0000 Subject: [PATCH] #2692, Curve output support in ST_Collect git-svn-id: http://svn.osgeo.org/postgis/trunk@13829 b70326c6-7e19-0410-871a-916f4a2858ee --- postgis/lwgeom_functions_basic.c | 10 ++-------- regress/tickets.sql | 9 +++++++++ regress/tickets_expected | 3 +++ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/postgis/lwgeom_functions_basic.c b/postgis/lwgeom_functions_basic.c index 9ab8f41c6..09fc19848 100644 --- a/postgis/lwgeom_functions_basic.c +++ b/postgis/lwgeom_functions_basic.c @@ -1248,17 +1248,11 @@ Datum LWGEOM_collect_garray(PG_FUNCTION_ARGS) /* Output type not initialized */ if ( ! outtype ) { - /* Input is single, make multi */ - if ( ! lwtype_is_collection(intype) ) - outtype = lwtype_get_collectiontype(intype); - /* Input is multi, make collection */ - else - outtype = COLLECTIONTYPE; + outtype = lwtype_get_collectiontype(intype); } - /* Input type not compatible with output */ /* make output type a collection */ - else if ( outtype != COLLECTIONTYPE && intype != outtype-3 ) + else if ( outtype != COLLECTIONTYPE && lwtype_get_collectiontype(intype) != outtype ) { outtype = COLLECTIONTYPE; } diff --git a/regress/tickets.sql b/regress/tickets.sql index 8373721be..4c99a9533 100644 --- a/regress/tickets.sql +++ b/regress/tickets.sql @@ -861,6 +861,15 @@ DROP TABLE images; -- SELECT '#2672', ST_AsTWKBAgg(null::geometry, 3); +-- #2692 +WITH v AS ( SELECT 'CIRCULARSTRING(0 0, 1 1, 2 2)'::geometry AS g FROM generate_series(1,3) ) +SELECT '#2692a', ST_AsText(st_collect(g)) FROM v; +WITH v AS ( SELECT 'COMPOUNDCURVE((0 0, 1 1), CIRCULARSTRING(1 1, 1 2, 3 2))'::geometry AS g FROM generate_series(1,3) ) +SELECT '#2692b', ST_AsText(st_collect(g)) FROM v; +WITH v AS ( SELECT 'TRIANGLE((0 0, 1 1, 1 0, 0 0))'::geometry AS g FROM generate_series(1,3) ) +SELECT '#2692c', ST_AsText(st_collect(g)) FROM v; + + SELECT '#2704', ST_AsText(ST_GeomFromGML('