-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
builtin: add random-bytes function #2927
Conversation
@bom-d-van |
plan/typeinferer_test.go
Outdated
@@ -249,6 +249,7 @@ func (ts *testTypeInferrerSuite) TestInferType(c *C) { | |||
{`sha1(123)`, mysql.TypeVarString, "utf8"}, | |||
{`sha(123)`, mysql.TypeVarString, "utf8"}, | |||
{`sha2(123, 256)`, mysql.TypeVarString, charset.CharsetUTF8}, | |||
{`random_bytes(32)`, mysql.TypeInt24, charset.CharsetBin}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be mysql.TypeVarString
, charset.CharsetBin
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed! :)
@bom-d-van
|
@coocood Sorry for that, it should be alright now. Thanks! |
LGTM |
f, err = fc.getFunction(datumsToConstants([]types.Datum{types.NewDatum(1025)}), s.ctx) | ||
c.Assert(err, IsNil) | ||
_, err = f.eval(nil) | ||
c.Assert(err, Not(IsNil)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use NotNil instead of Not(IsNil).
return d, nil | ||
} | ||
size := arg.GetInt64() | ||
if size < 1 || size > 1024 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MySQL returns the following error code and error message
"mysql> select RANDOM_BYTES(2048);
ERROR 1690 (22003): length value is out of range in 'random_bytes'"
Please use standard error code or add a TODO comment here (Then we will fix it latter.).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have changed it as you suggested. Thanks. :)
LGTM |
No description provided.