Skip to content

Commit

Permalink
avoid ST_Within
Browse files Browse the repository at this point in the history
Has perfomance issue in some versions of PostGIS.
  • Loading branch information
lonvia committed Dec 21, 2024
1 parent 713f563 commit dc7264a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib-sql/functions/placex_triggers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1162,7 +1162,7 @@ BEGIN
-- Use the linked point as the centre point of the geometry,
-- but only if it is within the area of the boundary.
geom := coalesce(location.centroid, ST_Centroid(location.geometry));
IF geom is not NULL AND ST_Within(geom, NEW.geometry) THEN
IF geom is not NULL AND ST_Covers(NEW.geometry, geom) THEN
NEW.centroid := geom;
END IF;

Expand Down

0 comments on commit dc7264a

Please sign in to comment.