tidb 7.1.0 use JSON_OBJECT with if() func cause bug
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
tidb 7.1.0 use JSON_OBJECT with if() func cause bug
### 1. create table and init data....
```
CREATE TABLE `tt2` (
`I_ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`I_HAS_RECEIPT` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0:否,1:是',
PRIMARY KEY (`I_ID`) /*T![clustered_index] CLUSTERED */
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=1 COMMENT='xx';
insert into tt2 values(1, 0),(2, 1);
select JSON_OBJECT('has_receipt',if(I_HAS_RECEIPT = 0, false, true))from tt2 limit 10;
```
### 2. What did you expect to see? (Required)
expect sql execute result return true or false, but not expect 1,0
### 3. What did you see instead (Required)

### 4. What is your TiDB version? (Required)
sql in tidb 5.0.4 is expected,but 7.1.0 is not expect....
ps:
1. in my case, use `case when then ` instead of `if()` ,and then result is ok~

2. in mysql 5.7 return 1 or 0;

Contributor guide
Assessment
This issue has not been assessed yet.