Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong data type of fields when adding a Spatialite layer #24844

Closed
qgib opened this issue Jul 31, 2017 · 4 comments
Closed

Wrong data type of fields when adding a Spatialite layer #24844

qgib opened this issue Jul 31, 2017 · 4 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Data Provider Related to specific vector, raster or mesh data providers

Comments

@qgib
Copy link
Contributor

qgib commented Jul 31, 2017

Author Name: Etienne MORO (Etienne MORO)
Original Redmine Issue: 16945
Affected QGIS version: 2.18.11
Redmine category:data_provider/spatialite
Assignee: Julien Cabieces


Using the layer BATIMENT of my spatialite DB (file attached):

  1. If you look at the field properties, you can see that the field "coordX" has the type QString-TEXT, whereas in the spatialite DB, the type is FLOAT, so it should be considered by QGis as a DOUBLE (or REAL or NUMERIC) but not as a TEXT. This bug causes lots of problems if I try to create expressions using that field.
  2. If I try to add a new field choosing the type 'double', QGis save it with the type FLOAT, and I think this the origin of my first problem, because until then, QGis doesn't well recognize that type FLOAT.
    This bug appears in v2.14, and v2.18.

@qgib
Copy link
Contributor Author

qgib commented Aug 1, 2017

Author Name: Giovanni Manghi (@gioman)


It happens also on Linux, and curiously enough it does NOT happen if adding the layer by d&d from outside the QGIS main Window into QGIS.

Any other way (standard "add SL layer", DB Manager, Browser) lead to the issue.

As it really does not corrupts the data I cannot tag this as "high priority" unless is a regression from a previous QGIS version (and it may be the case, but can't try right now).


  • subject was changed from Problem managing types of fields using a spatialite layer to Wrong data type of fields when adding a Spatialite layer
  • crashes_corrupts_data was changed from 1 to 0
  • operating_system was changed from Windows 7 to
  • priority_id was changed from High to Normal
  • category_id was changed from Attribute table to Data Provider/SpatiaLite

@qgib
Copy link
Contributor Author

qgib commented Aug 3, 2017

Author Name: Etienne MORO (Etienne MORO)


After several tests, I think the real problem is that in a Spatialite DB, you've got a table named geometry_columns_field_infos which isn't correctly filled when you add a field in QGis.
When you create a new field of type REAL, in the table geometry_columns_field_infos, you should fill the field double_values with the total number of rows, instead of filling the field null_values, even if all the values are NULL (at the beginning). Because after, even if you fill all the rows of the new field with real values in QGis, the table named geometry_columns_field_infos is not changed (only the field null_values is filled).

I hope this explanation will help you to correct that problem. I understand it's not a blocking problem, but it's very annoying when you try to create new data in a spatialite DB with QGis.

@qgib
Copy link
Contributor Author

qgib commented Jan 14, 2019

Author Name: Julien Cabieces (Julien Cabieces)


Fixed in 3.4.2


  • assigned_to_id was configured as Julien Cabieces
  • status_id was changed from Open to Closed

@qgib qgib closed this as completed Jan 14, 2019
@qgib
Copy link
Contributor Author

qgib commented Jan 14, 2019

Author Name: Giovanni Manghi (@gioman)


  • resolution was changed from to fixed/implemented

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Data Provider Related to specific vector, raster or mesh data providers labels May 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Data Provider Related to specific vector, raster or mesh data providers
Projects
None yet
Development

No branches or pull requests

1 participant