Bug report #14715
QGIS Server sending sometimes UPDATE… WHERE NULL to postgis in a WFS-T if primary key of table is Numeric
|Affected QGIS version:||2.14.1||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:||duplicate|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||22675|
You can see the description of the problem and all the tests I have made during last months here:
Finally, Matthias Kuhn, one of the developers of QGIS gave me the key to solve the problem.
The WHERE clause is built checking the type of the primary key of the table. It should be an Integer and in some of my tables I saw that the type was Numeric(8,0).
Those tables and primary keys were created by a third-party app some time ago.
I changed the type to Integer and all the tests I have made since then have worked (I have made more than 100 edition tests via WFS, enough in my opinion to conclude that the problem have been solved).
Conclusion: if the primary key of a postgis table is Numeric, the where clause of the WFS-T UPDATE query to Postgis is sometimes null (Where Null) and therefore, nothing is updated.