Select all entrances for results in one query

This commit is contained in:
Emily Love Watson
2025-08-21 11:35:23 -05:00
parent e916d27b7c
commit d0ad65f696
9 changed files with 72 additions and 92 deletions

View File

@@ -338,6 +338,11 @@ BEGIN
END IF;
END IF;
-- When an existing way is updated, recalculate entrances
IF existingplacex.osm_type = 'W' and (existingplacex.rank_search > 27 or existingplacex.class IN ('landuse', 'leisure')) THEN
PERFORM place_update_entrances(existingplacex.place_id, existingplacex.osm_id);
END IF;
-- Abort the insertion (we modified the existing place instead)
RETURN NULL;
END;
@@ -365,35 +370,3 @@ BEGIN
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION place_after_insert()
RETURNS TRIGGER
AS $$
BEGIN
{% if debug %}
RAISE WARNING 'place_after_insert: % % % % %',NEW.osm_type,NEW.osm_id,NEW.class,NEW.type,st_area(NEW.geometry);
{% endif %}
IF NEW.class IN ('routing:entrance', 'entrance') THEN
PERFORM place_update_entrances_for_node(NEW.osm_id);
END IF;
RETURN NEW;
END;
$$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION place_after_delete()
RETURNS TRIGGER
AS $$
BEGIN
{% if debug %}
RAISE WARNING 'place_after_delete: % % % % %',OLD.osm_type,OLD.osm_id,OLD.class,OLD.type,st_area(OLD.geometry);
{% endif %}
IF OLD.class IN ('routing:entrance', 'entrance') THEN
PERFORM place_update_entrances_for_node(OLD.osm_id);
END IF;
RETURN NULL;
END;
$$ LANGUAGE plpgsql;