The row data used by table browser is cast to string before doing any sorting.
That is required in the 'flat format' because here numerical and categorical data are mixed in the 'value' column.
In the 'by measurement' format however we have one data type per field.
However the the code for the 'flat' case is re-used. As a result all values
are sorted alphabetical even if they are clearly numerical, e.g. we get
the incorrect sorting [10, 11, 9] instead of the expected [9, 10, 11].
To fix that we need to move form the union clause used with flat case to
a multiple self-join.
The row data used by table browser is cast to string before doing any sorting. That is required in the 'flat format' because here numerical and categorical data are mixed in the 'value' column.
In the 'by measurement' format however we have one data type per field. However the the code for the 'flat' case is re-used. As a result all values are sorted alphabetical even if they are clearly numerical, e.g. we get the incorrect sorting [10, 11, 9] instead of the expected [9, 10, 11].
To fix that we need to move form the union clause used with flat case to a multiple self-join.