Bug #94613 The quote function returns the wrong answer with "group by".
Submitted: 10 Mar 2019 2:36 Modified: 12 Mar 2019 9:08
Reporter: Hope Lee (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S2 (Serious)
Version:8.0.15-rds-dev, 8.0.15 OS:CentOS
Assigned to: CPU Architecture:Any
Tags: regression

[10 Mar 2019 2:36] Hope Lee
Description:
The quote function returns the wrong answer with "group by".

How to repeat:
mysql> CREATE TABLE test_table3 (
       id bigint(20) NOT NULL,
       char_test char(1) DEFAULT NULL,
       PRIMARY KEY (id)) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
mysql> INSERT INTO test_table3 values(1, NULL);
mysql> select quote(char_test) from test_table3;
+------------------+
| quote(char_test) |
+------------------+
| NULL             |
+------------------+
1 row in set (0.00 sec)
mysql> select quote(char_test) as col1 from test_table3 group by col1;
+------+
| col1 |
+------+
| NUL  |
+------+
1 row in set (0.00 sec)
[10 Mar 2019 5:27] MySQL Verification Team
Hello Lee,

Thank you for the report and test case.

regards,
Umesh
[12 Mar 2019 9:08] Jon Olav Hauglid
Fixed in 8.0.16 by the patch for Bug#94108