Skip to content

Commit a1a22bd

Browse files
authored
Merge pull request #2053 from joto/deprecate-add-row
Add runtime warnings that area type and add_row() are deprecated
2 parents ab50efe + 32389c1 commit a1a22bd

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

src/flex-table-column.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ static table_column_type get_column_type_from_string(std::string const &type)
6262
throw fmt_error("Unknown column type '{}'.", type);
6363
}
6464

65+
if (column_type->type == table_column_type::area) {
66+
log_warn("The 'area' column type is deprecated. Please read");
67+
log_warn("https://osm2pgsql.org/doc/tutorials/"
68+
"switching-from-add-row-to-insert/");
69+
}
70+
6571
return column_type->type;
6672
}
6773

src/output-flex.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,13 @@ int output_flex_t::table_add_row()
587587
}
588588
lua_remove(lua_state(), 1);
589589

590+
if (m_add_row_has_never_been_called) {
591+
m_add_row_has_never_been_called = false;
592+
log_warn("The add_row() function is deprecated. Please read");
593+
log_warn("https://osm2pgsql.org/doc/tutorials/"
594+
"switching-from-add-row-to-insert/");
595+
}
596+
590597
if (m_calling_context == calling_context::process_node) {
591598
if (!table.matches_type(osmium::item_type::node)) {
592599
throw fmt_error("Trying to add node to table '{}'.", table.name());

src/output-flex.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,8 @@ class output_flex_t : public output_t
316316
* add_row() command.
317317
*/
318318
bool m_disable_add_row = false;
319+
320+
bool m_add_row_has_never_been_called = true;
319321
};
320322

321323
#endif // OSM2PGSQL_OUTPUT_FLEX_HPP

0 commit comments

Comments
 (0)