Skip to content

Commit 2087324

Browse files
committed
Avoid notice noise about geom validity
A geometry can be valid in OSM but invalid in whatever projection is chosen. This will raise a NOTICE in postgres, which is just noise and can potentially confuse users.
1 parent 665a484 commit 2087324

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

table.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,10 @@ void table_t::stop()
231231
.str());
232232
} else {
233233
/* osm2pgsql's transformation from 4326 to another projection could make a geometry invalid,
234-
and these need to be filtered. Also, a transformation is needed for geohashing. */
234+
and these need to be filtered. Also, a transformation is needed for geohashing.
235+
Notices are expected and ignored because they mean nothing aboud the validity of the geom
236+
in OSM. */
237+
pgsql_exec(sql_conn, PGRES_COMMAND_OK, "SET client_min_messages = WARNING");
235238
pgsql_exec_simple(
236239
sql_conn, PGRES_COMMAND_OK,
237240
(fmt("CREATE TABLE %1%_tmp %2% AS\n"
@@ -243,6 +246,7 @@ void table_t::stop()
243246
" COLLATE \"C\"") %
244247
name % (table_space ? "TABLESPACE " + table_space.get() : ""))
245248
.str());
249+
pgsql_exec_simple(sql_conn, PGRES_COMMAND_OK, "RESET client_min_messages");
246250
}
247251
pgsql_exec_simple(sql_conn, PGRES_COMMAND_OK, (fmt("DROP TABLE %1%") % name).str());
248252
pgsql_exec_simple(sql_conn, PGRES_COMMAND_OK, (fmt("ALTER TABLE %1%_tmp RENAME TO %1%") % name).str());

0 commit comments

Comments
 (0)