correctly handle housenumber lists

Lists are now standardised to use a semicolon separator.
This commit is contained in:
Sarah Hoffmann
2021-03-29 17:36:44 +02:00
parent 16a66b5326
commit 55fcc44c8c
2 changed files with 18 additions and 6 deletions

View File

@@ -48,6 +48,22 @@ $$
LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION create_housenumber_id(housenumber TEXT)
RETURNS TEXT
AS $$
DECLARE
normtext TEXT;
BEGIN
SELECT array_to_string(array_agg(trans), ';')
INTO normtext
FROM (SELECT transliteration(lookup_word) as trans, getorcreate_housenumber_id(lookup_word)
FROM (SELECT make_standard_name(h) as lookup_word
FROM regexp_split_to_table(housenumber, '[,;]') h) x) y;
return normtext;
END;
$$ LANGUAGE plpgsql STABLE STRICT;
CREATE OR REPLACE FUNCTION getorcreate_housenumber_id(lookup_word TEXT)
RETURNS INTEGER
AS $$