Describe the bug
SCAN 0 MATCH does not yield any results when using binary match patterns. On the other hand KEYS returns the correct results with the same pattern
To reproduce
From the CLI:
127.0.0.1:6379> get "\x01\x00"
"hello"
127.0.0.1:6379> keys "\x01*"
1) "\x01\x00"
127.0.0.1:6379> scan 0 MATCH "\x01*"
1) "3328"
2) (empty array)
Or, using Rust:
let mut pattern = Vec::with_capacity(prefix.len() + 1);
pattern.extend_from_slice(prefix);
pattern.push(b'*');
let (cursor, keys): (u64, Vec<Vec<u8>>) = redis::cmd("SCAN")
.cursor_arg(0)
.arg("MATCH")
.arg(&pattern)
.arg("COUNT")
.arg(1000)
.query_async(conn)
.await
.unwrap();
Expected behavior
Same result as with KEYS.
Comment From: mdecimus
Fixed: Although 0 results are returned, the next iteration on the cursor fetches the results.