CREATE TABLE t0(c0 TEXT AS ('\\')); -- ERROR 1064 (42000): You have an error in your SQL syntax
Unexpectedly, the CREATE results in a syntax error:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.7.25-TiDB- TiDB Server (Apache License 2.0), MySQL 5.7 compatible
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> CREATE TABLE t0(c0 TEXT AS ('\\'));
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 10 near "'\'"
The escaped string should be parsed correctly, and is so in other contexts:
SELECT '\\'; -- {'\'}
This also works in, for example, MySQL 8.0.19:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 8.0.19 MySQL Community Server - GPL
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> CREATE TABLE t0(c0 TEXT AS ('\\'));
Query OK, 0 rows affected (0.03 sec)
I found this based on the latest master commit 187f225002b67daa47992816f6ef5ddb76b0f68a, and also checked that this reproduces on the 4.0 RC.
Consider the following statement:
Unexpectedly, the
CREATE
results in a syntax error:The escaped string should be parsed correctly, and is so in other contexts:
This also works in, for example, MySQL 8.0.19:
I found this based on the latest master commit 187f225002b67daa47992816f6ef5ddb76b0f68a, and also checked that this reproduces on the 4.0 RC.