[PostGIS] #5718: `st_isvalid(point(NaN, NaN))` is true

PostGIS trac at osgeo.org
Wed Apr 24 20:41:01 PDT 2024


#5718: `st_isvalid(point(NaN, NaN))` is true
----------------------+---------------------
  Reporter:  n0099    |      Owner:  pramsey
      Type:  defect   |     Status:  new
  Priority:  medium   |  Milestone:
 Component:  postgis  |    Version:  3.4.x
Resolution:           |   Keywords:
----------------------+---------------------
Comment (by robe):

 As @mdavis pointed out to me in IRC, there is no representation for
 POINT(NaN NaN) in WKB so it gets read as POINT EMPTY which is valid.

 However I can create a real NaN as follows and PostGIS does return false:

 ```
 SELECT *, st_isvalid(a), st_x(a), st_y(a)
 FROM (SELECT ST_GeomFromText('POINT(NaN NaN)') a) t;

 ```

 Yields as you'd expect


 {{{
  Invalid Coordinate at or near point nan nan
                      a                      | st_isvalid | st_x | st_y
 --------------------------------------------+------------+------+------
  0101000000000000000000F87F000000000000F87F | f          |  NaN |  NaN
 (1 row)
 }}}


 So only question is if it's worthwhile throwing an error or keeping the
 wkb casting as POINT EMPTY
-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5718#comment:3>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list