plugin: Support Pre-parse Query Rewrite for Audit plugins #10913
Labels
component/plugin
feature/accepted
This feature request is accepted by product managers
type/feature-request
This is a feature requests on the product
Projects
Feature Request
Is your feature request related to a problem? Please describe:
In MySQL, Pre-parse Query rewrite plugin is the way to provide custom SQL syntax (example). Query rewrite plugin is a subtype of Audit plugin, and TiDB does support an
OnParseEvent
hook. UnfortunatelyOnParseEvent
is not invoked anywhere, and is not in the correct shape to allow actual query rewriting.Describe the feature you'd like:
Remove
OnParseEvent
, and introduce aRewriteSQL
field for rewriting the query before parsing.The
RewriteSQL
for each plugin should be invoked insidesession.Parse()
before callingparser.New()
.RewriteSQL
should be expected to run for a long time (e.g. more than 1 week) as long asctx
is not done.It is unspecified what should happen if multiple Query Rewrite plugins coexist.
Describe alternatives you've considered:
None.
If we want to support Post-parse Query rewrite plugins too, it could be named
RewriteAST
accepting those[]ast.StmtNode
.Teachability, Documentation, Adoption, Migration Strategy:
The text was updated successfully, but these errors were encountered: