Bug #99833 The multi-valued index returns ERROR when --debug option specified
Submitted: 10 Jun 2020 7:52 Modified: 17 Nov 2020 23:52
Reporter: Hope Lee (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: JSON Severity:S3 (Non-critical)
Version:8.0.20 OS:Any
Assigned to: CPU Architecture:Any

[10 Jun 2020 7:52] Hope Lee
Description:
When we specify --debug in the server startup command line parameters, the server will raise an error when the multi-valued index is used.

How to repeat:
create table t1 (f1 json, id varchar(255) as (f1->"$[0]") stored not null primary key );

create index i1 on t1((cast(f1->"$[*]" as unsigned array)));

analyze table t1;

select * from t1  where json_overlaps(f1->'$[*]', '[4,3,7]') order by id;

Expected:
root:test> SELECT * from t1 where JSON_OVERLAPS(t1.f1->'$[*]', '[4, 3]') ;
Empty set (0.00 sec)

Actual:
root:test> SELECT * from t1 where JSON_OVERLAPS(t1.f1->'$[*]', '[4, 3]') ;
ERROR 3142 (HY000): The JSON binary value contains invalid data.
[10 Jun 2020 12:46] MySQL Verification Team
Hi Mr. Lee,

Thank you for your bug report.

We have managed to repeat the behaviour that you reported:

able	Op	Msg_type	Msg_text
test.t1	analyze	status	OK
ERROR 3142 (HY000) at line 8: The JSON binary value contains invalid data.
ERROR 3142 (HY000) at line 10: The JSON binary value contains invalid data.

Verified as reported.
[17 Nov 2020 23:52] Jon Stephens
Documented fix as follows in the MySQL 8.0.23 changelog:

    When mysqld was run with --debug, attempting to execute a query
    that made use of a multi-valued index raised an error.

Closed.
[18 Nov 2020 12:51] MySQL Verification Team
Thank you, Jon.