mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-16 15:47:58 +00:00
handle postcodes properly on word table updates
update_postcodes_from_db() needs to do the full postcode treatment in order to derive the correct word table entries.
This commit is contained in:
@@ -18,13 +18,18 @@ from nominatim.tokenizer import factory as tokenizer_factory
|
||||
def check_database_integrity(context):
|
||||
""" Check some generic constraints on the tables.
|
||||
"""
|
||||
# place_addressline should not have duplicate (place_id, address_place_id)
|
||||
cur = context.db.cursor()
|
||||
cur.execute("""SELECT count(*) FROM
|
||||
(SELECT place_id, address_place_id, count(*) as c
|
||||
FROM place_addressline GROUP BY place_id, address_place_id) x
|
||||
WHERE c > 1""")
|
||||
assert cur.fetchone()[0] == 0, "Duplicates found in place_addressline"
|
||||
with context.db.cursor() as cur:
|
||||
# place_addressline should not have duplicate (place_id, address_place_id)
|
||||
cur.execute("""SELECT count(*) FROM
|
||||
(SELECT place_id, address_place_id, count(*) as c
|
||||
FROM place_addressline GROUP BY place_id, address_place_id) x
|
||||
WHERE c > 1""")
|
||||
assert cur.fetchone()[0] == 0, "Duplicates found in place_addressline"
|
||||
|
||||
# word table must not have empty word_tokens
|
||||
cur.execute("SELECT count(*) FROM word WHERE word_token = ''")
|
||||
assert cur.fetchone()[0] == 0, "Empty word tokens found in word table"
|
||||
|
||||
|
||||
|
||||
################################ GIVEN ##################################
|
||||
|
||||
Reference in New Issue
Block a user