Can TiDB bind SQL like this?

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: tidb绑定sql能这么写吗

| username: tidb狂热爱好者

I want to remove the type condition. But the developer doesn’t have the source code. Is it possible to rewrite it through SQL binding?

【TiDB Usage Environment】Production, Testing, Research
【TiDB Version】
【Encountered Problem】
【Reproduction Path】What operations were performed to encounter the problem
【Problem Phenomenon and Impact】

【Attachments】

Please provide the version information of each component, such as cdc/tikv, which can be obtained by executing cdc version/tikv-server --version.

| username: h5n1 | Original post link

SPM binds to the execution plan, not for SQL transformation. Generally, it is for SQL with hints, requiring the SQL to be the same after removing the hints and standardizing it. This kind of SQL with missing fields is not acceptable.

| username: forever | Original post link

You can create a view, give an alias called type column, and then define it as the value you want.

| username: system | Original post link

This topic will be automatically closed 60 days after the last reply. No new replies are allowed.