Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 26C071337B68 for ; Wed, 16 Feb 2011 11:32:07 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 13078-04 for ; Wed, 16 Feb 2011 15:32:01 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 8E13B133616B for ; Wed, 16 Feb 2011 11:31:59 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p1GFVxHl025123; Wed, 16 Feb 2011 10:31:59 -0500 (EST) To: "Konrad Garus" cc: pgsql-bugs@postgresql.org Subject: Re: BUG #5889: "Intersects" for polygons broken In-reply-to: <201102161058.p1GAwS5V009535@wwwmaster.postgresql.org> References: <201102161058.p1GAwS5V009535@wwwmaster.postgresql.org> Comments: In-reply-to "Konrad Garus" message dated "Wed, 16 Feb 2011 10:58:28 +0000" Date: Wed, 16 Feb 2011 10:31:58 -0500 Message-ID: <25122.1297870318@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201102/142 X-Sequence-Number: 29414 "Konrad Garus" writes: > && operator seems to be broken for polygons whose bounding boxes intersect: > select polygon'((0,0), (1,2), (0,2))' && polygon'((0.5, 0), (1,0), (1,1))'; > ?column? > ---------- > t > (1 row) This is fixed as of 9.0; see the release notes at http://www.postgresql.org/docs/9.0/static/release-9-0.html which say Correct calculations of "overlaps" and "contains" operations for polygons (Teodor Sigaev) The polygon && (overlaps) operator formerly just checked to see if the two polygons' bounding boxes overlapped. It now does a more correct check. The polygon @> and <@ (contains/contained by) operators formerly checked to see if one polygon's vertexes were all contained in the other; this can wrongly report "true" for some non-convex polygons. Now they check that all line segments of one polygon are contained in the other. regards, tom lane