Now SORT returns an empty bulk reply if the key does not exist
This commit is contained in:
parent
04c71068a8
commit
d922ae6592
2
redis.c
2
redis.c
@ -4839,7 +4839,7 @@ static void sortCommand(redisClient *c) {
|
|||||||
/* Lookup the key to sort. It must be of the right types */
|
/* Lookup the key to sort. It must be of the right types */
|
||||||
sortval = lookupKeyRead(c->db,c->argv[1]);
|
sortval = lookupKeyRead(c->db,c->argv[1]);
|
||||||
if (sortval == NULL) {
|
if (sortval == NULL) {
|
||||||
addReply(c,shared.nokeyerr);
|
addReply(c,shared.nullmultibulk);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (sortval->type != REDIS_SET && sortval->type != REDIS_LIST &&
|
if (sortval->type != REDIS_SET && sortval->type != REDIS_LIST &&
|
||||||
|
@ -962,6 +962,10 @@ proc main {server port} {
|
|||||||
$r sort mylist BY weight_* GET #
|
$r sort mylist BY weight_* GET #
|
||||||
} {2 1 3}
|
} {2 1 3}
|
||||||
|
|
||||||
|
test {SORT with constant GET} {
|
||||||
|
$r sort mylist GET foo
|
||||||
|
} {{} {} {}}
|
||||||
|
|
||||||
test {LREM, remove all the occurrences} {
|
test {LREM, remove all the occurrences} {
|
||||||
$r flushdb
|
$r flushdb
|
||||||
$r rpush mylist foo
|
$r rpush mylist foo
|
||||||
|
Loading…
x
Reference in New Issue
Block a user