From d922ae6592228851d3a5b93ce9b3e22be31caddc Mon Sep 17 00:00:00 2001 From: antirez Date: Fri, 18 Dec 2009 09:06:53 -0500 Subject: [PATCH] Now SORT returns an empty bulk reply if the key does not exist --- redis.c | 2 +- test-redis.tcl | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/redis.c b/redis.c index 274dec7a..91c28a0c 100644 --- a/redis.c +++ b/redis.c @@ -4839,7 +4839,7 @@ static void sortCommand(redisClient *c) { /* Lookup the key to sort. It must be of the right types */ sortval = lookupKeyRead(c->db,c->argv[1]); if (sortval == NULL) { - addReply(c,shared.nokeyerr); + addReply(c,shared.nullmultibulk); return; } if (sortval->type != REDIS_SET && sortval->type != REDIS_LIST && diff --git a/test-redis.tcl b/test-redis.tcl index 665d2bbf..c5f15bfb 100644 --- a/test-redis.tcl +++ b/test-redis.tcl @@ -962,6 +962,10 @@ proc main {server port} { $r sort mylist BY weight_* GET # } {2 1 3} + test {SORT with constant GET} { + $r sort mylist GET foo + } {{} {} {}} + test {LREM, remove all the occurrences} { $r flushdb $r rpush mylist foo -- 2.45.2