PG_RETURN_INT32(ret);
}
PG_FREE_IF_COPY(geom, 0);
- PG_RETURN_NULL();
+ PG_RETURN_INT32(1);
}
/** 1-based offset */
/* elog(NOTICE, "GeometryN called"); */
+ idx = PG_GETARG_INT32(1);
+ idx -= 1; /* index is 1-based */
+
/* call is valid on multi* geoms only */
if (type==POINTTYPE || type==LINETYPE || type==CIRCSTRINGTYPE ||
type==COMPOUNDTYPE || type==POLYGONTYPE || type==CURVEPOLYTYPE)
{
- /* elog(NOTICE, "geometryn: geom is of type %d, requires >=4", type); */
+ if ( idx == 0 ) PG_RETURN_POINTER(geom);
PG_RETURN_NULL();
}
- idx = PG_GETARG_INT32(1);
- idx -= 1; /* index is 1-based */
-
coll = (LWCOLLECTION *)lwgeom_deserialize(SERIALIZED_FORM(geom));
if ( idx < 0 ) PG_RETURN_NULL();
ST_polygonfromtext('POLYGON((0.0 2.0,1.0 2.0,1.0 3.0,0.0 3.0,0.0 2.0))')
);
+select 'ST_GeometryN', ST_asewkt(ST_GeometryN('LINESTRING(0 0, 1 1)'::geometry, 1));
+select 'ST_NumGeometries', ST_NumGeometries('LINESTRING(0 0, 1 1)'::geometry);
+
+
polygonize_garray|POLYGON((10 0,0 0,0 10,10 10,10 0))
linemerge149|LINESTRING(-5 -5,0 0,1 1,4 4)
intersects|f
+ST_GeometryN|LINESTRING(0 0,1 1)
+ST_NumGeometries|1