pingcap / pingcap/tidb

server: support configurable extended SQL error messages

Open
#68,485 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Enhancement

TiDB should support appending configurable guidance to selected user-facing SQL errors.

Some deployments need to show extra context, such as documentation links or remediation hints, for specific SQL error messages. Today this requires changing the error source or adding special-case code for each error, which is hard to maintain and not flexible enough for deployment-specific needs.

The enhancement is to add a server configuration map that matches SQL error messages by regular expression and appends the configured message when a match is found.

Expected behavior:

- Operators can configure a map from error-message regular expressions to appended messages.
- TiDB validates configured regular expressions when loading config.
- The server appends the configured message before returning the SQL error to the client.
- Matching is deterministic when multiple patterns match.

This keeps deployment-specific error guidance in configuration while avoiding per-error tagging in planner, executor, expression, or storage code paths.

Suggested labels: type/enhancement, component/server, component/config

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.