tidb-challenge-program/bug-hunting-issue

P1-[4.0 bug hunting]-[SQL Plan Management]-Fetching from a view with an escaped backslash results in an unexpected syntax error

Opened this issue · 1 comments

Consider the following statements:

CREATE VIEW v0(c0) AS SELECT '\\';
SELECT * FROM v0; -- ERROR 1105 (HY000): line 1 column 10 near "'\'"

Unexpectedly, the SELECT results in a syntax error:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
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 VIEW v0(c0) AS SELECT '\\';
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT * FROM v0; -- ERROR 1105 (HY000): line 1 column 10 near "'\'"
ERROR 1105 (HY000): line 1 column 10 near "'\'" 

I found this issue based on commit c00384f77788102752f56c609156d451d0ea2426 and can also reproduce it on the 4.0 RC.

This bug seems related to #53, where a backslash in a generated column results in an error.

/bug P2