QGIS – Sorting by Attributes Does Not Work in GPKG Files

geopackageqgissorting

enter image description hereSince I updated from QGIS 3.16 to 3.22 I have the following problem in attribute tables: in gpkg files the sorting option (alphabetical) does not work – sometimes!

I tried it with projects in qgz- or qgs-format. It happens with point-layers and with polygon layers.

Mostly the problem occurs in gpkg layers, seldom also in shapefiles. The problem only happens in string fields, not in integer/real fields. What is the problem, is it a bug?

Now I added a screenshot. In my OS ubuntu 20.04 up to QGIS 3.16 I sorted by single click, everytime it worked, when I clicked single on the top of a field in the attribute table. Now for example in this table a single click (or double click) works for the field "name_lat", but not for the field "name_d", neither with "jahr". All three fields are string fields. With fid it works.

Now I tried another way: there is a possibility for sorting, but more complicated. When I click on the top of the attribute table, choose context menu, choose sorting. Then I can choose the field for sorting the attribute table. So it works, but it is really complicated. Up to QGIS 3.16 it worked just by one click on the field name that is relevant for me.

Look here https://github.com/qgis/QGIS/issues/47613

Best Answer

The bug is fixed in QGIS 3.22.5.