Name

~= — Returns TRUE if the geometry A is the same as B.

Synopsis

boolean ~=( geometry A , geometry B );

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.

[Note]

This operand will make use of any indexes that may be available on the geometries.

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)

See Also

ST_Equals, ST_OrderingEquals, =