`transportation_name` update to consider `tags` (#1289)

Following 8bb77b67a1 (r59190611)
pull/1293/head
zstadler 2021-11-04 14:51:28 +02:00 zatwierdzone przez GitHub
rodzic dffb9c66d6
commit 5b2e43497e
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 19 dodań i 7 usunięć

Wyświetl plik

@ -431,6 +431,7 @@ CREATE TABLE IF NOT EXISTS transportation_name.name_changes
name character varying,
name_en character varying,
name_de character varying,
tags hstore,
ref character varying,
highway character varying,
subclass character varying,
@ -452,19 +453,19 @@ $$
BEGIN
IF (tg_op IN ('DELETE', 'UPDATE'))
THEN
INSERT INTO transportation_name.name_changes(is_old, osm_id, name, name_en, name_de, ref, highway, subclass,
INSERT INTO transportation_name.name_changes(is_old, osm_id, name, name_en, name_de, tags, ref, highway, subclass,
brunnel, level, layer, indoor, network_type,
route_1, route_2, route_3, route_4, route_5, route_6)
VALUES (TRUE, old.osm_id, old.name, old.name_en, old.name_de, old.ref, old.highway, old.subclass,
VALUES (TRUE, old.osm_id, old.name, old.name_en, old.name_de, old.tags, old.ref, old.highway, old.subclass,
old.brunnel, old.level, old.layer, old.indoor, old.network_type,
old.route_1, old.route_2, old.route_3, old.route_4, old.route_5, old.route_6);
END IF;
IF (tg_op IN ('UPDATE', 'INSERT'))
THEN
INSERT INTO transportation_name.name_changes(is_old, osm_id, name, name_en, name_de, ref, highway, subclass,
INSERT INTO transportation_name.name_changes(is_old, osm_id, name, name_en, name_de, tags, ref, highway, subclass,
brunnel, level, layer, indoor, network_type,
route_1, route_2, route_3, route_4, route_5, route_6)
VALUES (FALSE, new.osm_id, new.name, new.name_en, new.name_de, new.ref, new.highway, new.subclass,
VALUES (FALSE, new.osm_id, new.name, new.name_en, new.name_de, new.tags, new.ref, new.highway, new.subclass,
new.brunnel, new.level, new.layer, new.indoor, new.network_type,
new.route_1, new.route_2, new.route_3, new.route_4, new.route_5, new.route_6);
END IF;
@ -497,11 +498,12 @@ BEGIN
-- Compact the change history to keep only the first and last version, and then uniq version of row
CREATE TEMP TABLE name_changes_compact AS
SELECT DISTINCT ON (name, name_en, name_de, ref, highway, subclass, brunnel, level, layer, indoor, network_type,
SELECT DISTINCT ON (name, name_en, name_de, tags, ref, highway, subclass, brunnel, level, layer, indoor, network_type,
route_1, route_2, route_3, route_4, route_5, route_6)
name,
name_en,
name_de,
tags,
ref,
highway,
subclass,
@ -535,6 +537,7 @@ BEGIN
AND coalesce(n.ref, '') = coalesce(c.ref, '')
AND n.name_en IS NOT DISTINCT FROM c.name_en
AND n.name_de IS NOT DISTINCT FROM c.name_de
AND n.tags IS NOT DISTINCT FROM c.tags
AND n.highway IS NOT DISTINCT FROM c.highway
AND n.subclass IS NOT DISTINCT FROM c.subclass
AND n.brunnel IS NOT DISTINCT FROM c.brunnel
@ -570,7 +573,7 @@ BEGIN
n.name,
n.name_en,
n.name_de,
hstore(string_agg(nullif(slice_language_tags(tags ||
hstore(string_agg(nullif(slice_language_tags(n.tags ||
hstore(ARRAY ['name', n.name, 'name:en', n.name_en, 'name:de', n.name_de]))::text,
''), ',')) AS tags,
n.ref,
@ -589,6 +592,7 @@ BEGIN
AND coalesce(n.ref, '') = coalesce(c.ref, '')
AND n.name_en IS NOT DISTINCT FROM c.name_en
AND n.name_de IS NOT DISTINCT FROM c.name_de
AND n.tags IS NOT DISTINCT FROM c.tags
AND n.highway IS NOT DISTINCT FROM c.highway
AND n.subclass IS NOT DISTINCT FROM c.subclass
AND n.brunnel IS NOT DISTINCT FROM c.brunnel
@ -602,7 +606,7 @@ BEGIN
AND n.route_4 IS NOT DISTINCT FROM c.route_4
AND n.route_5 IS NOT DISTINCT FROM c.route_5
AND n.route_6 IS NOT DISTINCT FROM c.route_6
GROUP BY n.name, n.name_en, n.name_de, n.ref, n.highway, n.subclass, n.brunnel, n.level, n.layer, n.indoor, n.network_type,
GROUP BY n.name, n.name_en, n.name_de, n.tags, n.ref, n.highway, n.subclass, n.brunnel, n.level, n.layer, n.indoor, n.network_type,
n.route_1, n.route_2, n.route_3, n.route_4, n.route_5, n.route_6
) AS highway_union;
@ -614,6 +618,7 @@ BEGIN
AND n.name IS NOT DISTINCT FROM c.name
AND n.name_en IS NOT DISTINCT FROM c.name_en
AND n.name_de IS NOT DISTINCT FROM c.name_de
AND n.tags IS NOT DISTINCT FROM c.tags
AND n.ref IS NOT DISTINCT FROM c.ref
AND n.highway IS NOT DISTINCT FROM c.highway
AND n.subclass IS NOT DISTINCT FROM c.subclass
@ -634,6 +639,7 @@ BEGIN
AND n.name IS NOT DISTINCT FROM c.name
AND n.name_en IS NOT DISTINCT FROM c.name_en
AND n.name_de IS NOT DISTINCT FROM c.name_de
AND n.tags IS NOT DISTINCT FROM c.tags
AND n.ref IS NOT DISTINCT FROM c.ref
AND n.highway IS NOT DISTINCT FROM c.highway
AND n.subclass IS NOT DISTINCT FROM c.subclass
@ -654,6 +660,7 @@ BEGIN
AND n.name IS NOT DISTINCT FROM c.name
AND n.name_en IS NOT DISTINCT FROM c.name_en
AND n.name_de IS NOT DISTINCT FROM c.name_de
AND n.tags IS NOT DISTINCT FROM c.tags
AND n.ref IS NOT DISTINCT FROM c.ref
AND n.highway IS NOT DISTINCT FROM c.highway
AND n.subclass IS NOT DISTINCT FROM c.subclass
@ -674,6 +681,7 @@ BEGIN
AND n.name IS NOT DISTINCT FROM c.name
AND n.name_en IS NOT DISTINCT FROM c.name_en
AND n.name_de IS NOT DISTINCT FROM c.name_de
AND n.tags IS NOT DISTINCT FROM c.tags
AND n.ref IS NOT DISTINCT FROM c.ref
AND n.highway IS NOT DISTINCT FROM c.highway
AND n.subclass IS NOT DISTINCT FROM c.subclass
@ -694,6 +702,7 @@ BEGIN
AND n.name IS NOT DISTINCT FROM c.name
AND n.name_en IS NOT DISTINCT FROM c.name_en
AND n.name_de IS NOT DISTINCT FROM c.name_de
AND n.tags IS NOT DISTINCT FROM c.tags
AND n.ref IS NOT DISTINCT FROM c.ref
AND n.highway IS NOT DISTINCT FROM c.highway
AND n.subclass IS NOT DISTINCT FROM c.subclass
@ -714,6 +723,7 @@ BEGIN
AND n.name IS NOT DISTINCT FROM c.name
AND n.name_en IS NOT DISTINCT FROM c.name_en
AND n.name_de IS NOT DISTINCT FROM c.name_de
AND n.tags IS NOT DISTINCT FROM c.tags
AND n.ref IS NOT DISTINCT FROM c.ref
AND n.highway IS NOT DISTINCT FROM c.highway
AND n.subclass IS NOT DISTINCT FROM c.subclass
@ -734,6 +744,7 @@ BEGIN
AND n.name IS NOT DISTINCT FROM c.name
AND n.name_en IS NOT DISTINCT FROM c.name_en
AND n.name_de IS NOT DISTINCT FROM c.name_de
AND n.tags IS NOT DISTINCT FROM c.tags
AND n.ref IS NOT DISTINCT FROM c.ref
AND n.highway IS NOT DISTINCT FROM c.highway
AND n.subclass IS NOT DISTINCT FROM c.subclass
@ -754,6 +765,7 @@ BEGIN
AND n.name IS NOT DISTINCT FROM c.name
AND n.name_en IS NOT DISTINCT FROM c.name_en
AND n.name_de IS NOT DISTINCT FROM c.name_de
AND n.tags IS NOT DISTINCT FROM c.tags
AND n.ref IS NOT DISTINCT FROM c.ref
AND n.highway IS NOT DISTINCT FROM c.highway
AND n.subclass IS NOT DISTINCT FROM c.subclass