• Binbin's avatar
    zrangeGenericCommand add check for negative offset (#9052) · d9c2ef8a
    Binbin authored
    Now we will check the offset in zrangeGenericCommand.
    With a negative offset, we will throw an error and return.
    
    This also resolve the issue of zeroing the destination key
    in case of the "store" variant when we input a negative offset.
    ```
    127.0.0.1:6379> set key value
    OK
    127.0.0.1:6379> zrangestore key myzset 0 10 byscore limit -1 10
    (integer) 0
    127.0.0.1:6379> exists key
    (integer) 0
    ```
    
    This change affects the following commands:
    - ZRANGE / ZRANGESTORE / ZRANGEBYLEX / ZRANGEBYSCORE
    - ZREVRANGE / ZREVRANGEBYSCORE / ZREVRANGEBYLEX
    d9c2ef8a
t_zset.c 149 KB