Bug #107109 | Optimizer hints doesn't work if client charset is the same with charset of syste | ||
---|---|---|---|
Submitted: | 24 Apr 2022 9:07 | Modified: | 6 Jun 2022 7:12 |
Reporter: | Brian Yue (OCA) | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Parser | Severity: | S2 (Serious) |
Version: | 8.0.27, 5.7.37, 8.0.32 | OS: | Any (rhel-7.4) |
Assigned to: | CPU Architecture: | Any (x86-64) | |
Tags: | charset, Contribution, Optimizer hints |
[24 Apr 2022 9:07]
Brian Yue
[24 Apr 2022 12:43]
MySQL Verification Team
Hello Brian Yue, Thank you for the report and feedback. regards, Umesh
[6 Jun 2022 7:12]
Brian Yue
this bug is fixed like this (basing on version MySQL8.0.25): diff --git a/include/typelib.h b/include/typelib.h index c979dc1..e26c15c 100644 --- a/include/typelib.h +++ b/include/typelib.h @@ -52,7 +52,11 @@ extern int find_type_or_exit(const char *x, TYPELIB *typelib, /** makes @c find_type() treat ',' as terminator */ #define FIND_TYPE_COMMA_TERM (1 << 3) -extern int find_type(const char *x, const TYPELIB *typelib, unsigned int flags); +extern int find_type(const char *x, const TYPELIB *typelib, unsigned int flags + , const char *end = nullptr +); extern const char *get_type(TYPELIB *typelib, unsigned int nr); extern TYPELIB *copy_typelib(MEM_ROOT *root, TYPELIB *from); diff --git a/mysys/typelib.cc b/mysys/typelib.cc index ae0b8e0..c8fdc48 100644 --- a/mysys/typelib.cc +++ b/mysys/typelib.cc @@ -83,7 +83,11 @@ int find_type_or_exit(const char *x, TYPELIB *typelib, const char *option) { >0 Offset+1 in typelib for matched string */ -int find_type(const char *x, const TYPELIB *typelib, uint flags) { +int find_type(const char *x, const TYPELIB *typelib, uint flags + , const char *end +) { int find, pos; int findpos = 0; /* guarded by find */ const char *i; @@ -107,7 +111,11 @@ int find_type(const char *x, const TYPELIB *typelib, uint flags) { ; if (!*j) { while (*i == ' ') i++; /* skip_end_space */ - if (!*i || ((flags & FIND_TYPE_COMMA_TERM) && is_field_separator(*i))) + if (!*i || ((flags & FIND_TYPE_COMMA_TERM) && is_field_separator(*i)) + || i == end + ) return pos + 1; } if ((!*i && (!(flags & FIND_TYPE_COMMA_TERM) || !is_field_separator(*i))) && @@ -252,7 +260,11 @@ static TYPELIB on_off_default_typelib = { static int parse_name(const TYPELIB *lib, const char **strpos, const char *end) { const char *pos = *strpos; - int find = find_type(pos, lib, FIND_TYPE_COMMA_TERM); + int find = find_type(pos, lib, FIND_TYPE_COMMA_TERM + , end + ); for (; pos != end && *pos != '=' && *pos != ','; pos++) ; *strpos = pos;
[6 Jun 2022 13:50]
Brian Yue
basing on MySQL8025 (*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.
Contribution: bug-fix_107109.txt (text/plain), 2.07 KiB.
[6 Jun 2022 14:09]
MySQL Verification Team
Thank you for your contribution.