<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_r507612721">src/pgsql.cpp</a>:</p>
<pre style='color:#555'>>
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());
+ }
</pre>
<p>Because of <a href="https://github.com/openstreetmap/osm2pgsql/blob/cd9770b2d724f4e7602b50659acc6684d86d3a51/src/middle-pgsql.cpp#L634">this <code>if</code></a>, <code>sql.create_table</code> and <code>sql.prepare_query</code> can be empty, but they are still run. It was easiest to just not run empty queries instead of putting checks in more places.</p>
<p>For consistency I decided to add the emptyness check in both <code>exec</code> functions.</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_r507612721">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AA6353TY7O3PVFDVSETBJEDSLQC6JANCNFSM4STPJCLQ">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AA6353WB77WDNO6IB5G2TN3SLQC6JA5CNFSM4STPJCL2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGODZ7DJUQ.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_r507612721",
"url": "https://github.com/openstreetmap/osm2pgsql/pull/1292#discussion_r507612721",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>