mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-11 21:34:06 +00:00
remove code only needed for older PostgreSQL/PostGIS versions
This commit is contained in:
@@ -12,7 +12,7 @@ from enum import Enum
|
||||
from textwrap import dedent
|
||||
|
||||
from ..config import Configuration
|
||||
from ..db.connection import connect, Connection, server_version_tuple, \
|
||||
from ..db.connection import connect, Connection, \
|
||||
index_exists, table_exists, execute_scalar
|
||||
from ..db import properties
|
||||
from ..errors import UsageError
|
||||
@@ -121,10 +121,9 @@ def _get_indexes(conn: Connection) -> List[str]:
|
||||
if table_exists(conn, 'search_name'):
|
||||
indexes.extend(('idx_search_name_nameaddress_vector',
|
||||
'idx_search_name_name_vector',
|
||||
'idx_search_name_centroid'))
|
||||
if server_version_tuple(conn) >= (11, 0, 0):
|
||||
indexes.extend(('idx_placex_housenumber',
|
||||
'idx_osmline_parent_osm_id_with_hnr'))
|
||||
'idx_search_name_centroid',
|
||||
'idx_placex_housenumber',
|
||||
'idx_osmline_parent_osm_id_with_hnr'))
|
||||
|
||||
# These won't exist if --no-updates import was used
|
||||
if table_exists(conn, 'place'):
|
||||
|
||||
@@ -98,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()
|
||||
|
||||
|
||||
@@ -16,8 +16,7 @@ from pathlib import Path
|
||||
from psycopg import sql as pysql
|
||||
|
||||
from ..config import Configuration
|
||||
from ..db.connection import Connection, connect, postgis_version_tuple, \
|
||||
drop_tables
|
||||
from ..db.connection import Connection, connect, drop_tables
|
||||
from ..db.utils import execute_file
|
||||
from ..db.sql_preprocessor import SQLPreprocessor
|
||||
|
||||
@@ -190,12 +189,6 @@ def import_secondary_importance(dsn: str, data_path: Path, ignore_errors: bool =
|
||||
if not datafile.exists():
|
||||
return 1
|
||||
|
||||
with connect(dsn) as conn:
|
||||
postgis_version = postgis_version_tuple(conn)
|
||||
if postgis_version[0] < 3:
|
||||
LOG.error('PostGIS version is too old for using OSM raster data.')
|
||||
return 2
|
||||
|
||||
execute_file(dsn, datafile, ignore_errors=ignore_errors)
|
||||
|
||||
return 0
|
||||
|
||||
@@ -18,7 +18,7 @@ import urllib.request as urlrequest
|
||||
|
||||
from ..errors import UsageError
|
||||
from ..db import status
|
||||
from ..db.connection import Connection, connect, server_version_tuple
|
||||
from ..db.connection import Connection, connect
|
||||
from .exec_utils import run_osm2pgsql
|
||||
|
||||
try:
|
||||
@@ -156,7 +156,7 @@ def run_osm2pgsql_updates(conn: Connection, options: MutableMapping[str, Any]) -
|
||||
|
||||
# Consume updates with osm2pgsql.
|
||||
options['append'] = True
|
||||
options['disable_jit'] = server_version_tuple(conn) >= (11, 0)
|
||||
options['disable_jit'] = True
|
||||
run_osm2pgsql(options)
|
||||
|
||||
# Handle deletions
|
||||
|
||||
Reference in New Issue
Block a user