Skip to content

JSON_EXTRACT fails to cast as bool #12233

@kaeverens

Description

@kaeverens

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?

in both MySQL and TiDB, run the following:

create database testjson;
use testjson;
create table testjson( id int auto_increment not null primary key, j json )default charset=utf8 engine=innodb;
insert into testjson set j='{"test":1}';
select id from testjson where json_extract(j, '$.test');
  1. What did you expect to see?

MySQL returns this:

+----+
| id |
+----+
|  1 |
+----+
1 row in set (0.001 sec)
  1. What did you see instead?

TiDB returns this:

ERROR 1105 (HY000): InvalidDataType("can\'t convert Json(1) to bool")
  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?

v3.0.0-rc.1-256-g1ddb31720

Metadata

Metadata

Assignees

Labels

component/coprocessorcomponent/jsongood first issueDenotes an issue ready for a new contributor, according to the "help wanted" guidelines.help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.severity/majorsig/executionSIG executiontype/bugThe issue is confirmed as a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions