Bug #101368 charset assignment does not take any effect in str2my_decimal
Submitted: 29 Oct 2020 7:36 Modified: 29 Oct 2020 12:57
Reporter: Li Zhong Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any

[29 Oct 2020 7:36] Li Zhong
Description:
In sql/my_decimal.cc str2my_decimal(uint mask, const char *from, size_t length, const CHARSET_INFO *charset, my_decimal *decimal_value):
 
Line 251:     charset = &my_charset_bin;

This assignment does not truly assign where charset points to with my_charset_bin (which should have been *charset = my_charset_bin). 

On the other hand, if regarding it as a value assignment, the value of charset itself no longer get used in this function, which is strange.

How to repeat:
In source code of mysql-8.0.21
[29 Oct 2020 12:57] MySQL Verification Team
Hi Mr. Zhong,

Thank you for your bug report.

However, this is not a bug.

The described assignment is there to reset the parameter to its default value. Since the left side in question is a pointer to the structure of the same type as the right value, it makes lots of sense.

Not a bug.