Tidb: Digest text changes SQL semantic

Created on 31 Jul 2020  路  3Comments  路  Source: pingcap/tidb

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

Execute SQL statement:

SELECT SUM(TABLE_ROWS) FROM INFORMATION_SCHEMA.TABLES;

2. What did you expect to see? (Required)

Expect a statement digest text that does not have syntax errors, like

SELECT SUM(TABLE_ROWS) FROM INFORMATION_SCHEMA.TABLES

in INFORMATION_SCHEMA.CLUSTER_STATEMENTS_SUMMARY_HISTORY table.

3. What did you see instead (Required)

select sum ( table_rows ) from information_schema . tables

Note that this SQL statement will throw syntax error:

1064 - 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 12 near "( table_rows ) from information_schema . tables" , Time: 0.000000s

4. Affected version (Required)

My version is v4.0.2

5. Root Cause Analysis

componenparser severitmoderate siinfra typbug

Most helpful comment

There are a couple of other issues with the digester if anyone wants to take a look at these together:
https://github.com/pingcap/tidb/issues/14241
https://github.com/pingcap/tidb/issues/18224

All 3 comments

while the extra spaces can be considered a bug, i don't think the digest text are supposed to be syntax-error-free (literals and lists are substituted by ? and ...).

@kennytm Yes, we only expect syntax-error free for this specific case.

There are a couple of other issues with the digester if anyone wants to take a look at these together:
https://github.com/pingcap/tidb/issues/14241
https://github.com/pingcap/tidb/issues/18224

Was this page helpful?
0 / 5 - 0 ratings