[Tile-serving] [openstreetmap/osm2pgsql] Fix deletion on update in gazetteer (#1008)

Sarah Hoffmann notifications at github.com
Sun Dec 1 10:33:31 UTC 2019


lonvia commented on this pull request.



> -    assert(!m_inflight);
-
-    std::string sql = "DELETE FROM ";
-    sql.reserve(buffer->target->name.size() + buffer->deletables.size() * 15 +
-                30);
-    sql += buffer->target->name;
-    sql += " WHERE ";
-    sql += buffer->target->id;
-    sql += " IN (";
-    for (auto id : buffer->deletables) {
-        sql += std::to_string(id);
+    std::string sql = "DELETE FROM {} WHERE {} IN ("_format(table, column);
+    sql.reserve(m_deletables.size() * 15 + sql.size());
+
+    for (auto id : m_deletables) {
+        sql += fmt::to_string(id);

Aha, that's where the additional second in the regression tests went. Switched to `fmt::memory_buffer` (also below). The `back_inserter` doesn't seem to be necessary. Compile-time strings only work with the FMT_STRING() macro in this constellation. That's mildly annoying.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/pull/1008#discussion_r352334877
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20191201/3feb715b/attachment.html>


More information about the Tile-serving mailing list