| Bug #110556 | When we use json to build an index, we will get wrong results | ||
|---|---|---|---|
| Submitted: | 30 Mar 2023 2:46 | Modified: | 30 Mar 2023 5:27 |
| Reporter: | linkang zhang | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: JSON | Severity: | S2 (Serious) |
| Version: | 8.0.28, 8.0.32 | OS: | Linux |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | CAST(), INDEX, json | ||
[30 Mar 2023 2:46]
linkang zhang
[30 Mar 2023 5:27]
MySQL Verification Team
Hello linkang zhang, Thank you for the report and test case. regards, Umesh
[25 Mar 20:22]
Jean-François Gagné
I am curious how much this is related to Bug#120149... And I would like to add my disappointment that this bug is still unfixed in 8.0.45, 8.4.8 and 9.6.0. ./use test <<< ' DROP TABLE IF EXISTS Test1; CREATE TABLE test1 ( `md_id` int NOT NULL AUTO_INCREMENT, `member_id` int NOT NULL, `mid` int NOT NULL, `expand_info` json NOT NULL, PRIMARY KEY (`md_id`) USING BTREE, UNIQUE INDEX `member_id`(`mid` ASC, `member_id` ASC) USING BTREE ) ENGINE = InnoDB; ALTER TABLE test1 ADD INDEX test_index (mid, (CAST(expand_info AS CHAR(20) array))); INSERT INTO test1 VALUES (1, 1, 1, "[1]"), (2, 2, 1, "[]"); SELECT version(); SELECT * FROM test1; SELECT count(*) FROM test1 force index (Primary) where mid = 1; SELECT count(*) FROM test1 force index (test_index) where mid = 1;' version() 8.0.45 md_id member_id mid expand_info 1 1 1 [1] 2 2 1 [] count(*) 2 count(*) 1 version() 8.4.8 md_id member_id mid expand_info 1 1 1 [1] 2 2 1 [] count(*) 2 count(*) 1 version() 9.6.0 md_id member_id mid expand_info 1 1 1 [1] 2 2 1 [] count(*) 2 count(*) 1
