pingcap / pingcap/tidb

planner: GRANT PROXY reports an internal Go type instead of an unsupported-feature error

Open Beginner friendly
#71,003 0 comments 0 reactions 0 assignees View on GitHub
component/privilege severity/minor type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

Please answer these questions before submitting your issue. Thanks!

### 1. Minimal reproduce step (Required)

Run the following SQL as an administrative user:

```sql
CREATE USER 'proxy_base'@'%' IDENTIFIED BY 'Test12345!';
CREATE USER 'proxy_target'@'%' IDENTIFIED BY 'Test12345!';
GRANT PROXY ON 'proxy_base'@'%' TO 'proxy_target'@'%';
```

This report concerns the error message for an unsupported statement, not a request to implement proxy-user support.

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

A clear error explaining that TiDB does not support `GRANT PROXY`, for example:

```text
This version of TiDB doesn't yet support 'GRANT PROXY'
```

### 3. What did you see instead (Required)

The reported execution returned:

```text
ERROR 8108 (HY000): Unsupported type *resolve.NodeW
```

This exposes an internal Go type without explaining which SQL feature is unsupported.

Source inspection also confirms the same diagnostic problem on master at `ebcba3eefb082713e6cf7f7c04511335c563d7e1`: the parser accepts `GRANT PROXY`, but `PlanBuilder.Build` has no branch for `*ast.GrantProxyStmt` and falls through to `ErrUnsupportedType`. That revision formats `node.Node`, so its expected message is `Unsupported type *ast.GrantProxyStmt`, rather than the wrapper type in the reported output. This master result is inferred from source, not a local runtime reproduction.

- [GRANT PROXY parser rule](https://github.com/pingcap/tidb/blob/ebcba3eefb082713e6cf7f7c04511335c563d7e1/pkg/parser/parser.y#L15899)
- [PlanBuilder.Build](https://github.com/pingcap/tidb/blob/ebcba3eefb082713e6cf7f7c04511335c563d7e1/pkg/planner/core/planbuilder.go#L597)

Severity assessment: **minor**. The confirmed defect is an unclear diagnostic for an unsupported feature. No data corruption, incorrect query results, privilege bypass, or failure of a supported operation has been demonstrated.

### 4. What is your TiDB version? (Required)

The exact TiDB version for the reported SQL output was not provided.

Master was inspected at `ebcba3eefb082713e6cf7f7c04511335c563d7e1`. No local TiDB server reproduction was performed.

Contributor guide

Open the contributing guide

Research direction

Start with PlanBuilder.Build in pkg/planner/core/planbuilder.go and the GRANT PROXY parser rule in pkg/parser/parser.y. Run the SQL reproduction from the issue, then verify that GRANT PROXY reports a clear unsupported-feature error instead of exposing an internal Go type. Done means the diagnostic is corrected without implementing proxy-user support.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, sql
Domain
databases
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.