Bug #110536 | Confusion about select null handling | ||
---|---|---|---|
Submitted: | 29 Mar 2023 2:59 | Modified: | 29 Mar 2023 12:22 |
Reporter: | chaizhigang chai | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 5.7+ or 8.0+ | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[29 Mar 2023 2:59]
chaizhigang chai
[29 Mar 2023 12:22]
MySQL Verification Team
Hi Mr. chai, Thank you for your bug report. However, it is not a bug. In the second example, when sql_mode is empty, MySQL has to treat SELECT NULL as part of the expression in the INSERT statement. INSERT ...... (from) ....... SELECT ...... is not covered by SQL standards, so we chose to treat is an expression. Since sql_mode is empty, MySQL converts that expression to the nearest one for the CHAR / VARCHAR domain. In short, this is expected behaviour. BTW, it is not recommended to play with sql_mode, since it might lead to unexpected results. Not a bug.