pingcap / pingcap/tidb

Parser syntax error for bang comment variable (/*! SELECT 1 INTO @v) */)

Open
#64,527 1 comment 0 reactions 0 assignees View on GitHub
contribution first-time-contributor severity/minor sig/sql-infra type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

### 1. Minimal reproduce step
Use `Parser.ParseSQL` on the following string:

```sql
/*! SELECT 1 INTO @v */;
```

### 2. What did you expect to see?
This is valid MySQL and should not result in a syntax error.
The example is simplified from what is output by mysqldump:
```sql
/*!50717 SELECT COUNT(*) INTO @rocksdb_has_p_s_session_variables FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'performance_schema' AND TABLE_NAME = 'session_variables' */;
```

### 3. What did you see instead
An error is returned with this content:
```
line 1 column 20 near "@v */;"
```

### 4. What is your TiDB version?
github.com/pingcap/tidb/pkg/parser v0.0.0-20251118030941-8c819260b329

### Origin
The error is generated at:

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.