In MySQL at least, the set of [[Allows value:=xyz]] special properties is not
necessarily stored in smw_specialprops in the same order as they appear on the
attribute's page. Thus they aren't retrieved in the same order, so values of
that attribute get a semi-random integer value in smw_attributes. This means
queries that sort on an enumerated attribute or query for attribute values
greater or less than an enumerated value don't work.
Steps to reproduce:
- I edited an existing attribute and gave it a new set of [[Allows value]]
- I looked at smw_specialprops and noticed MySQL stored the set of properties
in a different order.
- I queried on this attribute with a sort by it and confirmed that articles
appeared in the wrong order.
I think the fix is
a) in addSpecialValue() increment a per special-property sequence number for
each value of a special property that's an attribute,
b) store this in a new sequence column in smw_specialprops
c) when retrieving special properties order by this sequence column.
But it's not that easy. Currently addSpecialValue() doesn't simply append each
[[Allows value]] property value to an array, it creates a hash of special
properties indexed by each value's getHash() function.