Skip to content

Commit 344e9d8

Browse files
authored
Merge pull request #1943 from joto/client-min-messages
Do "SET client_min_messages = WARNING" on all db connections
2 parents ae807b0 + a06dd4a commit 344e9d8

6 files changed

Lines changed: 6 additions & 19 deletions

File tree

src/db-copy.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,6 @@ void db_copy_thread_t::thread_t::operator()()
131131
// Let commits happen faster by delaying when they actually occur.
132132
m_conn->exec("SET synchronous_commit = off");
133133

134-
// Do not show messages about invalid geometries (they are removed
135-
// by the trigger).
136-
m_conn->exec("SET client_min_messages = WARNING");
137-
138134
bool done = false;
139135
while (!done) {
140136
std::unique_ptr<db_cmd_t> item;

src/flex-table.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -272,16 +272,13 @@ void table_connection_t::start(bool append)
272272
{
273273
assert(m_db_connection);
274274

275-
m_db_connection->exec("SET client_min_messages = WARNING");
276-
277275
if (!append) {
278276
m_db_connection->exec("DROP TABLE IF EXISTS {} CASCADE",
279277
table().full_name());
280278
}
281279

282280
// These _tmp tables can be left behind if we run out of disk space.
283281
m_db_connection->exec("DROP TABLE IF EXISTS {}", table().full_tmp_name());
284-
m_db_connection->exec("RESET client_min_messages");
285282

286283
if (!append) {
287284
m_db_connection->exec(table().build_sql_create_table(
@@ -314,10 +311,6 @@ void table_connection_t::stop(bool updateable, bool append)
314311

315312
log_info("Clustering table '{}' by geometry...", table().name());
316313

317-
// Notices about invalid geometries are expected and can be ignored
318-
// because they say nothing about the validity of the geometry in OSM.
319-
m_db_connection->exec("SET client_min_messages = WARNING");
320-
321314
m_db_connection->exec(table().build_sql_create_table(
322315
flex_table_t::table_type::permanent, table().full_tmp_name()));
323316

src/middle-pgsql.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,6 @@ void middle_pgsql_t::start()
663663
}
664664
}
665665
} else {
666-
m_db_connection.exec("SET client_min_messages = WARNING");
667666
for (auto const &table : m_tables) {
668667
log_debug("Setting up table '{}'", table.name());
669668
auto const qual_name = qualified_name(table.schema(), table.name());

src/output-flex.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1265,7 +1265,6 @@ create_expire_tables(std::vector<expire_output_t> const &expire_outputs,
12651265
}
12661266

12671267
pg_conn_t const connection{conninfo};
1268-
connection.exec("SET client_min_messages = WARNING");
12691268
for (auto &expire_output : expire_outputs) {
12701269
if (!expire_output.table().empty()) {
12711270
expire_output.create_output_table(connection);

src/pgsql.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ pg_conn_t::pg_conn_t(std::string const &conninfo)
4343
log_sql("(C{}) New database connection (backend_pid={})",
4444
m_connection_id, results.get(0, 0));
4545
}
46+
47+
// PostgreSQL sends notices in many different contexts which aren't that
48+
// useful for the user. So we disable them for all connections.
49+
if (!get_logger().debug_enabled()) {
50+
exec("SET client_min_messages = WARNING");
51+
}
4652
}
4753

4854
void pg_conn_t::close()

src/table.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ void table_t::start(std::string const &conninfo, std::string const &table_space)
8484

8585
connect();
8686
log_info("Setting up table '{}'", m_target->name);
87-
m_sql_conn->exec("SET client_min_messages = WARNING");
8887
auto const qual_name = qualified_name(m_target->schema, m_target->name);
8988
auto const qual_tmp_name = qualified_name(
9089
m_target->schema, m_target->name + "_tmp");
@@ -96,7 +95,6 @@ void table_t::start(std::string const &conninfo, std::string const &table_space)
9695

9796
// These _tmp tables can be left behind if we run out of disk space.
9897
m_sql_conn->exec("DROP TABLE IF EXISTS {}", qual_tmp_name);
99-
m_sql_conn->exec("RESET client_min_messages");
10098

10199
//making a new table
102100
if (!m_append) {
@@ -197,10 +195,6 @@ void table_t::stop(bool updateable, bool enable_hstore_index,
197195

198196
log_info("Clustering table '{}' by geometry...", m_target->name);
199197

200-
// Notices about invalid geometries are expected and can be ignored
201-
// because they say nothing about the validity of the geometry in OSM.
202-
m_sql_conn->exec("SET client_min_messages = WARNING");
203-
204198
std::string sql = fmt::format("CREATE TABLE {} {} AS SELECT * FROM {}",
205199
qual_tmp_name, m_table_space, qual_name);
206200

0 commit comments

Comments
 (0)