Skip to content

Commit 050276e

Browse files
committed
Fix problem with previous commit on C++20
It appears that with C++20 the fmt library expects the format string to be constexpr.
1 parent 67543d7 commit 050276e

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/gen/osm2pgsql-gen.cpp

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,20 @@ tile_extent get_extent_from_db(pg_conn_t const &db_connection,
109109
return {};
110110
}
111111

112-
std::string const sql =
113-
raster ? "SELECT ST_XMin(extent), ST_YMin(extent),"
114-
" ST_XMax(extent), ST_YMax(extent)"
115-
" FROM raster_columns WHERE r_table_schema='{}'"
116-
" AND r_table_name='{}' AND r_raster_column = '{}'"
117-
: "SELECT ST_XMin(e), ST_YMin(e), ST_XMax(e), ST_YMax(e)"
118-
" FROM ST_EstimatedExtent('{}', '{}', '{}') AS e";
119-
120-
auto const result = db_connection.exec(sql, schema, table, column);
112+
pg_result_t result;
113+
if (raster) {
114+
result = db_connection.exec(
115+
"SELECT ST_XMin(extent), ST_YMin(extent),"
116+
" ST_XMax(extent), ST_YMax(extent)"
117+
" FROM raster_columns WHERE r_table_schema='{}'"
118+
" AND r_table_name='{}' AND r_raster_column = '{}'",
119+
schema, table, column);
120+
} else {
121+
result = db_connection.exec(
122+
"SELECT ST_XMin(e), ST_YMin(e), ST_XMax(e), ST_YMax(e)"
123+
" FROM ST_EstimatedExtent('{}', '{}', '{}') AS e",
124+
schema, table, column);
125+
}
121126

122127
if (result.num_tuples() == 0 || result.is_null(0, 0)) {
123128
return {};

0 commit comments

Comments
 (0)