Skip to content

Conversation

@maksimlikharev
Copy link

In some cases Redis clients do SELECT 0, even if no db explicitly specified.

Purpose of this PR to support SELECT 0 and return error if other value is provided.

@anujphadke
Copy link

With the change -
(env) anuj@anuj-VirtualBox:~/work/dynomite$ redis-cli -h 127.0.1.1 -p 8102
127.0.1.1:8102> SELECT 0 <<<<<<<< works now
OK
127.0.1.1:8102> SELECT 1
Error: Server closed the connection
127.0.1.1:8102> SELECT 2
Error: Server closed the connection
127.0.1.1:8102> SELECT 200000
Error: Server closed the connection
127.0.1.1:8102>

Without the change it rejected "SELECT 0"
(env) anuj@anuj-VirtualBox:~/work/dynomite$ redis-cli -h 127.0.1.1 -p 8102
127.0.1.1:8102> SELECT 0
Error: Server closed the connection
127.0.1.1:8102> SELECT 1
Error: Server closed the connection
127.0.1.1:8102> SELECT 3
Error: Server closed the connection
127.0.1.1:8102> quit;
Error: Server closed the connection
127.0.1.1:8102> quit

The code change looks fine to me.
@smukil - Can you take a final look at this change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants