diff --git a/tests/fullstack-test2/ddl/expression_index.test b/tests/fullstack-test2/ddl/expression_index.test new file mode 100644 index 00000000000..9623215647b --- /dev/null +++ b/tests/fullstack-test2/ddl/expression_index.test @@ -0,0 +1,42 @@ +# Copyright 2025 PingCAP, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +mysql> drop table if exists test.t; + +# test for null expression express tiflash#9891 +mysql> CREATE TABLE test.t (id int); +mysql> alter table test.t set tiflash replica 1; +mysql> insert test.t values(0),(1); + +func> wait_table test t + +mysql> insert into test.t values (2), (3); +mysql> set session tidb_isolation_read_engines='tiflash'; select * from test.t order by id; ++----+ +| id | ++----+ +| 0 | +| 1 | +| 2 | +| 3 | ++----+ + +mysql> CREATE INDEX idx_n ON test.t ((null)); +ERROR 3761 (HY000) at line 1: The used storage engine cannot index the expression 'null' + +mysql> drop table if exists test.t; + +mysql> CREATE TABLE test.t (id int, KEY idx_name ((null))); +ERROR 3761 (HY000) at line 1: The used storage engine cannot index the expression 'null' +mysql> drop table if exists test.t;