Use place_exists() into can_compute() for postcodes

This commit is contained in:
AntoJvlt
2021-06-08 09:33:10 +02:00
committed by root
parent e879814e43
commit 47fb7cd3a8

View File

@@ -9,7 +9,7 @@ from math import isfinite
from psycopg2.extras import execute_values from psycopg2.extras import execute_values
from nominatim.db.connection import connect from nominatim.db.connection import _Connection, connect
LOG = logging.getLogger() LOG = logging.getLogger()
@@ -203,9 +203,5 @@ def can_compute(dsn):
Check that the place table exists so that Check that the place table exists so that
postcodes can be computed. postcodes can be computed.
""" """
with connect(dsn) as conn: with _Connection(dsn) as conn:
with conn.cursor() as cur: return conn.table_exists('place')
cur.execute("""
select exists(select 1 from information_schema.tables where table_name='place')
""")
return cur.fetchone()[0]