summaryrefslogtreecommitdiff
path: root/src/commands.c
diff options
context:
space:
mode:
authorBinbin <binloveplay1314@qq.com>2022-10-23 01:41:17 +0800
committerGitHub <noreply@github.com>2022-10-22 20:41:17 +0300
commit9e1b879f5bcbf105d5581c77f8c368b0ef1708f6 (patch)
treed5507669bcd33f522078388c1e07108740e5906d /src/commands.c
parent6dd213558b0f77e2233743718e23556fb06a557e (diff)
downloadredis-9e1b879f5bcbf105d5581c77f8c368b0ef1708f6.tar.gz
Make PFMERGE source key optional in docs, add tests with one input key, add tests on missing source keys (#11205)
The following two cases will create an empty destkey HLL: 1. called with no source keys, like `pfmerge destkey` 2. called with non-existing source keys, like `pfmerge destkey non-existing-source-key` In the first case, in `PFMERGE`, the dest key is actually one of the source keys too. So `PFMERGE k1 k2` is equivalent to `SUNIONSTORE k1 k1 k2`, and `PFMERGE k1` is equivalent to `SUNIONSTORE k1 k1`. So the first case is reasonable, the source key is actually optional. And the second case, `PFMERGE` on missing keys should succeed and create an empty dest. This is consistent with `PFCOUNT`, and also with `SUNIONSTORE`, no need to change.
Diffstat (limited to 'src/commands.c')
-rw-r--r--src/commands.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/commands.c b/src/commands.c
index 5ee012c79..b9b4b915d 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -2608,7 +2608,7 @@ struct redisCommandArg PFDEBUG_Args[] = {
/* PFMERGE argument table */
struct redisCommandArg PFMERGE_Args[] = {
{"destkey",ARG_TYPE_KEY,0,NULL,NULL,NULL,CMD_ARG_NONE},
-{"sourcekey",ARG_TYPE_KEY,1,NULL,NULL,NULL,CMD_ARG_MULTIPLE},
+{"sourcekey",ARG_TYPE_KEY,1,NULL,NULL,NULL,CMD_ARG_OPTIONAL|CMD_ARG_MULTIPLE},
{0}
};