Opened 9 years ago

Last modified 9 years ago

#5968 closed defect

Empty elements in GML : empty or NULL — at Initial Version

Reported by: Even Rouault Owned by: Even Rouault
Priority: normal Milestone: 2.0.0
Component: OGR_SF Version: svn-trunk
Severity: normal Keywords: gml wfs null
Cc:

Description

From http://lists.osgeo.org/pipermail/gdal-dev/2015-May/041834.html :

> $ ogr2ogr -f 'GPKG' out.gpkg WFS:http://maps.zh.ch/wfs/TbaBaustellenZHWF
> S
> ERROR 1: failed to execute insert : NOT NULL constraint failed:
> baustellen-detailansicht.weiteregemeinden
> ERROR 1: Unable to write feature 518 from layer baustellen-detailansicht .
> ERROR 1: Terminating translation prematurely after failed translation
> of layer baustellen-detailansicht (use -skipfailures to skip errors)

My analysis

This is an interesting feedback...

The issue is that OGR interprets the following 

        <ms:weiteregemeinden></ms:weiteregemeinden>

as being NULL, instead of empty string.
And the schema of the layer as defined by http://maps.zh.ch/wfs/TbaBaustellenZHWFS?SERVICE=WFS&VERSION=1.1.0&REQUEST=DescribeFeatureType&TYPENAME=baustellen-detailansicht makes the attribute mandatory, hence NOT NULL.

Presumably the cleaner way of addressing this would be to make the GML driver report an empty string, instead of NULL, but I still think that the intent is generally NULL and this was the historic behaviour, so I'm hesitant to change this.

So in light of this, I've reconsidered the introduction of not-nullable fields in GML/WFS drivers, and just disabled them to avoid such issues

Change History (0)

Note: See TracTickets for help on using tickets.