Skip to content

Commit e7ed8d0

Browse files
committed
Allow empty config file in flex output
No flex config file, or one that doesn't define any tables is usually not very useful. But it can be used in slim mode to have the middle tables only. Or it can be used to do some other processing or instead if the null output for testing. This change allows an empty config file, but a warning is printed that no output tables are defined. You still have to specify a config file, it can be an empty one, but it has to be there. This is so that if the user forgets naming a config file on the command line they get an error and not only a warning that might be missed.
1 parent 40ef1a6 commit e7ed8d0

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/output-flex.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,8 +1172,7 @@ output_flex_t::output_flex_t(std::shared_ptr<middle_query_t> const &mid,
11721172
}
11731173

11741174
if (m_tables->empty()) {
1175-
throw std::runtime_error{
1176-
"No tables defined in Lua config. Nothing to do!"};
1175+
log_warn("No output tables defined!");
11771176
}
11781177

11791178
// For backwards compatibility we add a "default" expire output to all

tests/bdd/flex/lua-basics.feature

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ Feature: Flex output uses a Lua config file
99
print("stage=" .. osm2pgsql.stage)
1010
print("Table=" .. type(osm2pgsql.Table))
1111
"""
12-
Then running osm2pgsql flex fails
13-
And the error output contains
12+
When running osm2pgsql flex
13+
Then the error output contains
1414
"""
15-
No tables defined in Lua config. Nothing to do!
15+
No output tables defined
1616
"""
1717
And the standard output contains
1818
"""

0 commit comments

Comments
 (0)