You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug #27973409:GCOL: INCORRECT BEHAVIOR WITH STRING FUNCTION
Issue:
------
1) Create table with a string function to populate an
integer virtual generated column with an index on it.
2) INSERT IGNORE INTO t1(c1) VALUES ('');
The string function returns empty string because length
(last input parameter) is zero. It does this by
manipulating a length of the constant string input
parameter and setting it to zero.
It is important to remember that for generated columns,
Item_func_xxxx (the generated column's function) object is
created on the table's memroot and thus has a lifetime
beyond this statement (i.e. until the table is flushed).
So effectively this statement has corrupted the constant
string parameter and its length is now set to zero. And
will return incorrect results for subsequent statements.
This problem isn't restricted to generated columns and can
be seen in simple calls to the string functions also.
Solution:
---------
String functions shouldn't manipulate the lengths of input
parameters to return results. Create a new string, copy to
that location and manipulate the length there.
0 commit comments