-
Notifications
You must be signed in to change notification settings - Fork 23.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] TYPE command does not return a string in LUA #11413
Comments
This is indeed a very strange problem, and it look like it has always been there, i guess it is because TYPE did not return the "simple string" like GET in this case, you can get the right result, by using
let see what @MeirShpilraien would suggest, PTAL |
i'd like to call @itamarhaber to take a look too |
If the result is indeed in dummyType['ok'] and this issue has been there forever, maybe it is better to just document it instead of potentially breaking scripts? I also found another inconsistent behavior, if you use redis.pcall on for example "ZADD", it returns an int if it succeeds and a table with 'err' if it fails. But this is not the same behavior as the example in the documentation where the command 'ECHO' is used, which always returns a table. |
As far as I understand, the idea was to distinguish between bulk string reply and simple string reply. I guess that bulk string reply are simply converted to Lua string because it is more common and simple string are returned as a Lua table with |
Indeed - simple strings are converted from RESP to Lua as such, and I agree this isn't ideal, but it has been this way for a long time, so changing the behavior now isn't recommended. |
@itamarhaber what do client libraries usually do with simple string return? |
Describe the bug
The TYPE command is supposed to return a string with the type of the key.
When called from a LUA script, the command does not return a string, it returns an empty table instead.
To reproduce
Just run this code and see the results:
Expected behavior
It should return a string, in this case the string "list"
Additional information
Works well if called directly on the redis-cli but not within a LUA script.
The text was updated successfully, but these errors were encountered: