Implement poly_distance().
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 13 Dec 2021 22:33:32 +0000 (17:33 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 13 Dec 2021 22:33:32 +0000 (17:33 -0500)
commitc5c192d7bdfa78f19e735610488b1cc5ad6e41cc
treee7d931fdbe4f11798408ca28ce7ff931e829b401
parent3f323956128ff8589ce4d3a14e8b950837831803
Implement poly_distance().

geo_ops.c contains half a dozen functions that are just stubs throwing
ERRCODE_FEATURE_NOT_SUPPORTED.  Since it's been like that for more
than twenty years, there's clearly not a lot of interest in filling in
the stubs.  However, I'm uncomfortable with deleting poly_distance(),
since every other geometric type supports a distance-to-another-object-
of-the-same-type function.  We can easily add this capability by
cribbing from poly_overlap() and path_distance().

It's possible that the (existing) test case for this will show some
numeric instability, but hopefully the buildfarm will expose it if so.

In passing, improve the documentation to try to explain why polygons
are distinct from closed paths in the first place.

Discussion: https://postgr.es/m/3426566.1638832718@sss.pgh.pa.us
doc/src/sgml/datatype.sgml
src/backend/utils/adt/geo_ops.c
src/test/regress/expected/geometry.out