The result of `IF` function not compatible with MySQL
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
Please answer these questions before submitting your issue. Thanks!
### 1. Minimal reproduce step (Required)
```sql
select if((11000>=10000), (floor(11000/10000)), (round(11000/10000,2)));
```
### 2. What did you expect to see? (Required)
```sql
mysql> select if((11000>=10000), (floor(11000/10000)), (round(11000/10000,2)));
+------------------------------------------------------------------+
| if((11000>=10000), (floor(11000/10000)), (round(11000/10000,2))) |
+------------------------------------------------------------------+
| 1 |
+------------------------------------------------------------------+
1 row in set (0.00 sec)
```
### 3. What did you see instead (Required)
```sql
mysql> select if((11000>=10000), (floor(11000/10000)), (round(11000/10000,2)));
+------------------------------------------------------------------+
| if((11000>=10000), (floor(11000/10000)), (round(11000/10000,2))) |
+------------------------------------------------------------------+
| 1.00 |
+------------------------------------------------------------------+
1 row in set (0.00 sec)
```
### 4. What is your TiDB version? (Required)
```
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version() |
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v9.0.0-alpha-85-g837aec49eb
Edition: Community
Git Commit Hash: 837aec49eb28025aacec7f50f69b73fb423b590a
Git Branch: master
UTC Build Time: 2025-01-10 04:36:27
GoVersion: go1.23.4
Race Enabled: false
Check Table Before Drop: false
Store: unistore |
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
```
Contributor guide
Assessment
This issue has not been assessed yet.