qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.34k stars 2.98k forks source link

"sort" funcionality of attributes table sort numeric fields as text #34935

Closed gioman closed 2 years ago

gioman commented 4 years ago

3.10.3 and 3.12

Add the "alaska" shapefile from the QGIS sample dataset

Open the attribute table and use the "sort" function to sort the records using the "cat" field, that is of type integer.

The records will be ordered as expected.

Save the project.

Close the project and reopen it, open the attribute table > records are ordered as the "cat" column was of type text (i.e. 1,10,100,11,110,111...).

roya0045 commented 4 years ago

If you have a few moment could you test to see if this https://github.com/roya0045/QGIS_1/actions/runs/68192864 solves this issue?

gioman commented 3 years ago

Close the project and reopen it, open the attribute table > records are ordered as the "cat" column was of type text (i.e. 1,10,100,11,110,111...).

or just close and reopen the table. Still a bug in the latest master.

gioman commented 3 years ago

Still true on the latest master, also with a PostGIS table.

MrChebur commented 2 years ago

Bug confirmed with PostgreSQL database with PostGIS extension and geopackage file. QGIS version 3.22.2-Białowieża QGIS code revision 1601ec46d0

Manual sorting by clicking on the field name sorts as expected, but using the sort function (in the context menu) does not work correctly. Testet with integer and data types.

Here is data for tesing and the video: test_sorting.zip

test_sorting_video

gubuntu commented 1 month ago

This appears to still be an issue, here sorted ascending on a 32 bit int field.

Screenshot 2024-08-12 at 14 03 56

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">

QGIS version | 3.38.0-Grenoble | QGIS code revision | 4a3e4e10a4f -- | -- | -- | -- Qt version | 5.15.2 Python version | 3.9.5 GDAL/OGR version | 3.3.2 PROJ version | 8.1.1 EPSG Registry database version | v10.028 (2021-07-07) GEOS version | 3.9.1-CAPI-1.14.2 SQLite version | 3.35.2 PDAL version | 2.3.0 PostgreSQL client version | unknown SpatiaLite version | 5.0.1 QWT version | 6.1.6 QScintilla2 version | 2.11.5 OS version | macOS 12.7   |   |   |   Active Python plugins dataset_qa_workbench | 0.7.1 quick_map_services | 0.19.34 nominatim | 1.4.5 qgis_stac | 1.1.2 planet_explorer | 2.3.4 qfieldsync | v4.9.1 qgis_geonode | 1.0.1 qgis_resource_sharing | 1.0.0 create_layer_from_selected_features | 1.2 Projestions | 1.0.1 Mergin | 2024.2 sg-diagram-downloader | 3.2 processing | 2.12.99 grassprovider | 2.12.99 db_manager | 0.1.20 MetaSearch | 0.3.6 QGIS version 3.38.0-Grenoble QGIS code revision [4a3e4e10a4f](https://github.com/qgis/QGIS/commit/4a3e4e10a4f) Qt version 5.15.2 Python version 3.9.5 GDAL/OGR version 3.3.2 PROJ version 8.1.1 EPSG Registry database version v10.028 (2021-07-07) GEOS version 3.9.1-CAPI-1.14.2 SQLite version 3.35.2 PDAL version 2.3.0 PostgreSQL client version unknown SpatiaLite version 5.0.1 QWT version 6.1.6 QScintilla2 version 2.11.5 OS version macOS 12.7 Active Python plugins dataset_qa_workbench 0.7.1 quick_map_services 0.19.34 nominatim 1.4.5 qgis_stac 1.1.2 planet_explorer 2.3.4 qfieldsync v4.9.1 qgis_geonode 1.0.1 qgis_resource_sharing 1.0.0 create_layer_from_selected_features 1.2 Projestions 1.0.1 Mergin 2024.2 sg-diagram-downloader 3.2 processing 2.12.99 grassprovider 2.12.99 db_manager 0.1.20 MetaSearch 0.3.6
agiudiceandrea commented 1 month ago

@gubuntu, please create a new issue report providing all the requested info and detailed exact steps and data in order to replicate the issue.