From abefba02042fa4b6c04fa598263871e08082c6d0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nicklas=20Av=C3=A9n?= Date: Sun, 24 Jan 2010 09:10:31 +0000 Subject: [PATCH] git-svn-id: http://svn.osgeo.org/postgis/trunk@5161 b70326c6-7e19-0410-871a-916f4a2858ee --- doc/reference_operator.xml | 46 +++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/doc/reference_operator.xml b/doc/reference_operator.xml index 149211069..47bc63f61 100644 --- a/doc/reference_operator.xml +++ b/doc/reference_operator.xml @@ -894,7 +894,7 @@ FROM ~= - Returns TRUE if the geometry A is the same as B. + Returns TRUE if A's bounding box is the same as B's. @@ -938,39 +938,39 @@ FROM Description - The ~= operator returns TRUE if geometry A is the same as geometry B. - It tests actual geometric equality of two features. So if A and B are the same feature, vertex-by-vertex, the - operator returns TRUE. + The ~= operator returns TRUE if the bounding box of geometry/geography A + is the same as the bounding box of geometry/geography B. This operand will make use of any indexes that may be available on the geometries. - Availability: 1.5.0 support for geography was introduced. + Availability: 1.5.0 changed behavior - + + + This operator has changed behavior in PostGIS 1.5 + from testing for actual geometric equality to only + checking for bounding box equality. To complicate things + it also depends on if you have done a hard or soft upgrade + which behavior your database has. To find out which behavior + your database has you can run the query below. + To check for true equality use or and to check for bounding box equality ; + operator is a safer option. + Examples + - SELECT tbl1.column1, tbl2.column1, tbl1.column2 ~= tbl2.column2 AS same -FROM - ( VALUES - (1, 'LINESTRING (0 0, 2 2)'::geometry)) AS tbl1, - ( VALUES - (2, 'LINESTRING (0 0, 1 1, 2 2)'::geometry), - (3, 'LINESTRING (2 2, 0 0)'::geometry), - (4, 'LINESTRING (0 0, 2 2)'::geometry)) AS tbl2; - - column1 | column1 | same ----------+---------+------ - 1 | 2 | f - 1 | 3 | f - 1 | 4 | t -(3 rows) +select 'LINESTRING(0 0, 1 1)'::geometry ~= 'LINESTRING(0 1, 1 0)'::geometry as equality; + equality | +-----------------+ + t | + + The above can be used to test if you have the new or old behavior of ~= operator. - See Also - , , -- 2.40.0