From 4f34ee9058ac77050cb6309a895e0f26a2161c03 Mon Sep 17 00:00:00 2001 From: Jochen Topf Date: Sat, 28 Oct 2023 14:53:41 +0200 Subject: [PATCH] Allow NULL values in new middle format members list 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. --- src/middle-pgsql.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/middle-pgsql.cpp b/src/middle-pgsql.cpp index 4ade3afb5..5beddee68 100644 --- a/src/middle-pgsql.cpp +++ b/src/middle-pgsql.cpp @@ -443,6 +443,10 @@ template 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);