Bug #113350 | SELECT contain NULL values,not return result | ||
---|---|---|---|
Submitted: | 6 Dec 2023 9:58 | Modified: | 6 Dec 2023 11:09 |
Reporter: | HULONG CUI | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 8.0.26 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[6 Dec 2023 9:58]
HULONG CUI
[6 Dec 2023 11:09]
MySQL Verification Team
Hi Mr. CUI, Thank you for your bug report. However, this is not a bug. We ran your test case and we have got the following results: ------------------------------------------ id parent_role_id 15 0 roleId ( SELECT @r := parent_role_id FROM cms_role WHERE id = parent_role_id ) 15 NULL Level Code Message Warning 1287 Setting user variables within expressions is deprecated and will be removed in a future release. Consider alternatives: 'SET variable=expression, ...', or 'SELECT expression(s) INTO variables(s)'. Warning 1287 Setting user variables within expressions is deprecated and will be removed in a future release. Consider alternatives: 'SET variable=expression, ...', or 'SELECT expression(s) INTO variables(s)'. ------------------------------------------ Our Reference clearly states that the evaluation of fields in the SELECT list is NOT guaranteed. That is how SQL Standard stipulates handling of user variables. However, if you follow the standard and initalize the local variable (which is what our warnings have clearly instructed you to do, you get the following output: ------------------------------------- id parent_role_id 15 0 roleId ( SELECT parent_role_id FROM cms_role WHERE id = parent_role_id ) 1 NULL ------------------------------------ Simply, when writing query follow SQL standard and our Reference Manual. Also, show all warnings after each SQL statement. Not a bug.