Skip to content

Commit

Permalink
Merge pull request #2233 from joto/remove-db-format-1
Browse files Browse the repository at this point in the history
Remove forgotten code still supporting old middle format
  • Loading branch information
lonvia authored Aug 19, 2024
2 parents b75bb94 + 03191b4 commit 1e2a1f2
Showing 1 changed file with 4 additions and 24 deletions.
28 changes: 4 additions & 24 deletions src/middle-pgsql.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -703,22 +703,12 @@ INSERT INTO osm2pgsql_changed_ways
)");
}

if (m_options->middle_database_format == 1) {
queries.emplace_back(R"(
INSERT INTO osm2pgsql_changed_relations
SELECT r.id
FROM {schema}"{prefix}_rels" r, osm2pgsql_changed_nodes n
WHERE r.parts && ARRAY[n.id]
AND r.parts[1:way_off] && ARRAY[n.id]
)");
} else {
queries.emplace_back(R"(
queries.emplace_back(R"(
INSERT INTO osm2pgsql_changed_relations
SELECT r.id
FROM {schema}"{prefix}_rels" r, osm2pgsql_changed_nodes c
WHERE {schema}"{prefix}_member_ids"(r.members, 'N'::char) && ARRAY[c.id];
)");
}
)");

for (auto const &query : queries) {
m_db_connection.exec(build_sql(*m_options, query));
Expand Down Expand Up @@ -755,22 +745,12 @@ void middle_pgsql_t::get_way_parents(idlist_t const &changed_ways,

m_db_connection.exec("ANALYZE osm2pgsql_changed_ways");

if (m_options->middle_database_format == 1) {
m_db_connection.exec(build_sql(*m_options, R"(
INSERT INTO osm2pgsql_changed_relations
SELECT DISTINCT r.id
FROM {schema}"{prefix}_rels" r, osm2pgsql_changed_ways w
WHERE r.parts && ARRAY[w.id]
AND r.parts[way_off+1:rel_off] && ARRAY[w.id]
)"));
} else {
m_db_connection.exec(build_sql(*m_options, R"(
m_db_connection.exec(build_sql(*m_options, R"(
INSERT INTO osm2pgsql_changed_relations
SELECT DISTINCT r.id
FROM {schema}"{prefix}_rels" r, osm2pgsql_changed_ways c
WHERE {schema}"{prefix}_member_ids"(r.members, 'W'::char) && ARRAY[c.id];
)"));
}
)"));

load_id_list(m_db_connection, "osm2pgsql_changed_relations",
parent_relations);
Expand Down

0 comments on commit 1e2a1f2

Please sign in to comment.