Skip to content

Commit

Permalink
Fix problem with previous commit on C++20
Browse files Browse the repository at this point in the history
It appears that with C++20 the fmt library expects the format string to
be constexpr.
  • Loading branch information
joto committed Aug 10, 2024
1 parent 67543d7 commit 050276e
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/gen/osm2pgsql-gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,20 @@ tile_extent get_extent_from_db(pg_conn_t const &db_connection,
return {};
}

std::string const sql =
raster ? "SELECT ST_XMin(extent), ST_YMin(extent),"
" ST_XMax(extent), ST_YMax(extent)"
" FROM raster_columns WHERE r_table_schema='{}'"
" AND r_table_name='{}' AND r_raster_column = '{}'"
: "SELECT ST_XMin(e), ST_YMin(e), ST_XMax(e), ST_YMax(e)"
" FROM ST_EstimatedExtent('{}', '{}', '{}') AS e";

auto const result = db_connection.exec(sql, schema, table, column);
pg_result_t result;
if (raster) {
result = db_connection.exec(
"SELECT ST_XMin(extent), ST_YMin(extent),"
" ST_XMax(extent), ST_YMax(extent)"
" FROM raster_columns WHERE r_table_schema='{}'"
" AND r_table_name='{}' AND r_raster_column = '{}'",
schema, table, column);
} else {
result = db_connection.exec(
"SELECT ST_XMin(e), ST_YMin(e), ST_XMax(e), ST_YMax(e)"
" FROM ST_EstimatedExtent('{}', '{}', '{}') AS e",
schema, table, column);
}

if (result.num_tuples() == 0 || result.is_null(0, 0)) {
return {};
Expand Down

0 comments on commit 050276e

Please sign in to comment.