Bad behaviour on some geometric operations on degenerate polygons - Mailing list pgsql-bugs

From Josef Grahn
Subject Bad behaviour on some geometric operations on degenerate polygons
Date
Msg-id CAMBOBOmnoquwMuEiNABC_BKmHuNiW=6DQybZvM2SQUS=S5TT4g@mail.gmail.com
Whole thread Raw
Responses Re: Bad behaviour on some geometric operations on degenerate polygons
List pgsql-bugs
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

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Bit String expand bug
Next
From: digoal@126.com
Date:
Subject: BUG #8531: systemtap probe mark(checkpoint__done) error when i read the parameters