@@ -1817,8 +1817,6 @@ func TestParserIssue284(t *testing.T) {
1817
1817
1818
1818
func TestAddExpressionIndex (t * testing.T ) {
1819
1819
config .UpdateGlobal (func (conf * config.Config ) {
1820
- // Test for table lock.
1821
- conf .EnableTableLock = true
1822
1820
conf .Instance .SlowThreshold = 10000
1823
1821
conf .TiKVClient .AsyncCommit .SafeWindow = 0
1824
1822
conf .TiKVClient .AsyncCommit .AllowedClockDrift = 0
@@ -1897,60 +1895,6 @@ func TestAddExpressionIndex(t *testing.T) {
1897
1895
})
1898
1896
}
1899
1897
1900
- func TestCreateExpressionIndexError (t * testing.T ) {
1901
- config .UpdateGlobal (func (conf * config.Config ) {
1902
- // Test for table lock.
1903
- conf .EnableTableLock = true
1904
- conf .Instance .SlowThreshold = 10000
1905
- conf .TiKVClient .AsyncCommit .SafeWindow = 0
1906
- conf .TiKVClient .AsyncCommit .AllowedClockDrift = 0
1907
- conf .Experimental .AllowsExpressionIndex = true
1908
- })
1909
- store := testkit .CreateMockStore (t )
1910
- tk := testkit .NewTestKit (t , store )
1911
- tk .MustExec ("use test" )
1912
- tk .MustExec ("drop table if exists t;" )
1913
- tk .MustExec ("create table t (a int, b real);" )
1914
- tk .MustGetErrCode ("alter table t add primary key ((a+b)) nonclustered;" , errno .ErrFunctionalIndexPrimaryKey )
1915
-
1916
- tk .MustGetErrCode ("create table t(a int, index((cast(a as JSON))))" , errno .ErrFunctionalIndexOnJSONOrGeometryFunction )
1917
-
1918
- // Test for error
1919
- tk .MustExec ("drop table if exists t;" )
1920
- tk .MustExec ("create table t (a int, b real);" )
1921
- tk .MustGetErrCode ("alter table t add primary key ((a+b)) nonclustered;" , errno .ErrFunctionalIndexPrimaryKey )
1922
- tk .MustGetErrCode ("alter table t add index ((rand()));" , errno .ErrFunctionalIndexFunctionIsNotAllowed )
1923
- tk .MustGetErrCode ("alter table t add index ((now()+1));" , errno .ErrFunctionalIndexFunctionIsNotAllowed )
1924
-
1925
- tk .MustExec ("alter table t add column (_V$_idx_0 int);" )
1926
- tk .MustGetErrCode ("alter table t add index idx((a+1));" , errno .ErrDupFieldName )
1927
- tk .MustExec ("alter table t drop column _V$_idx_0;" )
1928
- tk .MustExec ("alter table t add index idx((a+1));" )
1929
- tk .MustGetErrCode ("alter table t add column (_V$_idx_0 int);" , errno .ErrDupFieldName )
1930
- tk .MustExec ("alter table t drop index idx;" )
1931
- tk .MustExec ("alter table t add column (_V$_idx_0 int);" )
1932
-
1933
- tk .MustExec ("alter table t add column (_V$_expression_index_0 int);" )
1934
- tk .MustGetErrCode ("alter table t add index ((a+1));" , errno .ErrDupFieldName )
1935
- tk .MustExec ("alter table t drop column _V$_expression_index_0;" )
1936
- tk .MustExec ("alter table t add index ((a+1));" )
1937
- tk .MustGetErrCode ("alter table t drop column _V$_expression_index_0;" , errno .ErrCantDropFieldOrKey )
1938
- tk .MustGetErrCode ("alter table t add column e int as (_V$_expression_index_0 + 1);" , errno .ErrBadField )
1939
-
1940
- // NOTE (#18150): In creating expression index, row value is not allowed.
1941
- tk .MustExec ("drop table if exists t;" )
1942
- tk .MustGetErrCode ("create table t (j json, key k (((j,j))))" , errno .ErrFunctionalIndexRowValueIsNotAllowed )
1943
- tk .MustExec ("create table t (j json, key k ((j+1),(j+1)))" )
1944
-
1945
- tk .MustGetErrCode ("create table t1 (col1 int, index ((concat(''))));" , errno .ErrWrongKeyColumnFunctionalIndex )
1946
- tk .MustGetErrCode ("CREATE TABLE t1 (col1 INT, PRIMARY KEY ((ABS(col1))) NONCLUSTERED);" , errno .ErrFunctionalIndexPrimaryKey )
1947
-
1948
- // For issue 26349
1949
- tk .MustExec ("drop table if exists t;" )
1950
- tk .MustExec ("create table t(id char(10) primary key, short_name char(10), name char(10), key n((upper(`name`))));" )
1951
- tk .MustExec ("update t t1 set t1.short_name='a' where t1.id='1';" )
1952
- }
1953
-
1954
1898
func queryIndexOnTable (dbName , tableName string ) string {
1955
1899
return fmt .Sprintf ("select distinct index_name, is_visible from information_schema.statistics where table_schema = '%s' and table_name = '%s' order by index_name" , dbName , tableName )
1956
1900
}
@@ -2349,20 +2293,6 @@ func TestEnumAndSetDefaultValue(t *testing.T) {
2349
2293
require .Equal (t , "a" , tbl .Meta ().Columns [1 ].DefaultValue )
2350
2294
}
2351
2295
2352
- func TestStrictDoubleTypeCheck (t * testing.T ) {
2353
- store := testkit .CreateMockStore (t )
2354
- tk := testkit .NewTestKit (t , store )
2355
- tk .MustExec ("use test" )
2356
- tk .MustExec ("set @@tidb_enable_strict_double_type_check = 'ON'" )
2357
- sql := "create table double_type_check(id int, c double(10));"
2358
- _ , err := tk .Exec (sql )
2359
- require .Error (t , err )
2360
- require .Equal (t , "[parser:1149]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use" , err .Error ())
2361
- tk .MustExec ("set @@tidb_enable_strict_double_type_check = 'OFF'" )
2362
- defer tk .MustExec ("set @@tidb_enable_strict_double_type_check = 'ON'" )
2363
- tk .MustExec (sql )
2364
- }
2365
-
2366
2296
func TestDuplicateErrorMessage (t * testing.T ) {
2367
2297
defer collate .SetNewCollationEnabledForTest (true )
2368
2298
store := testkit .CreateMockStore (t )
@@ -2669,8 +2599,6 @@ func TestAvoidCreateViewOnLocalTemporaryTable(t *testing.T) {
2669
2599
2670
2600
func TestDropTemporaryTable (t * testing.T ) {
2671
2601
config .UpdateGlobal (func (conf * config.Config ) {
2672
- // Test for table lock.
2673
- conf .EnableTableLock = true
2674
2602
conf .Instance .SlowThreshold = 10000
2675
2603
conf .TiKVClient .AsyncCommit .SafeWindow = 0
2676
2604
conf .TiKVClient .AsyncCommit .AllowedClockDrift = 0
@@ -2936,42 +2864,6 @@ func TestIssue29282(t *testing.T) {
2936
2864
}
2937
2865
}
2938
2866
2939
- // See https://github.com/pingcap/tidb/issues/35644
2940
- func TestCreateTempTableInTxn (t * testing.T ) {
2941
- store := testkit .CreateMockStore (t )
2942
- tk := testkit .NewTestKit (t , store )
2943
- tk .MustExec ("use test" )
2944
- tk .MustExec ("begin" )
2945
- // new created temporary table should be visible
2946
- tk .MustExec ("create temporary table t1(id int primary key, v int)" )
2947
- tk .MustQuery ("select * from t1" ).Check (testkit .Rows ())
2948
- // new inserted data should be visible
2949
- tk .MustExec ("insert into t1 values(123, 456)" )
2950
- tk .MustQuery ("select * from t1 where id=123" ).Check (testkit .Rows ("123 456" ))
2951
- // truncate table will clear data but table still visible
2952
- tk .MustExec ("truncate table t1" )
2953
- tk .MustQuery ("select * from t1 where id=123" ).Check (testkit .Rows ())
2954
- tk .MustExec ("commit" )
2955
-
2956
- tk1 := testkit .NewTestKit (t , store )
2957
- tk1 .MustExec ("use test" )
2958
- tk1 .MustExec ("create table tt(id int)" )
2959
- tk1 .MustExec ("begin" )
2960
- tk1 .MustExec ("create temporary table t1(id int)" )
2961
- tk1 .MustExec ("insert into tt select * from t1" )
2962
- tk1 .MustExec ("drop table tt" )
2963
-
2964
- tk2 := testkit .NewTestKit (t , store )
2965
- tk2 .MustExec ("use test" )
2966
- tk2 .MustExec ("create table t2(id int primary key, v int)" )
2967
- tk2 .MustExec ("insert into t2 values(234, 567)" )
2968
- tk2 .MustExec ("begin" )
2969
- // create a new temporary table with the same name will override physical table
2970
- tk2 .MustExec ("create temporary table t2(id int primary key, v int)" )
2971
- tk2 .MustQuery ("select * from t2 where id=234" ).Check (testkit .Rows ())
2972
- tk2 .MustExec ("commit" )
2973
- }
2974
-
2975
2867
// See https://github.com/pingcap/tidb/issues/29327
2976
2868
func TestEnumDefaultValue (t * testing.T ) {
2977
2869
store := testkit .CreateMockStore (t , mockstore .WithDDLChecker ())
0 commit comments