Skip to content

Commit 34ae427

Browse files
committed
fix database computation with middle with schema
1 parent 1359e2e commit 34ae427

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

scripts/osm2pgsql-replication

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,14 @@ def table_exists(conn, table_name, schema_name=None):
9595
return cur.rowcount > 0
9696

9797

98-
def compute_database_date(conn, prefix):
98+
def compute_database_date(conn, schema, prefix):
9999
""" Determine the date of the database from the newest object in the
100100
database.
101101
"""
102102
# First, find the way with the highest ID in the database
103103
# Using nodes would be more reliable but those are not cached by osm2pgsql.
104104
with conn.cursor() as cur:
105-
table = sql.Identifier(f'{prefix}_ways')
105+
table = sql.Identifier(schema, f'{prefix}_ways')
106106
cur.execute(sql.SQL("SELECT max(id) FROM {}").format(table))
107107
osmid = cur.fetchone()[0] if cur.rowcount == 1 else None
108108

@@ -290,7 +290,7 @@ def init(conn, args):
290290
this with the `--server` parameter.
291291
"""
292292
if args.osm_file is None:
293-
date = compute_database_date(conn, args.prefix)
293+
date = compute_database_date(conn, args.middle_schema, args.prefix)
294294
if date is None:
295295
return 1
296296

0 commit comments

Comments
 (0)