planner: output an error for `create global binding using ... if(col=?) ...`
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Enhancement
See the case below, `if(col=?)` is a wrong syntax, so the optimizer should return an error in this case.
And we can see that for normal statements and bindings with actual values, the optimizer returns the error, which is correct.
But when changing the `if(col=1)` to `if(col=?)`, the optimizer doesn't return an error, which is unexpected.
```
mysql> select * from t where if(a=1);
ERROR 1582 (42000): Incorrect parameter count in the call to native function 'if'
mysql> create global binding using select * from t where if(a=1);
ERROR 1582 (42000): Incorrect parameter count in the call to native function 'if'
mysql> create global binding using select * from t where if(a=?);
Query OK, 0 rows affected (0.006 sec)
```
Contributor guide
Assessment
This issue has not been assessed yet.