diff --git a/pkg/expression/builtin_info.go b/pkg/expression/builtin_info.go index 10b8c33f9c552..2d5447128bf6d 100644 --- a/pkg/expression/builtin_info.go +++ b/pkg/expression/builtin_info.go @@ -926,6 +926,9 @@ type tidbMVCCInfoFunctionClass struct { } func (c *tidbMVCCInfoFunctionClass) getFunction(ctx BuildContext, args []Expression) (builtinFunc, error) { + if err := c.verifyArgs(args); err != nil { + return nil, err + } bf, err := newBaseBuiltinFuncWithTp(ctx, c.funcName, args, types.ETString, types.ETString) if err != nil { return nil, err diff --git a/pkg/parser/ast/functions.go b/pkg/parser/ast/functions.go index 68e736b20ced9..7e8fc9f85d3a3 100644 --- a/pkg/parser/ast/functions.go +++ b/pkg/parser/ast/functions.go @@ -373,9 +373,6 @@ const ( TiDBEncodeIndexKey = "tidb_encode_index_key" TiDBDecodeBase64Key = "tidb_decode_base64_key" - // MVCC information fetching function. - GetMvccInfo = "get_mvcc_info" - // Sequence function. NextVal = "nextval" LastVal = "lastval" diff --git a/pkg/parser/parser_test.go b/pkg/parser/parser_test.go index f809addc61dae..0af764b9f7b63 100644 --- a/pkg/parser/parser_test.go +++ b/pkg/parser/parser_test.go @@ -1693,7 +1693,6 @@ func TestBuiltin(t *testing.T) { {`SELECT tidb_decode_key('abc');`, true, "SELECT TIDB_DECODE_KEY(_UTF8MB4'abc')"}, {`SELECT tidb_decode_base64_key('abc');`, true, "SELECT TIDB_DECODE_BASE64_KEY(_UTF8MB4'abc')"}, {`SELECT tidb_decode_sql_digests('[]');`, true, "SELECT TIDB_DECODE_SQL_DIGESTS(_UTF8MB4'[]')"}, - {`SELECT get_mvcc_info('hex', '0xabc');`, true, "SELECT GET_MVCC_INFO(_UTF8MB4'hex', _UTF8MB4'0xabc')"}, // for time fsp {"CREATE TABLE t( c1 TIME(2), c2 DATETIME(2), c3 TIMESTAMP(2) );", true, "CREATE TABLE `t` (`c1` TIME(2),`c2` DATETIME(2),`c3` TIMESTAMP(2))"}, diff --git a/tests/integrationtest/r/expression/misc.result b/tests/integrationtest/r/expression/misc.result index 547e7d2e965de..c06646b794e7a 100644 --- a/tests/integrationtest/r/expression/misc.result +++ b/tests/integrationtest/r/expression/misc.result @@ -1021,3 +1021,5 @@ tab0 CREATE TABLE `tab0` ( `col1` int DEFAULT NULL, `col2` int DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin +SELECT TIDB_MVCC_INFO(); +Error 1582 (42000): Incorrect parameter count in the call to native function 'tidb_mvcc_info' diff --git a/tests/integrationtest/t/expression/misc.test b/tests/integrationtest/t/expression/misc.test index b6e27f808f52c..e8eda5d90e7e1 100644 --- a/tests/integrationtest/t/expression/misc.test +++ b/tests/integrationtest/t/expression/misc.test @@ -611,3 +611,7 @@ drop table if exists tab0; CREATE TABLE tab0(col0 INTEGER, col1 INTEGER, col2 INTEGER); SELECT + - (- CASE + col0 WHEN + CAST( col0 AS SIGNED ) THEN col1 WHEN 79 THEN NULL WHEN + - col1 THEN col0 / + col0 END ) * - 16 FROM tab0; show create table tab0; + +# TestTiDBMVCCInfo +-- error 1582 +SELECT TIDB_MVCC_INFO();