X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/bc75e5626ec59523707b842022ecf0bdc159cf06..98c1b923fc090f830b7b3a575e3d08ba399bd870:/src/nominatim_db/tools/database_import.py diff --git a/src/nominatim_db/tools/database_import.py b/src/nominatim_db/tools/database_import.py index e96954dd..a7ee807e 100644 --- a/src/nominatim_db/tools/database_import.py +++ b/src/nominatim_db/tools/database_import.py @@ -20,7 +20,7 @@ from psycopg import sql as pysql from ..errors import UsageError from ..config import Configuration -from ..db.connection import connect, get_pg_env, Connection, server_version_tuple,\ +from ..db.connection import connect, get_pg_env, Connection, server_version_tuple, \ postgis_version_tuple, drop_tables, table_exists, execute_scalar from ..db.sql_preprocessor import SQLPreprocessor from ..db.query_pool import QueryPool @@ -29,6 +29,7 @@ from ..version import POSTGRESQL_REQUIRED_VERSION, POSTGIS_REQUIRED_VERSION LOG = logging.getLogger() + def _require_version(module: str, actual: Tuple[int, int], expected: Tuple[int, int]) -> None: """ Compares the version for the given module and raises an exception if the actual version is too old. @@ -97,10 +98,7 @@ def setup_database_skeleton(dsn: str, rouser: Optional[str] = None) -> None: with conn.cursor() as cur: cur.execute('CREATE EXTENSION IF NOT EXISTS hstore') cur.execute('CREATE EXTENSION IF NOT EXISTS postgis') - - postgis_version = postgis_version_tuple(conn) - if postgis_version[0] >= 3: - cur.execute('CREATE EXTENSION IF NOT EXISTS postgis_raster') + cur.execute('CREATE EXTENSION IF NOT EXISTS postgis_raster') conn.commit() @@ -251,7 +249,7 @@ async def _progress_print() -> None: async def create_search_indices(conn: Connection, config: Configuration, - drop: bool = False, threads: int = 1) -> None: + drop: bool = False, threads: int = 1) -> None: """ Create tables that have explicit partitioning. """