Skip to content

Commit

Permalink
Allow NULL values in new middle format members list
Browse files Browse the repository at this point in the history
This makes osm2pgsql a bit more future proof by allowing the list of
members (which is encoded as JSON in the new middle format) to be empty,
i.e. to contain NULL. We currently don't write empty member lists as
NULL but as an empty JSON list, but if we change this in the future,
older versions of osm2pgsql will be able to read this correctly.
  • Loading branch information
joto committed Oct 30, 2023
1 parent 5c4dcc1 commit 5b25afe
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/middle-pgsql.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,10 @@ template <typename T>
void pgsql_parse_json_members(char const *string,
osmium::memory::Buffer *buffer, T *obuilder)
{
if (*string == '\0') { // NULL
return;
}

osmium::builder::RelationMemberListBuilder builder{*buffer, obuilder};
member_list_json_builder parser{&builder};
nlohmann::json::sax_parse(string, &parser);
Expand Down

0 comments on commit 5b25afe

Please sign in to comment.