title: PostGIS: Two equal geometries are not equal?
body: <p>I have two geometries in different tables which look like the same, but one is valid and the other is invalid. I checked it out:</p>
  <pre class="lang-sql prettyprint-override"><code>select  ST_IsValid(_s.geom) as _gvalid, 
          ST_IsValid(s.geom) as gvalid,
          _s.geom = s.geom as  geom_bin_equal, 
          ST_SRID(_s.geom)=ST_SRID(s.geom) as srid_equal, 
          ST_EQUALS(_s.geom, s.geom), 
          ST_AsText(_s.geom) = ST_AsText(s.geom) as text_equal 
  from _spatial_object _s, spatial_object s
  where _s.id_spatial_object = 314 and s.id_spatial_object = 314
  </code></pre>
  <p>Output here:</p>
  <p><a href="https://i.stack.imgur.com/Om4QB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Om4QB.png" alt="enter image description here" /></a></p>
  <p>How on the earth it could be?</p>
  <p>Actually, the both geometries should be invalid (Interior is disconnected at or near point 58.182000000000002 51.457000000000001)</p>
  <p>Geometry:</p>
  <p>POLYGON((58.169 51.456,58.176 51.458,58.18 51.458,58.182 51.457,58.183 51.456,58.182 51.453,58.184 51.451,58.182 51.449,58.183 51.448,58.181 51.445,58.179 51.443,58.177 51.444,58.179 51.445,58.178 51.446,58.178 51.448,58.178 51.448,58.177 51.448,58.173 51.447,58.17 51.449,58.173 51.45,58.174 51.451,58.178 51.451,58.178 51.452,58.178 51.452,58.176 51.452,58.173 51.451,58.169 51.456),(58.169 51.456,58.1732222222222 51.4569444444444,58.182 51.457,58.169 51.456))</p>
  <pre><code>select ST_ISValid(geom), ST_IsValid(ST_GeomFromText(ST_AsText(geom))) from _spatial_object
  </code></pre>
  <p>outputs</p>
  <p>true false</p>