make sure that all postcodes have an entry in word

It may happen that two different postcodes normalize to exactly
the same token. In that case we still need two different entries
in the word table. Token lookup will then make sure that the correct
one is choosen.

Fixes #1953.
This commit is contained in:
Sarah Hoffmann
2020-09-17 17:11:22 +02:00
parent df115c73b2
commit 3600709116
2 changed files with 21 additions and 1 deletions

View File

@@ -81,7 +81,8 @@ BEGIN
lookup_word := upper(trim(postcode));
lookup_token := ' ' || make_standard_name(lookup_word);
SELECT min(word_id) FROM word
WHERE word_token = lookup_token and class='place' and type='postcode'
WHERE word_token = lookup_token and word = lookup_word
and class='place' and type='postcode'
INTO return_word_id;
IF return_word_id IS NULL THEN
return_word_id := nextval('seq_word');