From c2da6b7420fd36fbcc511b5ee501054636e0ed8d Mon Sep 17 00:00:00 2001 From: xiongjiwei Date: Thu, 2 Feb 2023 13:56:07 +0800 Subject: [PATCH] add test Signed-off-by: xiongjiwei --- expression/multi_valued_index_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/expression/multi_valued_index_test.go b/expression/multi_valued_index_test.go index 1172d06f78986..b749b4c94d9ba 100644 --- a/expression/multi_valued_index_test.go +++ b/expression/multi_valued_index_test.go @@ -46,6 +46,7 @@ func TestMultiValuedIndexDDL(t *testing.T) { tk.MustExec("drop table t") tk.MustGetErrCode("CREATE TABLE t(x INT, KEY k ((1 AND CAST(JSON_ARRAY(x) AS UNSIGNED ARRAY))));", errno.ErrNotSupportedYet) tk.MustGetErrCode("CREATE TABLE t1 (f1 json, key mvi((cast(cast(f1 as unsigned array) as unsigned array))));", errno.ErrNotSupportedYet) + tk.MustGetErrCode("CREATE TABLE t1 (f1 json, primary key mvi((cast(cast(f1 as unsigned array) as unsigned array))));", errno.ErrNotSupportedYet) tk.MustGetErrCode("CREATE TABLE t1 (f1 json, key mvi((cast(f1->>'$[*]' as unsigned array))));", errno.ErrInvalidTypeForJSON) tk.MustGetErrCode("CREATE TABLE t1 (f1 json, key mvi((cast(f1->'$[*]' as year array))));", errno.ErrNotSupportedYet) tk.MustGetErrCode("CREATE TABLE t1 (f1 json, key mvi((cast(f1->'$[*]' as json array))));", errno.ErrNotSupportedYet) @@ -75,6 +76,9 @@ func TestMultiValuedIndexDDL(t *testing.T) { tk.MustExec("drop table t") tk.MustExec("set names gbk") tk.MustExec("create table t(a json, b int, index idx3(b, (cast(a as char(10) array))));") + + tk.MustExec("CREATE TABLE users (id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, doc JSON);") + tk.MustExecToErr("CREATE TABLE t (id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, doc JSON, FOREIGN KEY fk_user_id ((cast(doc->'$[*]' as signed array))) REFERENCES users(id));") } func TestMultiValuedIndexDML(t *testing.T) {