diff --git a/.gitee/ISSUE_TEMPLATE.en.md b/.gitee/ISSUE_TEMPLATE.en.md new file mode 100644 index 0000000000000000000000000000000000000000..4ad4df52860727cd622b8e3b45bd0981e444a762 --- /dev/null +++ b/.gitee/ISSUE_TEMPLATE.en.md @@ -0,0 +1,21 @@ +**Is this a BUG REPORT or FEATURE REQUEST?**: + +> Uncomment only one, leave it on its own line: +> +> - bug +> +> - feature + + +**What happened**: + +**What you expected to happen**: + +**How to reproduce it (as minimally and precisely as possible)**: + +**Anything else we need to know?**: + +**Environment**: +- Version: +- OS (e.g. from /etc/os-release): +- Others: diff --git a/.gitee/ISSUE_TEMPLATE.zh-CN.md b/.gitee/ISSUE_TEMPLATE.zh-CN.md new file mode 100644 index 0000000000000000000000000000000000000000..bdb654393767bef656c36a6e87aaa6821605cee5 --- /dev/null +++ b/.gitee/ISSUE_TEMPLATE.zh-CN.md @@ -0,0 +1,21 @@ +**这是一个bug还是新特性?**: + +> 以下两者二选一,请保留一项: +> +> - bug +> +> - 特性 + + +**发生结果**: + +**期望结果**: + +**如何重现(尽量详细)**: + +**补充说明?**: + +**环境情况**: +- 软件版本: +- 操作系统版本 (e.g. from /etc/os-release): +- 其它: diff --git a/.gitee/PULL_REQUEST_TEMPLATE.en.md b/.gitee/PULL_REQUEST_TEMPLATE.en.md new file mode 100644 index 0000000000000000000000000000000000000000..211cb09ff26205aa0201eaf86448be39892c58f0 --- /dev/null +++ b/.gitee/PULL_REQUEST_TEMPLATE.en.md @@ -0,0 +1,22 @@ + + +**[Background]** +Describe the background of this PR (why we need it). + +**[Root Cause]** +Analyze the root cause of the problem or requirement(optional). + +**[Changes Made]** +Describe the solution for this PR. + +**[Test Result]** +Developer self validation results. diff --git a/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md b/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md new file mode 100644 index 0000000000000000000000000000000000000000..b16b119bf7e9680f9d109a73cb3b1c4c51c3bf68 --- /dev/null +++ b/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md @@ -0,0 +1,21 @@ + + +**[Background]** +描述该PR的修改背景。 + +**[Root Cause]** +根因分析。 + +**[Changes Made]** +描述该PR的修改方案。 + +**[Test Result]** +开发人员自验证结果。 \ No newline at end of file diff --git a/mysql-test/suite/ctc/r/ctc_ddl_func_index.result b/mysql-test/suite/ctc/r/ctc_ddl_func_index.result index 5c551745dbb573f9bdea5c9e70e2935c1b631f3a..d8e34ff627166fa30b46637369164ec6b8ad43fb 100644 --- a/mysql-test/suite/ctc/r/ctc_ddl_func_index.result +++ b/mysql-test/suite/ctc/r/ctc_ddl_func_index.result @@ -95,4 +95,8 @@ create table t5 (c1 int, c2 int, c3 varchar(10), index func_idx_1 ((abs(c1)))); drop table t5; create table t5 (c1 int, c2 int, c3 varchar(10), index func_idx_1 ((c1 + c2))); ERROR HY000: Cantian does not support function indexes with multiple columns of arguments. +create table t6 (c1 int, c2 int); +create index index_func_idx_1 on t6 ((if(c1 = 1, 1, 3))); +ERROR HY000: Function if is not indexable +drop table t6; drop database db1; diff --git a/mysql-test/suite/ctc/t/ctc_ddl_func_index.test b/mysql-test/suite/ctc/t/ctc_ddl_func_index.test index 0dedf2e8033f5adf68018127a478359c66805ffb..879c0c2cafaf0feeda52760154cc8d55b15faee2 100644 --- a/mysql-test/suite/ctc/t/ctc_ddl_func_index.test +++ b/mysql-test/suite/ctc/t/ctc_ddl_func_index.test @@ -51,5 +51,11 @@ drop table t5; --error ER_DISALLOWED_OPERATION create table t5 (c1 int, c2 int, c3 varchar(10), index func_idx_1 ((c1 + c2))); +# 创建包含条件表达式函数索引异常场景 +create table t6 (c1 int, c2 int); +--error ER_DISALLOWED_OPERATION +create index index_func_idx_1 on t6 ((if(c1 = 1, 1, 3))); + +drop table t6; drop database db1; diff --git a/storage/ctc/ctc_ddl_util.cc b/storage/ctc/ctc_ddl_util.cc index 37e0a3d14f70f2aeb5cd25b23a922fd6bd6f27a1..df91e4d19addc489e926bb13217a8002016c1d11 100644 --- a/storage/ctc/ctc_ddl_util.cc +++ b/storage/ctc/ctc_ddl_util.cc @@ -89,6 +89,9 @@ bool check_data_file_name(const char *data_file_name) { } Field *ctc_get_field_by_name(TABLE *form, const char *name) { + if (name == nullptr) { + return nullptr; + } for (uint32_t i = 0; i < form->s->fields; i++) { if (strcasecmp(form->field[i]->field_name, name) == 0) { return form->field[i];