[postgis-tickets] [PostGIS] #3031: "POINT EMPTY" as WKB defaults to "MULTIPOINT EMPTY" when restoring with copy and failing validation

PostGIS trac at osgeo.org
Sat Feb 7 17:52:30 PST 2015


#3031: "POINT EMPTY" as WKB defaults to "MULTIPOINT EMPTY" when restoring with
copy and failing validation
--------------------------------------------+-------------------------------
 Reporter:  jeanchristophesaville           |       Owner:  pramsey       
     Type:  defect                          |      Status:  new           
 Priority:  medium                          |   Milestone:  Management 2.0
Component:  postgis                         |     Version:  2.1.x         
 Keywords:  POINT EMPTY , MULTIPOINT EMPTY  |  
--------------------------------------------+-------------------------------
 Using version
 "POSTGIS="2.1.2 r12389" GEOS="3.4.2-CAPI-1.8.2 r3921" PROJ="Rel. 4.8.0, 6
 March 2012" LIBXML="2.6.26" LIBJSON="UNKNOWN""

 I have a table with a column definition of:
 ALTER TABLE "myTable" ADD COLUMN point_as_4326 geometry(Point,4326);

 In which I will store 'POINT EMPTY' for invalid point geometries

 However when I try and restore a previous dump file to this table I get
 the following error.

 COPY failed for table "position": ERROR:  Geometry type (MultiPoint) does
 not match column type (Point)

 Upon further investigation I found that my version of PostGIS seems to
 produce the same WKB for 'POINT EMPTY' and 'MULTIPOINT EMPTY' which in
 turn fails the column validation of geometry(Point,4326);


 To demonstrate the problem behaviour:

 SELECT ST_GeomFromText('POINT EMPTY')           --> producess
 '010400000000000000'

 SELECT ST_GeomFromText('MULTIPOINT EMPTY')      --> producess
 '010400000000000000'

 SELECT ST_GeomFromText('POINT EMPTY') = ST_GeomFromText('MULTIPOINT
 EMPTY')     --> produces true

 SELECT ST_AsText('010400000000000000')          --> produces 'MULTIPOINT
 EMPTY' -- I expect 'POINT EMPTY' here

 SELECT ST_AsText(ST_GeomFromText('POINT EMPTY'))        --> However
 produces 'POINT EMPTY'


 It seems that there are explicit constants for various empty geometry
 types as per the following
 SELECT ST_AsText('010200000000000000') --"LINESTRING EMPTY"
 SELECT ST_AsText('010300000000000000') --"POLYGON EMPTY"
 SELECT ST_AsText('010400000000000000') --"MULTIPOINT EMPTY"
 SELECT ST_AsText('010500000000000000') --"MULTILINESTRING EMPTY"
 SELECT ST_AsText('010600000000000000') --"MULTIPOLYGON EMPTY"
 SELECT ST_AsText('010700000000000000') --"GEOMETRYCOLLECTION EMPTY"
 SELECT ST_AsText('010800000000000000') --"CIRCULARSTRING EMPTY"
 SELECT ST_AsText('010900000000000000') --"COMPOUNDCURVE EMPTY"

 However I'm not sure what happened to "POINT EMPTY" which I haven't come
 accross yet

 In version
 "POSTGIS="1.5.8" GEOS="3.4.2-CAPI-1.8.2 r3921" PROJ="Rel. 4.8.0, 6 March
 2012" LIBXML="2.6.26" USE_STATS (procs from 1.5 r5976 need upgrade)"
 SELECT ST_GeomFromText('POINT EMPTY') -- produces '010700000000000000' =
 "GEOMETRYCOLLECTION EMPTY"

 All of the above to ask why are we not using an explicit POINT EMPTY value
 and how can I get my previous backup restored without failing geometry
 type validation.

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/3031>
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