mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
ensure correct indexed_status transitions
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
--
|
--
|
||||||
-- This file is part of Nominatim. (https://nominatim.org)
|
-- This file is part of Nominatim. (https://nominatim.org)
|
||||||
--
|
--
|
||||||
-- Copyright (C) 2025 by the Nominatim developer community.
|
-- Copyright (C) 2026 by the Nominatim developer community.
|
||||||
-- For a full list of authors see the git log.
|
-- For a full list of authors see the git log.
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION place_insert()
|
CREATE OR REPLACE FUNCTION place_insert()
|
||||||
@@ -66,7 +66,8 @@ BEGIN
|
|||||||
-- They get their parent from the interpolation.
|
-- They get their parent from the interpolation.
|
||||||
UPDATE placex p SET indexed_status = 2
|
UPDATE placex p SET indexed_status = 2
|
||||||
FROM planet_osm_ways w
|
FROM planet_osm_ways w
|
||||||
WHERE w.id = NEW.osm_id and p.osm_type = 'N' and p.osm_id = any(w.nodes);
|
WHERE w.id = NEW.osm_id and p.osm_type = 'N' and p.osm_id = any(w.nodes)
|
||||||
|
and indexed_status = 0;
|
||||||
|
|
||||||
-- If there is already an entry in place, just update that, if necessary.
|
-- If there is already an entry in place, just update that, if necessary.
|
||||||
IF existing.osm_type is not null THEN
|
IF existing.osm_type is not null THEN
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
--
|
--
|
||||||
-- This file is part of Nominatim. (https://nominatim.org)
|
-- This file is part of Nominatim. (https://nominatim.org)
|
||||||
--
|
--
|
||||||
-- Copyright (C) 2025 by the Nominatim developer community.
|
-- Copyright (C) 2026 by the Nominatim developer community.
|
||||||
-- For a full list of authors see the git log.
|
-- For a full list of authors see the git log.
|
||||||
|
|
||||||
-- Trigger functions for the placex table.
|
-- Trigger functions for the placex table.
|
||||||
@@ -859,7 +859,9 @@ BEGIN
|
|||||||
NEW.linked_place_id := OLD.linked_place_id;
|
NEW.linked_place_id := OLD.linked_place_id;
|
||||||
|
|
||||||
-- Remove linkage, if we have computed a different new linkee.
|
-- Remove linkage, if we have computed a different new linkee.
|
||||||
UPDATE placex SET linked_place_id = null, indexed_status = 2
|
UPDATE placex
|
||||||
|
SET linked_place_id = null,
|
||||||
|
indexed_status = CASE WHEN indexed_status = 0 THEN 2 ELSE indexed_status END
|
||||||
WHERE linked_place_id = NEW.place_id
|
WHERE linked_place_id = NEW.place_id
|
||||||
and (linked_place is null or place_id != linked_place);
|
and (linked_place is null or place_id != linked_place);
|
||||||
-- update not necessary for osmline, cause linked_place_id does not exist
|
-- update not necessary for osmline, cause linked_place_id does not exist
|
||||||
@@ -1340,10 +1342,10 @@ BEGIN
|
|||||||
-- RAISE WARNING 'placex_delete % %',OLD.osm_type,OLD.osm_id;
|
-- RAISE WARNING 'placex_delete % %',OLD.osm_type,OLD.osm_id;
|
||||||
|
|
||||||
IF OLD.linked_place_id is null THEN
|
IF OLD.linked_place_id is null THEN
|
||||||
update placex set linked_place_id = null, indexed_status = 2 where linked_place_id = OLD.place_id and indexed_status = 0;
|
UPDATE placex
|
||||||
{% if debug %}RAISE WARNING 'placex_delete:01 % %',OLD.osm_type,OLD.osm_id;{% endif %}
|
SET linked_place_id = NULL,
|
||||||
update placex set linked_place_id = null where linked_place_id = OLD.place_id;
|
indexed_status = CASE WHEN indexed_status = 0 THEN 2 ELSE indexed_status END
|
||||||
{% if debug %}RAISE WARNING 'placex_delete:02 % %',OLD.osm_type,OLD.osm_id;{% endif %}
|
WHERE linked_place_id = OLD.place_id;
|
||||||
ELSE
|
ELSE
|
||||||
update placex set indexed_status = 2 where place_id = OLD.linked_place_id and indexed_status = 0;
|
update placex set indexed_status = 2 where place_id = OLD.linked_place_id and indexed_status = 0;
|
||||||
END IF;
|
END IF;
|
||||||
@@ -1367,6 +1369,7 @@ BEGIN
|
|||||||
-- reparenting also for OSM Interpolation Lines (and for Tiger?)
|
-- reparenting also for OSM Interpolation Lines (and for Tiger?)
|
||||||
update location_property_osmline set indexed_status = 2 where indexed_status = 0 and parent_place_id = OLD.place_id;
|
update location_property_osmline set indexed_status = 2 where indexed_status = 0 and parent_place_id = OLD.place_id;
|
||||||
|
|
||||||
|
UPDATE location_postcodes SET indexed_status = 2 WHERE parent_place_id = OLD.place_id;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
{% if debug %}RAISE WARNING 'placex_delete:08 % %',OLD.osm_type,OLD.osm_id;{% endif %}
|
{% if debug %}RAISE WARNING 'placex_delete:08 % %',OLD.osm_type,OLD.osm_id;{% endif %}
|
||||||
@@ -1398,9 +1401,6 @@ BEGIN
|
|||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
{% if debug %}RAISE WARNING 'placex_delete:12 % %',OLD.osm_type,OLD.osm_id;{% endif %}
|
{% if debug %}RAISE WARNING 'placex_delete:12 % %',OLD.osm_type,OLD.osm_id;{% endif %}
|
||||||
|
|
||||||
UPDATE location_postcodes SET indexed_status = 2 WHERE parent_place_id = OLD.place_id;
|
|
||||||
|
|
||||||
RETURN OLD;
|
RETURN OLD;
|
||||||
|
|
||||||
END;
|
END;
|
||||||
|
|||||||
Reference in New Issue
Block a user