Skip to content

server: support configurable extended SQL error messages #68485

@zeminzhou

Description

@zeminzhou

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions