{
lwpgerror("PrepGeomCacheBuilder asked to build new prepcache where one already exists.");
return LW_FAILURE;
- }
+ }
+
+ /*
+ * Avoid creating a PreparedPoint around a Point or a MultiPoint.
+ * Consider changing this behavior in the future if supported GEOS
+ * versions correctly handle prepared points and multipoints and
+ * provide a performance benefit.
+ * See https://trac.osgeo.org/postgis/ticket/3437
+ */
+ if (lwgeom_get_type(lwgeom) == POINTTYPE || lwgeom_get_type(lwgeom) == MULTIPOINTTYPE)
+ return LW_FAILURE;
prepcache->geom = LWGEOM2GEOS( lwgeom , 0);
if ( ! prepcache->geom ) return LW_FAILURE;
+-- #3437
+WITH
+mp AS (SELECT ST_Collect(ST_MakePoint(-c, c*c)) AS geom FROM generate_series(1, 5) c),
+p AS (SELECT (ST_Dump(geom)).geom FROM mp)
+SELECT '#3437a' AS t, count(*) FROM mp INNER JOIN p ON ST_Intersects(mp.geom, p.geom)
+UNION ALL
+SELECT '#3437b' AS t, count(*) FROM mp INNER JOIN p ON ST_Contains(mp.geom, p.geom)
+UNION ALL
+SELECT '#3437c' AS t, count(*) FROM mp INNER JOIN p ON ST_ContainsProperly(mp.geom, p.geom)
+UNION ALL
+SELECT '#3437d' AS t, count(*) FROM mp INNER JOIN p ON ST_Covers(mp.geom, p.geom)
+UNION ALL
+SELECT '#3437e' AS t, count(*) FROM mp INNER JOIN p ON ST_Within(p.geom, mp.geom);
+
+
-- Clean up
DELETE FROM spatial_ref_sys;