<p></p>
<p><b>@joto</b> commented on this pull request.</p>
<hr>
<p>In <a href="https://github.com/openstreetmap/osm2pgsql/pull/1292#discussion_r507519321">src/middle-pgsql.cpp</a>:</p>
<pre style='color:#555'>> @@ -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));
</pre>
<p>Should we check whether there is data in there before dropping it? Or maybe just warn the user?</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/openstreetmap/osm2pgsql/pull/1292#discussion_r507519321">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AA6353TZ62QSHG7LGT6QG4DSLPQ7PANCNFSM4STPJCLQ">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AA6353X7IKQHOIMQTNC7TL3SLPQ7PA5CNFSM4STPJCL2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGODZ6FT2A.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/osm2pgsql/pull/1292#discussion_r507519321",
"url": "https://github.com/openstreetmap/osm2pgsql/pull/1292#discussion_r507519321",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>