[Tile-serving] [openstreetmap/osm2pgsql] Do not create planet_osm_nodes table if flat nodes are used (#1292)

Sarah Hoffmann notifications at github.com
Fri Oct 16 19:54:16 UTC 2020


@lonvia commented on this pull request.



> @@ -577,13 +577,15 @@ void middle_pgsql_t::start()
     } else {
         // (Re)create tables.
         m_db_connection.exec("SET client_min_messages = WARNING");
-        for (auto &table : m_tables) {
-            fmt::print(stderr, "Setting up table: {}\n", table.name());
-            auto const qual_name = qualified_name(
-                table.m_copy_target->schema, table.m_copy_target->name);
-            m_db_connection.exec(
-                "DROP TABLE IF EXISTS {} CASCADE"_format(qual_name));
-            m_db_connection.exec(table.m_create);
+        for (auto const &table : m_tables) {
+            if (!table.m_create.empty()) {
+                fmt::print(stderr, "Setting up table: {}\n", table.name());
+                auto const qual_name = qualified_name(
+                    table.m_copy_target->schema, table.m_copy_target->name);
+                m_db_connection.exec(
+                    "DROP TABLE IF EXISTS {} CASCADE"_format(qual_name));

I think we should still try to drop the table here, just in case that it was left over from a previous run without flatnode store.

> @@ -749,6 +752,14 @@ class TestMPUpdateSlimLuaHstore(MultipolygonUpdateRunner, unittest.TestCase,
     extra_params = ['--slim', '-k']
     use_lua_tagtransform = True
 
+class TestMPUpdateSlimWithFlatNodes(MultipolygonUpdateRunner, unittest.TestCase,
+                                    MultipolygonTests):
+    extra_params = ['--slim', '-F', 'flat.nodes']

You'd need to add a cleanup for that file.

>  
 void pg_conn_t::exec(std::string const &sql) const
 {
-    query(PGRES_COMMAND_OK, sql.c_str());
+    if (!sql.empty()) {
+        query(PGRES_COMMAND_OK, sql.c_str());
+    }

These two changes don't see really needed for this PR?

-- 
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/1292#pullrequestreview-510752415
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20201016/9b5c9d63/attachment-0001.htm>


More information about the Tile-serving mailing list