Bug #109956 Print PARTITION_EXPRESSION and SUBPARTITION_EXPRESSION as an identifier enclosed
Submitted: 7 Feb 2023 9:43 Modified: 7 Feb 2023 13:46
Reporter: peng Wang 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

[7 Feb 2023 9:43] peng Wang
Description:
Set sql_mode is ANSI_QUOTES, and then create a table with partition_options maybe cause a problem that PARTITION_EXPRESSION and SUBPARTITION_EXPRESSION in information_schema.partitions are wrapped in double quotes.

How to repeat:
(1)set sql_mode = ANSI_QUOTES;
(2)create database mydb_test;
(3)
create table mydb_test.t30 (a int, b char(10), c varchar(5), d int)
partition by range columns(a,b,c)
subpartition by key (c,d)
subpartitions 3
( partition p0 values less than (1,'abc','abc'),
  partition p1 values less than (2,'abc','abc'),
  partition p2 values less than (3,'abc','abc'),
  partition p3 values less than (4,'abc','abc'));
(4)
mysql> select PARTITION_EXPRESSION,SUBPARTITION_EXPRESSION from information_schema.partitions where TABLE_SCHEMA = 'mydb_test' and TABLE_NAME = 't30';
+----------------------+-------------------------+
| PARTITION_EXPRESSION | SUBPARTITION_EXPRESSION |
+----------------------+-------------------------+
| "a","b","c"          | "c","d"                 |
| "a","b","c"          | "c","d"                 |
| "a","b","c"          | "c","d"                 |
| "a","b","c"          | "c","d"                 |
| "a","b","c"          | "c","d"                 |
| "a","b","c"          | "c","d"                 |
| "a","b","c"          | "c","d"                 |
| "a","b","c"          | "c","d"                 |
| "a","b","c"          | "c","d"                 |
| "a","b","c"          | "c","d"                 |
| "a","b","c"          | "c","d"                 |
| "a","b","c"          | "c","d"                 |
+----------------------+-------------------------+
12 rows in set (0.01 sec)
(5)set sql_mode = STRICT_TRANS_TABLES;
(6)
mysql> select PARTITION_EXPRESSION,SUBPARTITION_EXPRESSION from information_schema.partitions where TABLE_SCHEMA = 'mydb_test' and TABLE_NAME = 't30';
+----------------------+-------------------------+
| PARTITION_EXPRESSION | SUBPARTITION_EXPRESSION |
+----------------------+-------------------------+
| "a","b","c"          | "c","d"                 |
| "a","b","c"          | "c","d"                 |
| "a","b","c"          | "c","d"                 |
| "a","b","c"          | "c","d"                 |
| "a","b","c"          | "c","d"                 |
| "a","b","c"          | "c","d"                 |
| "a","b","c"          | "c","d"                 |
| "a","b","c"          | "c","d"                 |
| "a","b","c"          | "c","d"                 |
| "a","b","c"          | "c","d"                 |
| "a","b","c"          | "c","d"                 |
| "a","b","c"          | "c","d"                 |
+----------------------+-------------------------+
12 rows in set (0.01 sec)

Suggested fix:
Print PARTITION_EXPRESSION and SUBPARTITION_EXPRESSION as an identifier enclosed with "`" instead of double quotes.
[7 Feb 2023 13:46] MySQL Verification Team
Hi Mr. Wang,

Thank you for your bug report.

The SQL option of ANSI_QUOTES is intended only for the entry of data. It is not intended for the presentation of data in the information schema. Hence, our server behaves in according with standards and with our own Reference Manual.

What you would like to see would be another option for the SQL mode, which is closed for further additions.

Not a bug.