mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-03-11 13:24:07 +00:00
make sure we use exactly the same table structure as osm2pgsql
This commit is contained in:
@@ -195,10 +195,10 @@ def create_place_postcode_table(conn: Connection, config: Configuration, **_: An
|
|||||||
cur.execute(
|
cur.execute(
|
||||||
"""
|
"""
|
||||||
CREATE TABLE place_postcode (
|
CREATE TABLE place_postcode (
|
||||||
osm_type VARCHAR(1),
|
osm_type CHAR(1) NOT NULL,
|
||||||
osm_id BIGINT,
|
osm_id BIGINT NOT NULL,
|
||||||
postcode TEXT NOT NULL,
|
postcode TEXT NOT NULL,
|
||||||
country_code VARCHAR(2),
|
country_code TEXT,
|
||||||
centroid GEOMETRY(Point, 4326) NOT NULL,
|
centroid GEOMETRY(Point, 4326) NOT NULL,
|
||||||
geometry GEOMETRY(Geometry, 4326)
|
geometry GEOMETRY(Geometry, 4326)
|
||||||
)
|
)
|
||||||
@@ -224,6 +224,11 @@ def create_place_postcode_table(conn: Connection, config: Configuration, **_: An
|
|||||||
CREATE INDEX place_postcode_osm_id_idx ON place_postcode
|
CREATE INDEX place_postcode_osm_id_idx ON place_postcode
|
||||||
USING BTREE (osm_type, osm_id)
|
USING BTREE (osm_type, osm_id)
|
||||||
""")
|
""")
|
||||||
|
cur.execute(
|
||||||
|
"""
|
||||||
|
CREATE INDEX place_postcode_postcode_idx ON place_postcode
|
||||||
|
USING BTREE (postcode)
|
||||||
|
""")
|
||||||
cur.execute("ALTER TABLE place ENABLE TRIGGER ALL")
|
cur.execute("ALTER TABLE place ENABLE TRIGGER ALL")
|
||||||
if not has_postcode_table:
|
if not has_postcode_table:
|
||||||
sqlp.run_sql_file(conn, 'functions/postcode_triggers.sql')
|
sqlp.run_sql_file(conn, 'functions/postcode_triggers.sql')
|
||||||
|
|||||||
Reference in New Issue
Block a user