pingcap / pingcap/tidb

can't insert data if date multi-value index is used

Open
#50,370 1 comment 0 reactions 1 assignee Claimed by @YangKeao View on GitHub
affects-7.6 fuzz/randomtest may-affects-5.4 may-affects-6.1 may-affects-6.5 may-affects-7.1 may-affects-7.5 severity/moderate sig/sql-infra type/bug
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
CREATE TABLE `t45ebe76a` ( `col_24` varchar(109) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, `col_25` char(142) COLLATE gbk_bin DEFAULT NULL, `col_26` json NOT NULL, `col_27` varchar(73) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, `col_28` json NOT NULL, `col_29` binary(24) DEFAULT NULL, `col_30` text DEFAULT NULL, `col_31` timestamp NULL DEFAULT NULL, `col_32` text DEFAULT NULL, UNIQUE KEY `idx_9` ((cast(`col_26` as date array)),`col_29`), PRIMARY KEY (`col_24`(2)) , UNIQUE KEY `idx_11` ((cast(`col_26` as date array))) ) ENGINE=InnoDB DEFAULT
CHARSET=gbk COLLATE=gbk_chinese_ci;
insert into t45ebe76a set col_24 = '%rC!NV~5b', col_25 = 'c', col_26 = '["1977-03-22","1983-09-23","1971-06-18","2005-06-13","1999-09-30"]', col_27 = 't#f1FWRtyyGkjY', col_28 = '[\"BE2TkC8X6QiQjeQbbCkDMNrg8Ap330f9vUUPEcOexb0XdjOkZyNbpC1UsBn5tgUb\"]', col_29 = '@s#11e9AwR0*p', col_30 = '8sjIbt!h6', col_31 = '1984-03-19', col_32 = '靗4C樲GS*X朿勑梾饨&x$T舐';
```

### 2. What did you expect to see? (Required)

No error

### 3. What did you see instead (Required)

``` SQL
mysql> insert into t45ebe76a set col_24 = '%rC!NV~5b', col_25 = 'c', col_26 = '["1977-03-22","1983-09-23","1971-06-18","2005-06-13","1999-09-30"]', col_27 = 't#f1FWRtyyGkjY', col_28 = '[\"BE2TkC8X6QiQjeQbbCkDMNrg8Ap330f9vUUPEcOexb0XdjOkZyNbpC1UsBn5tgUb\"]', col_29 = '@s#11e9AwR0*p', col_30 = '8sjIbt!h6', col_31 = '1984-03-19', col_32 = '靗4C樲GS*X朿勑梾饨&x$T舐';
ERROR 3903 (HY000): Invalid JSON value for CAST for expression index 'idx_9'
```

### 4. What is your TiDB version? (Required)
56c619f1f5ea8e3f9970fe664729074b5123683a

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.