a bug in SORT/STORE comand output #224

xrfang opened this Issue Dec 1, 2011 · 2 comments


None yet

2 participants

xrfang commented Dec 1, 2011

with the SORT param, the SORT command usually output an integer, indicating the number of items in the stored set, but when output is null, for example, the key to be sorted does not exist (or is empty), the output of SORT with STORE is empty set, not a number anymore! I think it shall be consistent, i.e. without STORE, bulk output (or empty), with STORE, integer output (including 0).

antirez commented Dec 1, 2011

Verified, definitely a bug. There is an additional one I discovered just now looking at the code:

redis> flushall
redis> lpush foo bar
(integer) 1
redis> sort foo limit 10 10 store zap
(integer) 0
redis> keys *
1) "zap"
2) "foo"
redis> llen za
(integer) 0

A key with an empty list was just created, that is not coherent with the Redis behavior of deleting keys without elements.

Fixing both, thanks for reporting.

antirez commented Dec 1, 2011

Fixed both into unstable and 2.4, thanks.

@antirez antirez closed this Dec 1, 2011
@JackieXie168 JackieXie168 pushed a commit to JackieXie168/redis that referenced this issue Aug 29, 2016
@antirez Fixed SORT bugs (issue #224) with regression tests. 0371907
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment