Bug #78796 | @Value IS NULL assumed to always return FALSE in "Insert" complex expression. | ||
---|---|---|---|
Submitted: | 11 Oct 2015 17:01 | Modified: | 18 Oct 2015 22:54 |
Reporter: | Sergei Kaufman | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: Command-line Clients | Severity: | S3 (Non-critical) |
Version: | 5.5.44-0ubuntu0.14.04.1 (Ubuntu) | OS: | Linux (Ubuntu LTS 14.04) |
Assigned to: | CPU Architecture: | Any |
[11 Oct 2015 17:01]
Sergei Kaufman
[12 Oct 2015 16:02]
MySQL Verification Team
Hi Sergei, Thank you for your bug report. However, it turns out that this is not a bug. Our server is behaving exactly as designed, which is based on current SQL standard. If you read our manual you will find that it says for INSERT: "Returns NULL if any argument is NULL.". Not a bug.
[18 Oct 2015 22:47]
Sergei Kaufman
Description: At mysql client response to typed expression was: mysql> set @Value = null; Query OK, 0 rows affected (0.00 sec) mysql> set @A = 0; Query OK, 0 rows affected (0.00 sec) mysql> set @B = 0; Query OK, 0 rows affected (0.00 sec) mysql> mysql> set @Value = insert(@Value,(select if(@Value IS NULL,1,(length(@Value)+1))),1,case 1 when @A > @B then 'a' when @A = @B then 'b' when @A < @B then 'c' end); Query OK, 0 rows affected (0.00 sec) mysql> mysql> select @Value; +--------+ | @Value | +--------+ | NULL | +--------+ 1 row in set (0.00 sec) mysql it is possible to return null by this condition, but as i said before - this is not a simple expression, which consists from insert(), select if() and case flow when insert() function is the result of two above .. so by the logic it should return true or false but not NULL or anyway 'FALSE'
[18 Oct 2015 22:54]
Sergei Kaufman
What is the logic of returning NULL at complex expression ?
[19 Oct 2015 13:16]
MySQL Verification Team
@Value is NULL. @Value is the first argument of the INSERT() function. Hence, if you read my reply, NULL has to be returned. Regarding the logic, we follow SQL standards on this matter. Anyway, logic is irrelevant. This is not a bug as everything works just as designed and it will not be changed !!!