liberapay.com icon indicating copy to clipboard operation
liberapay.com copied to clipboard

Sorting mixed-currency amounts in SQL produces wrong result

Open Changaco opened this issue 6 years ago • 5 comments

Our comparison functions raise an error when currencies don't match, but postgres appears to fall back to comparing the underlying tuples, so we end up with $11 being sorted higher than €10.

Changaco avatar Feb 15 '18 10:02 Changaco

Now that we handle 33 currencies, including quite a few with exchange rates of a much greater amplitude than EUR↔USD, this bug is going to become more problematic.

Changaco avatar Jan 28 '19 13:01 Changaco

Is this the reason for the mis-sort on /explore/individuals? Yen are much smaller than EUR.

image

mattbk avatar Feb 12 '19 16:02 mattbk

Yep.

Changaco avatar Feb 12 '19 16:02 Changaco

I was unable to fix the sorting bug so I worked around it instead.

Changaco avatar Feb 12 '19 17:02 Changaco

unblocked

ayeshasiddika9196 avatar Aug 18 '21 02:08 ayeshasiddika9196