Describe the bug
Appending "" to an empty key creates an empty string. To my knowledge, a string with an empty value is equivalent to a nil value in redis so the value should not be created.
To reproduce
Append an empty string to a missing key.
127.0.0.1:6379> type x
none
127.0.0.1:6379> append x ""
(integer) 0
127.0.0.1:6379> type x
string
Expected behavior
No key should be created.
127.0.0.1:6379> type x
none
127.0.0.1:6379> append x ""
(integer) 0
127.0.0.1:6379> type x
none
Additional information
Using redis 6.2.5.
Comment From: mgravell
Conversely, though:
127.0.0.1:6379> type x
none
127.0.0.1:6379> exists x
(integer) 0
127.0.0.1:6379> get x
(nil)
127.0.0.1:6379> set x ""
OK
127.0.0.1:6379> type x
string
127.0.0.1:6379> exists x
(integer) 1
127.0.0.1:6379> get x
""
An empty string can exist and have a type.
Comment From: sundb
@braddunbar An empty string is not the same as null, which is allowed in redis.
Comment From: braddunbar
Huh…I was really wrong about that. Thanks @sundb and @mgravell! I'll close this and continue on then. 😆