Bug report #11809
Datatype of computed columns falls back to text
|Affected QGIS version:||master||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:||end of life|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||20033|
When loading SpatiaLite layers, types of computed columns are incorrect. For example, consider a table with an integer id column. A layer is added with the following SQL expression:
SELECT id, MAX(id) AS max_id, geom FROM the_table
On examining the column datatypes in Layer Properties -> Fields, field
id is integer type, but
max_id is TEXT.
Further, explicitly casting the datatype doesn't work either. ie.
SELECT id, CAST(MAX(id) AS INTEGER), geom AS max_id FROM the_table
returns exactly the same datatypes.
This bug makes it impossible to apply (for example) graduated styles to the layer based on the computed column.
#4 Updated by Giovanni Manghi almost 7 years ago
- OS version deleted (
- Category changed from DB Manager to Data Provider/SpatiaLite
- Operating System deleted (
Samuel Ingarfield wrote:
This happens both when
a) Using the 'Load as New Layer' function of DB Manager; and
b) Adding layer through Python (using
did it happen in previous qgis releases?
#8 Updated by Samuel Ingarfield almost 7 years ago
Matthias Kuhn wrote:
Can you provide the python code you use and a test dataset?
Giovanni Manghi wrote:
the import bit here (to say if it is a regression or not) is if it the bug was present in older qgis releases (2.4/2.2/2.0.1/1.8).
Will test in an earlier version this afternoon.
#12 Updated by Giovanni Manghi almost 3 years ago
- Status changed from Open to Closed
- Resolution set to end of life
End of life notice: QGIS 2.18 LTR