Fix park polygon update SQL (#1248)

This PR fixes a bug in the park polygon update code introduced in #1160.  Because park polygons at zoom 4 are dissolved, the centroid is not present in the table at that layer.  Thus, a separate update trigger is needed to avoid errors.  This PR adds the separate trigger for the zoom 4 park layer.

This PR likely resolves an unidentified blocker for #1245
This commit is contained in:
Brian Sperlongano 2021-09-29 07:40:16 -04:00 committed by GitHub
parent b4b897999d
commit 718e79a704
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -124,6 +124,16 @@ BEGIN
END;
$$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION update_osm_park_dissolved_polygon_row()
RETURNS trigger
AS
$$
BEGIN
NEW.tags = update_tags(NEW.tags, NEW.geometry);
RETURN NEW;
END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER update_row
BEFORE INSERT OR UPDATE
ON osm_park_polygon
@ -188,5 +198,5 @@ CREATE TRIGGER update_row
BEFORE INSERT OR UPDATE
ON osm_park_polygon_gen_z4
FOR EACH ROW
EXECUTE PROCEDURE update_osm_park_polygon_row();
EXECUTE PROCEDURE update_osm_park_dissolved_polygon_row();