Hello.
I encountered an unexpected behaviour when doing some geometric operations
on polygons that consist of only one point (or more generally, when all
points in the polygon are identical).
Specifically, taking the center point of such a polygon results in an error
message.
== Code to reproduce ==
SELECT @@ polygon '((1, 1))';
== Expected result ==
(1,1)
== Actual result ==
ERROR: cannot convert empty polygon to circle
The same problem exists when one tries to convert a polygon to a point
using the point() function (presumably because the same code path is
invoked). Ironically, the consequence of this is that the only non-empty
polygon that can *not* be converted to a point, is one that occupy
precisely a single point.
Other operations, such as overlap tests, on the other hand seem to work as
one would expect, which leads me to conclude that handling of degenerate
polygons is meant to function, and that the behaviour of this particular
operation is simply a bug.
This bug report applies to at least PostgreSQL versions 9.1.9 and 9.3.0.
Other versions, I have not tested.
Best Regards,
Josef Grahn