Bug report #20961

QGIS Server 3.4 can't reset numeric field using WFS Update

Added by Uroš Preložnik almost 2 years ago. Updated almost 2 years ago.

Status:Closed
Priority:High
Assignee:Alessandro Pasotti
Category:QGIS Server
Affected QGIS version:3.5(master) Regression?:Yes
Operating System: Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:28780

Description

When doing WFS update transaction on any numeric field QGIS Server rejects null value. That would make sense only if the field cannot have null value, but this happens always for numeric fields. In this example is PostGIS table and field is integer and can contain null values.

To reproduce this is really simple just try to reset any numeric field to NULL value using WFS Update transaction and it will be rejected.

It's a regression because it's working normally on 2.18.

It's the same using WFS 1.1.0 and 1.0.0
Transaction is correctly formed and QGIS Server result is below:

<WFS_TransactionResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0" xmlns="http://www.opengis.net/wfs" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/wfs.xsd" xmlns:ogc="http://www.opengis.net/ogc">
 <TransactionResult>
  <Status>
   <ERROR/>
  </Status>
  <Locator>Insert:polygons</Locator>
  <Message>Property conversion error on layer insert 'polygons'</Message>
 </TransactionResult>
</WFS_TransactionResponse>

points.sql - plain text dump from PostgreSQL (8.96 KB) Uroš Preložnik, 2019-01-10 11:11 AM

wfs test.qgs (44.9 KB) Uroš Preložnik, 2019-01-10 11:18 AM

Associated revisions

Revision 71e01168
Added by Alessandro Pasotti almost 2 years ago

Server WFS NULL values support

- expose nillable in describefeaturetype
- serve xsi:nil="true" in getfeature
- check for NULL in transactions and report an error

Fixes #20961 - plus some other unreported

History

#1 Updated by Alessandro Pasotti almost 2 years ago

  • Status changed from Open to Feedback

Please attach a minimal test project and data, it will speed-up debugging.

#2 Updated by Uroš Preložnik almost 2 years ago

Adding

1) QGIS project with WFS layers from test.level2.si server

2) points.sql data from PG (to see table structure, we are looking field name "type" with type integer, yes field name "type", not very original)

Steps to reproduce issue:

1. Open project
2. Edit point layer and reset value in field "type" to NULL for any feature.
3. Save changes and you will get Property Conversion error.

Another thing to note is that in database there are records with NULL value in "type" field, but QGIS shows them all as 0

#3 Updated by Alessandro Pasotti almost 2 years ago

  • Assignee set to Alessandro Pasotti

#4 Updated by Alessandro Pasotti almost 2 years ago

  • Status changed from Open to In Progress
  • Pull Request or Patch supplied changed from No to Yes
  • Affected QGIS version changed from 3.4.3 to 3.5(master)

This wasn't easy and I've fixed another bunch of issues along the way:
PR https://github.com/qgis/QGIS/pull/8958

#5 Updated by Uroš Preložnik almost 2 years ago

Thank you for this. I'll test it once it is merged and in nightly build.

#6 Updated by Alessandro Pasotti almost 2 years ago

  • % Done changed from 0 to 100
  • Status changed from In Progress to Closed

Also available in: Atom PDF