[Tile-serving] [openstreetmap/osm2pgsql] Missing empty string check in flex write_double (#1416)

Andy Allan notifications at github.com
Thu Feb 11 14:53:27 UTC 2021


There's a missing empty string check in [`write_double`](https://github.com/openstreetmap/osm2pgsql/blob/497476d56f7c1fcbbdb95b363293de6ce0feac00/src/output-flex.cpp#L302-L303) which means that an empty string input is written out as `0.0` instead of `null`.

The equivalent `write_integer` [has the check](https://github.com/openstreetmap/osm2pgsql/blob/497476d56f7c1fcbbdb95b363293de6ce0feac00/src/output-flex.cpp#L279-L282) and works fine.

I think the fix is straightforward, but I'm not sure about the tests, which is why I haven't made a PR. My guess would be to add "AND treal IS NULL" to the first 6 of the [invalid string](https://github.com/openstreetmap/osm2pgsql/blob/497476d56f7c1fcbbdb95b363293de6ce0feac00/tests/test-output-flex-types.cpp#L179-L185) tests, but that leaves the issue of the final test which should be valid input for real output as well as being invalid input for the integer columns. I couldn't find any other tests which ensure that real output works correctly for not-an-integer-but-still-a-number-string input e.g. "-123.45", but I'm not sure if such tests are missing or I've overlooked them somewhere else.



-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/issues/1416
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20210211/4fc5d5b8/attachment.htm>


More information about the Tile-serving mailing list