move test folder
This commit is contained in:
@ -0,0 +1,33 @@
|
||||
alter system set backup_log_archive_option='MANDATORY';
|
||||
alter system set backup_log_archive_option='MANDATORY compression=disable';
|
||||
alter system set backup_log_archive_option='MANDATORY compression =enable';
|
||||
alter system set backup_log_archive_option='MANDATORY compression = lz4_1.0';
|
||||
alter system set backup_log_archive_option='MANDATORY compression= zstd_1.3.8';
|
||||
alter system set backup_log_archive_option='optional compression= zstd_1.3.8';
|
||||
alter system set backup_log_archive_option='compression= zstd_1.3.8 optional ';
|
||||
alter system set backup_log_archive_option='encryption_mode= none';
|
||||
ERROR HY000: Invalid config
|
||||
alter system set backup_log_archive_option='encryption_mode= TRANSPARENT_ENCRYPTION';
|
||||
ERROR HY000: Invalid config
|
||||
alter system set backup_log_archive_option='optional compression= none';
|
||||
ERROR HY000: Invalid config
|
||||
alter system set backup_log_archive_option='optional compression';
|
||||
ERROR HY000: Invalid config
|
||||
alter system set backup_log_archive_option='optional biubiu';
|
||||
ERROR HY000: Invalid config
|
||||
alter system set backup_log_archive_option='optional compression disable';
|
||||
ERROR HY000: Invalid config
|
||||
alter system set backup_log_archive_option='= compression=disable';
|
||||
ERROR HY000: Invalid config
|
||||
alter system set backup_log_archive_option='compression=disable=';
|
||||
ERROR HY000: Invalid config
|
||||
alter system set backup_log_archive_option='encryption_mode= password';
|
||||
ERROR HY000: Invalid config
|
||||
alter system set backup_log_archive_option='encryption_mode= password_encryption';
|
||||
ERROR HY000: Invalid config
|
||||
alter system set backup_log_archive_option='encryption_mode= DUAL_MODE_ENCRYPTION';
|
||||
ERROR HY000: Invalid config
|
||||
alter system set backup_log_archive_option='encryption_mode= transparent_encryption ENCRYPTION_ALGORITHM = yyy';
|
||||
ERROR HY000: Invalid config
|
||||
alter system set backup_log_archive_option='encryption_mode= transparent_encryption ENCRYPTION_ALGORITHM = none';
|
||||
ERROR HY000: Invalid config
|
||||
@ -0,0 +1,50 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: yaoying.yyy
|
||||
# owner group: trans
|
||||
# description: test alter system set backup_log_archive_option
|
||||
|
||||
connect (obsys1,$OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connection obsys1;
|
||||
|
||||
alter system set backup_log_archive_option='MANDATORY';
|
||||
alter system set backup_log_archive_option='MANDATORY compression=disable';
|
||||
alter system set backup_log_archive_option='MANDATORY compression =enable';
|
||||
alter system set backup_log_archive_option='MANDATORY compression = lz4_1.0';
|
||||
alter system set backup_log_archive_option='MANDATORY compression= zstd_1.3.8';
|
||||
alter system set backup_log_archive_option='optional compression= zstd_1.3.8';
|
||||
alter system set backup_log_archive_option='compression= zstd_1.3.8 optional ';
|
||||
--error 4147
|
||||
alter system set backup_log_archive_option='encryption_mode= none';
|
||||
--error 4147
|
||||
alter system set backup_log_archive_option='encryption_mode= TRANSPARENT_ENCRYPTION';
|
||||
##alter system set backup_log_archive_option='encryption_mode= transparent_encryption ';
|
||||
##alter system set backup_log_archive_option='encryption_mode= transparent_encryption ENCRYPTION_ALGORITHM = aes-128';
|
||||
##alter system set backup_log_archive_option='encryption_mode= transparent_encryption ENCRYPTION_ALGORITHM = aes-192';
|
||||
##alter system set backup_log_archive_option='encryption_mode= transparent_encryption ENCRYPTION_ALGORITHM = aes-256';
|
||||
##alter system set backup_log_archive_option='encryption_mode= transparent_encryption ENCRYPTION_ALGORITHM = sm4';
|
||||
##alter system set backup_log_archive_option='optional encryption_mode= none ENCRYPTION_ALGORITHM = sm4';
|
||||
|
||||
--error 4147
|
||||
alter system set backup_log_archive_option='optional compression= none';
|
||||
--error 4147
|
||||
alter system set backup_log_archive_option='optional compression';
|
||||
--error 4147
|
||||
alter system set backup_log_archive_option='optional biubiu';
|
||||
--error 4147
|
||||
alter system set backup_log_archive_option='optional compression disable';
|
||||
--error 4147
|
||||
alter system set backup_log_archive_option='= compression=disable';
|
||||
--error 4147
|
||||
alter system set backup_log_archive_option='compression=disable=';
|
||||
--error 4147
|
||||
alter system set backup_log_archive_option='encryption_mode= password';
|
||||
--error 4147
|
||||
alter system set backup_log_archive_option='encryption_mode= password_encryption';
|
||||
--error 4147
|
||||
alter system set backup_log_archive_option='encryption_mode= DUAL_MODE_ENCRYPTION';
|
||||
--error 4147
|
||||
alter system set backup_log_archive_option='encryption_mode= transparent_encryption ENCRYPTION_ALGORITHM = yyy';
|
||||
--error 4147
|
||||
alter system set backup_log_archive_option='encryption_mode= transparent_encryption ENCRYPTION_ALGORITHM = none';
|
||||
2452
tools/deploy/mysql_test/test_suite/executor/r/mysql/full_join.result
Normal file
2452
tools/deploy/mysql_test/test_suite/executor/r/mysql/full_join.result
Normal file
File diff suppressed because it is too large
Load Diff
64
tools/deploy/mysql_test/test_suite/executor/t/full_join.test
Normal file
64
tools/deploy/mysql_test/test_suite/executor/t/full_join.test
Normal file
@ -0,0 +1,64 @@
|
||||
# owner: yibo.tyf
|
||||
# owner group: SQL3
|
||||
# tags: optimizer
|
||||
|
||||
--source mysql_test/test_suite/executor/include/cleanup.inc
|
||||
--source mysql_test/test_suite/executor/include/load_data.inc
|
||||
set @@ob_enable_transformation=0;
|
||||
--result_format 4
|
||||
--explain_protocol 2
|
||||
################################
|
||||
# 1 full join
|
||||
|
||||
# wise join
|
||||
# 0 exchange in distributed job.
|
||||
# nestedloop jion
|
||||
select /*+use_nl(t1 t2)*/ t1.a, t2.a from t_h3_01_20 t1 full join t_h3_09_28 t2 on t1.a = t2.a order by t1.a, t2.a;
|
||||
select /*+use_nl(t1 t2)*/ t1.a, t2.a from t_h5_01_20 t1 full join t_h5_09_28 t2 on t1.a = t2.a where t1.a between 5 and 24 order by t1.a, t2.a;
|
||||
# 暂时不是wise join
|
||||
select /*+use_nl(t1 t2)*/ t1.a, t2.a from t_r4_01_20 t1 full join t_r4_01_20 t2 on t1.a = t2.a order by t1.a, t2.a;
|
||||
select /*+use_nl(t1 t2)*/ t1.a, t2.a from t_r5_09_28 t1 full join t_r5_09_28 t2 on t1.a = t2.a where t1.a between 13 and 24 order by t1.a, t2.a;
|
||||
# merge jion
|
||||
select /*+use_mj(t1 t2)*/ t1.a, t2.a from t_h3_01_20 t1 full join t_h3_09_28 t2 on t1.a = t2.a order by t1.a, t2.a;
|
||||
select /*+use_mj(t1 t2)*/ t1.a, t2.a from t_h5_01_20 t1 full join t_h5_09_28 t2 on t1.a = t2.a where t1.a between 5 and 24 order by t1.a, t2.a;
|
||||
# 暂时不是wise join
|
||||
select /*+use_mj(t1 t2)*/ t1.a, t2.a from t_r4_01_20 t1 full join t_r4_01_20 t2 on t1.a = t2.a order by t1.a, t2.a;
|
||||
select /*+use_mj(t1 t2)*/ t1.a, t2.a from t_r5_09_28 t1 full join t_r5_09_28 t2 on t1.a = t2.a where t1.a between 13 and 24 order by t1.a, t2.a;
|
||||
# hash jion
|
||||
select /*+use_hash(t1 t2)*/ t1.a, t2.a from t_h3_01_20 t1 full join t_h3_09_28 t2 on t1.a = t2.a order by t1.a, t2.a;
|
||||
select /*+use_hash(t1 t2)*/ t1.a, t2.a from t_h5_01_20 t1 full join t_h5_09_28 t2 on t1.a = t2.a where t1.a between 5 and 24 order by t1.a, t2.a;
|
||||
# 暂时不是wise join
|
||||
select /*+use_hash(t1 t2)*/ t1.a, t2.a from t_r4_01_20 t1 full join t_r4_01_20 t2 on t1.a = t2.a order by t1.a, t2.a;
|
||||
select /*+use_hash(t1 t2)*/ t1.a, t2.a from t_r5_09_28 t1 full join t_r5_09_28 t2 on t1.a = t2.a where t1.a between 13 and 24 order by t1.a, t2.a;
|
||||
|
||||
# normal join
|
||||
# 1 exchange in distributed job.
|
||||
# nestedloop jion
|
||||
select /*+use_nl(t1 t2)*/ t1.a, t2.a from t_h3_01_20 t1 full join t_h5_09_28 t2 on t1.a = t2.a order by t1.a, t2.a;
|
||||
select /*+use_nl(t1 t2)*/ t1.a, t2.a from t_h5_01_20 t1 full join t_h3_09_28 t2 on t1.a = t2.a where t1.a between 5 and 24 order by t1.a, t2.a;
|
||||
select /*+use_nl(t1 t2)*/ t1.a, t2.a from t_r4_01_20 t1 full join t_r5_09_28 t2 on t1.a = t2.a order by t1.a, t2.a;
|
||||
select /*+use_nl(t1 t2)*/ t1.a, t2.a from t_r5_01_20 t1 full join t_r4_09_28 t2 on t1.a = t2.a where t1.a between 5 and 24 order by t1.a, t2.a;
|
||||
select /*+use_nl(t1 t2)*/ t1.a, t2.a from t_h3_01_20 t1 full join t_r4_09_28 t2 on t1.a = t2.a order by t1.a, t2.a;
|
||||
select /*+use_nl(t1 t2)*/ t1.a, t2.a from t_h5_01_20 t1 full join t_r5_09_28 t2 on t1.a = t2.a where t1.a between 5 and 24 order by t1.a, t2.a;
|
||||
select /*+use_nl(t1 t2)*/ t1.a, t2.a from t_r4_01_20 t1 full join t_h3_09_28 t2 on t1.a = t2.a order by t1.a, t2.a;
|
||||
select /*+use_nl(t1 t2)*/ t1.a, t2.a from t_r5_01_20 t1 full join t_h5_09_28 t2 on t1.a = t2.a where t1.a between 5 and 24 order by t1.a, t2.a;
|
||||
# merge jion
|
||||
select /*+use_mj(t1 t2)*/ t1.a, t2.a from t_h3_01_20 t1 full join t_h5_09_28 t2 on t1.a = t2.a order by t1.a, t2.a;
|
||||
select /*+use_mj(t1 t2)*/ t1.a, t2.a from t_h5_01_20 t1 full join t_h3_09_28 t2 on t1.a = t2.a where t1.a between 5 and 24 order by t1.a, t2.a;
|
||||
select /*+use_mj(t1 t2)*/ t1.a, t2.a from t_r4_01_20 t1 full join t_r5_09_28 t2 on t1.a = t2.a order by t1.a, t2.a;
|
||||
select /*+use_mj(t1 t2)*/ t1.a, t2.a from t_r5_01_20 t1 full join t_r4_09_28 t2 on t1.a = t2.a where t1.a between 5 and 24 order by t1.a, t2.a;
|
||||
select /*+use_mj(t1 t2)*/ t1.a, t2.a from t_h3_01_20 t1 full join t_r4_09_28 t2 on t1.a = t2.a order by t1.a, t2.a;
|
||||
select /*+use_mj(t1 t2)*/ t1.a, t2.a from t_h5_01_20 t1 full join t_r5_09_28 t2 on t1.a = t2.a where t1.a between 5 and 24 order by t1.a, t2.a;
|
||||
select /*+use_mj(t1 t2)*/ t1.a, t2.a from t_r4_01_20 t1 full join t_h3_09_28 t2 on t1.a = t2.a order by t1.a, t2.a;
|
||||
select /*+use_mj(t1 t2)*/ t1.a, t2.a from t_r5_01_20 t1 full join t_h5_09_28 t2 on t1.a = t2.a where t1.a between 5 and 24 order by t1.a, t2.a;
|
||||
# hash jion
|
||||
select /*+use_hash(t1 t2)*/ t1.a, t2.a from t_h3_01_20 t1 full join t_h5_09_28 t2 on t1.a = t2.a order by t1.a, t2.a;
|
||||
select /*+use_hash(t1 t2)*/ t1.a, t2.a from t_h5_01_20 t1 full join t_h3_09_28 t2 on t1.a = t2.a where t1.a between 5 and 24 order by t1.a, t2.a;
|
||||
select /*+use_hash(t1 t2)*/ t1.a, t2.a from t_r4_01_20 t1 full join t_r5_09_28 t2 on t1.a = t2.a order by t1.a, t2.a;
|
||||
select /*+use_hash(t1 t2)*/ t1.a, t2.a from t_r5_01_20 t1 full join t_r4_09_28 t2 on t1.a = t2.a where t1.a between 5 and 24 order by t1.a, t2.a;
|
||||
select /*+use_hash(t1 t2)*/ t1.a, t2.a from t_h3_01_20 t1 full join t_r4_09_28 t2 on t1.a = t2.a order by t1.a, t2.a;
|
||||
select /*+use_hash(t1 t2)*/ t1.a, t2.a from t_h5_01_20 t1 full join t_r5_09_28 t2 on t1.a = t2.a where t1.a between 5 and 24 order by t1.a, t2.a;
|
||||
select /*+use_hash(t1 t2)*/ t1.a, t2.a from t_r4_01_20 t1 full join t_h3_09_28 t2 on t1.a = t2.a order by t1.a, t2.a;
|
||||
select /*+use_hash(t1 t2)*/ t1.a, t2.a from t_r5_01_20 t1 full join t_h5_09_28 t2 on t1.a = t2.a where t1.a between 5 and 24 order by t1.a, t2.a;
|
||||
|
||||
--source mysql_test/test_suite/executor/include/cleanup.inc
|
||||
@ -0,0 +1,504 @@
|
||||
drop table if exists coll_test;
|
||||
create table coll_test(pk bigint primary key, uc varchar(10) collate utf8_general_ci, ub varchar(10) collate utf8_bin, b varbinary(10));
|
||||
show create table coll_test;
|
||||
Table Create Table
|
||||
coll_test CREATE TABLE `coll_test` (
|
||||
`pk` bigint(20) NOT NULL,
|
||||
`uc` varchar(10) DEFAULT NULL,
|
||||
`ub` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
|
||||
`b` varbinary(10) DEFAULT NULL,
|
||||
PRIMARY KEY (`pk`)
|
||||
) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'lz4_1.0' REPLICA_NUM = NUM BLOCK_SIZE = SIZE USE_BLOOM_FILTER = FALSE TABLET_SIZE = SIZE PCTFREE = 10
|
||||
insert into coll_test values (1314, 'abc', 'def', 'xyz');
|
||||
select * from coll_test;
|
||||
pk uc ub b
|
||||
1314 abc def xyz
|
||||
select collation(concat(null)) from coll_test;
|
||||
collation(concat(null))
|
||||
binary
|
||||
select collation(concat(uc, ub)) from coll_test;
|
||||
collation(concat(uc, ub))
|
||||
utf8mb4_bin
|
||||
select collation(concat(uc, b)) from coll_test;
|
||||
collation(concat(uc, b))
|
||||
binary
|
||||
select collation(concat(uc, x'41')) from coll_test;
|
||||
collation(concat(uc, x'41'))
|
||||
utf8mb4_general_ci
|
||||
select collation(concat('abc', x'41')) from coll_test;
|
||||
collation(concat('abc', x'41'))
|
||||
binary
|
||||
select collation(concat('abc' collate utf8mb4_general_ci, x'41')) from coll_test;
|
||||
collation(concat('abc' collate utf8mb4_general_ci, x'41'))
|
||||
utf8mb4_general_ci
|
||||
select collation(concat(1, 2)) from coll_test;
|
||||
collation(concat(1, 2))
|
||||
utf8mb4_general_ci
|
||||
select collation(concat(1, null)) from coll_test;
|
||||
collation(concat(1, null))
|
||||
utf8mb4_general_ci
|
||||
select collation(group_concat(null)) from coll_test;
|
||||
collation(group_concat(null))
|
||||
binary
|
||||
select collation(group_concat(uc, ub)) from coll_test;
|
||||
collation(group_concat(uc, ub))
|
||||
utf8mb4_bin
|
||||
select collation(group_concat(uc, b)) from coll_test;
|
||||
collation(group_concat(uc, b))
|
||||
binary
|
||||
select collation(group_concat(uc, x'41')) from coll_test;
|
||||
collation(group_concat(uc, x'41'))
|
||||
utf8mb4_general_ci
|
||||
select collation(group_concat('abc', x'41')) from coll_test;
|
||||
collation(group_concat('abc', x'41'))
|
||||
binary
|
||||
select collation(group_concat('abc' collate utf8mb4_general_ci, x'41')) from coll_test;
|
||||
collation(group_concat('abc' collate utf8mb4_general_ci, x'41'))
|
||||
utf8mb4_general_ci
|
||||
select collation(group_concat(1, 2)) from coll_test;
|
||||
collation(group_concat(1, 2))
|
||||
utf8mb4_general_ci
|
||||
select collation(group_concat(1, null)) from coll_test;
|
||||
collation(group_concat(1, null))
|
||||
utf8mb4_general_ci
|
||||
select collation(concat_ws(',', null)) from coll_test;
|
||||
collation(concat_ws(',', null))
|
||||
utf8mb4_general_ci
|
||||
select collation(concat_ws(',', uc, ub)) from coll_test;
|
||||
collation(concat_ws(',', uc, ub))
|
||||
utf8mb4_bin
|
||||
select collation(concat_ws(',', uc, b)) from coll_test;
|
||||
collation(concat_ws(',', uc, b))
|
||||
binary
|
||||
select collation(concat_ws(',', uc, x'41')) from coll_test;
|
||||
collation(concat_ws(',', uc, x'41'))
|
||||
utf8mb4_general_ci
|
||||
select collation(concat_ws(',', 'abc', x'41')) from coll_test;
|
||||
collation(concat_ws(',', 'abc', x'41'))
|
||||
binary
|
||||
select collation(concat_ws(',', 'abc' collate utf8mb4_general_ci, x'41')) from coll_test;
|
||||
collation(concat_ws(',', 'abc' collate utf8mb4_general_ci, x'41'))
|
||||
utf8mb4_general_ci
|
||||
select collation(concat_ws(',', 1, 2)) from coll_test;
|
||||
collation(concat_ws(',', 1, 2))
|
||||
utf8mb4_general_ci
|
||||
select collation(concat_ws(',', 1, null)) from coll_test;
|
||||
collation(concat_ws(',', 1, null))
|
||||
utf8mb4_general_ci
|
||||
select collation(reverse(null)) from coll_test;
|
||||
collation(reverse(null))
|
||||
binary
|
||||
select collation(reverse(uc)) from coll_test;
|
||||
collation(reverse(uc))
|
||||
utf8mb4_general_ci
|
||||
select collation(reverse(ub)) from coll_test;
|
||||
collation(reverse(ub))
|
||||
utf8mb4_bin
|
||||
select collation(reverse(b)) from coll_test;
|
||||
collation(reverse(b))
|
||||
binary
|
||||
select collation(reverse(pk)) from coll_test;
|
||||
collation(reverse(pk))
|
||||
utf8mb4_general_ci
|
||||
select collation(reverse(X'41')) from coll_test;
|
||||
collation(reverse(X'41'))
|
||||
binary
|
||||
select collation(lower(null)) from coll_test;
|
||||
collation(lower(null))
|
||||
binary
|
||||
select collation(lower(uc)) from coll_test;
|
||||
collation(lower(uc))
|
||||
utf8mb4_general_ci
|
||||
select collation(lower(ub)) from coll_test;
|
||||
collation(lower(ub))
|
||||
utf8mb4_bin
|
||||
select collation(lower(b)) from coll_test;
|
||||
collation(lower(b))
|
||||
binary
|
||||
select collation(lower(pk)) from coll_test;
|
||||
collation(lower(pk))
|
||||
utf8mb4_general_ci
|
||||
select collation(lower(X'41')) from coll_test;
|
||||
collation(lower(X'41'))
|
||||
binary
|
||||
select collation(upper(null)) from coll_test;
|
||||
collation(upper(null))
|
||||
binary
|
||||
select collation(upper(uc)) from coll_test;
|
||||
collation(upper(uc))
|
||||
utf8mb4_general_ci
|
||||
select collation(upper(ub)) from coll_test;
|
||||
collation(upper(ub))
|
||||
utf8mb4_bin
|
||||
select collation(upper(b)) from coll_test;
|
||||
collation(upper(b))
|
||||
binary
|
||||
select collation(upper(pk)) from coll_test;
|
||||
collation(upper(pk))
|
||||
utf8mb4_general_ci
|
||||
select collation(upper(X'41')) from coll_test;
|
||||
collation(upper(X'41'))
|
||||
binary
|
||||
select collation(right(null, 2)) from coll_test;
|
||||
collation(right(null, 2))
|
||||
binary
|
||||
select collation(right(uc, 2)) from coll_test;
|
||||
collation(right(uc, 2))
|
||||
utf8mb4_general_ci
|
||||
select collation(right(ub, 2)) from coll_test;
|
||||
collation(right(ub, 2))
|
||||
utf8mb4_bin
|
||||
select collation(right(b, 2)) from coll_test;
|
||||
collation(right(b, 2))
|
||||
binary
|
||||
select collation(right(pk, 2)) from coll_test;
|
||||
collation(right(pk, 2))
|
||||
utf8mb4_general_ci
|
||||
select collation(right(X'41', 2)) from coll_test;
|
||||
collation(right(X'41', 2))
|
||||
binary
|
||||
select collation(substr(null, 2)) from coll_test;
|
||||
collation(substr(null, 2))
|
||||
binary
|
||||
select collation(substr(uc, 2)) from coll_test;
|
||||
collation(substr(uc, 2))
|
||||
utf8mb4_general_ci
|
||||
select collation(substr(ub, 2)) from coll_test;
|
||||
collation(substr(ub, 2))
|
||||
utf8mb4_bin
|
||||
select collation(substr(b, 2)) from coll_test;
|
||||
collation(substr(b, 2))
|
||||
binary
|
||||
select collation(substr(pk, 2)) from coll_test;
|
||||
collation(substr(pk, 2))
|
||||
utf8mb4_general_ci
|
||||
select collation(substr(X'41', 2)) from coll_test;
|
||||
collation(substr(X'41', 2))
|
||||
binary
|
||||
select collation(trim('a' from null)) from coll_test;
|
||||
collation(trim('a' from null))
|
||||
binary
|
||||
select collation(trim('a' from uc)) from coll_test;
|
||||
collation(trim('a' from uc))
|
||||
utf8mb4_general_ci
|
||||
select collation(trim('a' from ub)) from coll_test;
|
||||
collation(trim('a' from ub))
|
||||
utf8mb4_bin
|
||||
select collation(trim('a' from b)) from coll_test;
|
||||
collation(trim('a' from b))
|
||||
binary
|
||||
select collation(trim('a' from pk)) from coll_test;
|
||||
collation(trim('a' from pk))
|
||||
utf8mb4_general_ci
|
||||
select collation(trim('a' from X'41')) from coll_test;
|
||||
collation(trim('a' from X'41'))
|
||||
binary
|
||||
select collation(repeat(null, 2)) from coll_test;
|
||||
collation(repeat(null, 2))
|
||||
binary
|
||||
select collation(repeat(uc, 2)) from coll_test;
|
||||
collation(repeat(uc, 2))
|
||||
utf8mb4_general_ci
|
||||
select collation(repeat(ub, 2)) from coll_test;
|
||||
collation(repeat(ub, 2))
|
||||
utf8mb4_bin
|
||||
select collation(repeat(b, 2)) from coll_test;
|
||||
collation(repeat(b, 2))
|
||||
binary
|
||||
select collation(repeat(pk, 2)) from coll_test;
|
||||
collation(repeat(pk, 2))
|
||||
utf8mb4_general_ci
|
||||
select collation(repeat(X'41', 2)) from coll_test;
|
||||
collation(repeat(X'41', 2))
|
||||
binary
|
||||
select collation(rpad(null, 2, 'a')) from coll_test;
|
||||
collation(rpad(null, 2, 'a'))
|
||||
utf8mb4_general_ci
|
||||
select collation(rpad(uc, 2, ub)) from coll_test;
|
||||
collation(rpad(uc, 2, ub))
|
||||
utf8mb4_bin
|
||||
select collation(rpad(ub, 2, b)) from coll_test;
|
||||
collation(rpad(ub, 2, b))
|
||||
binary
|
||||
select collation(rpad(b, 2, uc)) from coll_test;
|
||||
collation(rpad(b, 2, uc))
|
||||
binary
|
||||
select collation(rpad(pk, 2, uc)) from coll_test;
|
||||
collation(rpad(pk, 2, uc))
|
||||
utf8mb4_general_ci
|
||||
select collation(rpad(X'41', 2, uc)) from coll_test;
|
||||
collation(rpad(X'41', 2, uc))
|
||||
utf8mb4_general_ci
|
||||
select collation(replace(null, b, 'a')) from coll_test;
|
||||
collation(replace(null, b, 'a'))
|
||||
binary
|
||||
select collation(replace(uc, b, ub)) from coll_test;
|
||||
collation(replace(uc, b, ub))
|
||||
binary
|
||||
select collation(replace(ub, uc, ub)) from coll_test;
|
||||
collation(replace(ub, uc, ub))
|
||||
utf8mb4_bin
|
||||
select collation(replace(uc, 'a', 'b')) from coll_test;
|
||||
collation(replace(uc, 'a', 'b'))
|
||||
utf8mb4_general_ci
|
||||
select collation(replace(pk, 1, 2)) from coll_test;
|
||||
collation(replace(pk, 1, 2))
|
||||
utf8mb4_general_ci
|
||||
select collation(replace(X'41', 'a', 'b')) from coll_test;
|
||||
collation(replace(X'41', 'a', 'b'))
|
||||
binary
|
||||
select collation(replace(null, b, 'a')) from coll_test;
|
||||
collation(replace(null, b, 'a'))
|
||||
binary
|
||||
select collation(replace(uc, b, ub)) from coll_test;
|
||||
collation(replace(uc, b, ub))
|
||||
binary
|
||||
select collation(replace(ub, uc, ub)) from coll_test;
|
||||
collation(replace(ub, uc, ub))
|
||||
utf8mb4_bin
|
||||
select collation(replace(uc, 'a', 'b')) from coll_test;
|
||||
collation(replace(uc, 'a', 'b'))
|
||||
utf8mb4_general_ci
|
||||
select collation(replace(pk, 1, 2)) from coll_test;
|
||||
collation(replace(pk, 1, 2))
|
||||
utf8mb4_general_ci
|
||||
select collation(replace(X'41', 'a', 'b')) from coll_test;
|
||||
collation(replace(X'41', 'a', 'b'))
|
||||
binary
|
||||
select collation(substring_index(null, b, 2)) from coll_test;
|
||||
collation(substring_index(null, b, 2))
|
||||
binary
|
||||
select collation(substring_index(uc, b, 2)) from coll_test;
|
||||
collation(substring_index(uc, b, 2))
|
||||
binary
|
||||
select collation(substring_index(ub, uc, 2)) from coll_test;
|
||||
collation(substring_index(ub, uc, 2))
|
||||
utf8mb4_bin
|
||||
select collation(substring_index(ub, b, 2)) from coll_test;
|
||||
collation(substring_index(ub, b, 2))
|
||||
binary
|
||||
select collation(substring_index(uc, 'a', 2)) from coll_test;
|
||||
collation(substring_index(uc, 'a', 2))
|
||||
utf8mb4_general_ci
|
||||
select collation(substring_index(pk, 1, 2)) from coll_test;
|
||||
collation(substring_index(pk, 1, 2))
|
||||
utf8mb4_general_ci
|
||||
select collation(substring_index(X'41', 'a', 2)) from coll_test;
|
||||
collation(substring_index(X'41', 'a', 2))
|
||||
binary
|
||||
select cmp_meta(locate('b' collate utf8mb4_general_ci, 'aBc' collate utf8mb4_general_ci));
|
||||
cmp_meta(locate('b' collate utf8mb4_general_ci, 'aBc' collate utf8mb4_general_ci))
|
||||
{type:"BIGINT", collation:"binary", coercibility:"NUMERIC"}
|
||||
select cmp_meta(locate('b' collate utf8mb4_bin, 'aBc' collate utf8mb4_bin));
|
||||
cmp_meta(locate('b' collate utf8mb4_bin, 'aBc' collate utf8mb4_bin))
|
||||
{type:"BIGINT", collation:"binary", coercibility:"NUMERIC"}
|
||||
select cmp_meta(locate('b', 'aBc'));
|
||||
cmp_meta(locate('b', 'aBc'))
|
||||
{type:"BIGINT", collation:"binary", coercibility:"NUMERIC"}
|
||||
select cmp_meta(locate('b' collate utf8mb4_general_ci, 'aBc' collate utf8mb4_general_ci, 1));
|
||||
cmp_meta(locate('b' collate utf8mb4_general_ci, 'aBc' collate utf8mb4_general_ci, 1))
|
||||
{type:"BIGINT", collation:"binary", coercibility:"NUMERIC"}
|
||||
select cmp_meta(locate('b' collate utf8mb4_bin, 'aBc' collate utf8mb4_bin, 1));
|
||||
cmp_meta(locate('b' collate utf8mb4_bin, 'aBc' collate utf8mb4_bin, 1))
|
||||
{type:"BIGINT", collation:"binary", coercibility:"NUMERIC"}
|
||||
select cmp_meta(locate('b', 'aBc', 1));
|
||||
cmp_meta(locate('b', 'aBc', 1))
|
||||
{type:"BIGINT", collation:"binary", coercibility:"NUMERIC"}
|
||||
select cmp_meta(locate(uc, ub)) from coll_test;
|
||||
cmp_meta(locate(uc, ub))
|
||||
{type:"BIGINT", collation:"binary", coercibility:"NUMERIC"}
|
||||
select cmp_meta(locate(uc, b)) from coll_test;
|
||||
cmp_meta(locate(uc, b))
|
||||
{type:"BIGINT", collation:"binary", coercibility:"NUMERIC"}
|
||||
select cmp_meta(locate(b, b)) from coll_test;
|
||||
cmp_meta(locate(b, b))
|
||||
{type:"BIGINT", collation:"binary", coercibility:"NUMERIC"}
|
||||
select cmp_meta(locate(b, pk)) from coll_test;
|
||||
cmp_meta(locate(b, pk))
|
||||
{type:"BIGINT", collation:"binary", coercibility:"NUMERIC"}
|
||||
select cmp_meta(instr('abc' collate utf8_bin, 'B' collate utf8_bin));
|
||||
cmp_meta(instr('abc' collate utf8_bin, 'B' collate utf8_bin))
|
||||
{type:"BIGINT", collation:"binary", coercibility:"NUMERIC"}
|
||||
select cmp_meta(instr('abc' collate utf8_general_ci, 'B' collate utf8_general_ci));
|
||||
cmp_meta(instr('abc' collate utf8_general_ci, 'B' collate utf8_general_ci))
|
||||
{type:"BIGINT", collation:"binary", coercibility:"NUMERIC"}
|
||||
select cmp_meta(instr('abc', 'B'));
|
||||
cmp_meta(instr('abc', 'B'))
|
||||
{type:"BIGINT", collation:"binary", coercibility:"NUMERIC"}
|
||||
select collation(current_user());
|
||||
collation(current_user())
|
||||
utf8mb4_general_ci
|
||||
select coercibility(current_user());
|
||||
coercibility(current_user())
|
||||
3
|
||||
select collation(database());
|
||||
collation(database())
|
||||
utf8mb4_general_ci
|
||||
select coercibility(database());
|
||||
coercibility(database())
|
||||
3
|
||||
select collation(conv(null, 10, 8));
|
||||
collation(conv(null, 10, 8))
|
||||
utf8mb4_general_ci
|
||||
select collation(conv(1024, 10, 8));
|
||||
collation(conv(1024, 10, 8))
|
||||
utf8mb4_general_ci
|
||||
select collation(bin(null));
|
||||
collation(bin(null))
|
||||
utf8mb4_general_ci
|
||||
select collation(bin(uc)) from coll_test;
|
||||
collation(bin(uc))
|
||||
utf8mb4_general_ci
|
||||
select collation(bin(pk)) from coll_test;
|
||||
collation(bin(pk))
|
||||
utf8mb4_general_ci
|
||||
select collation(bin(b)) from coll_test;
|
||||
collation(bin(b))
|
||||
utf8mb4_general_ci
|
||||
select collation(effective_tenant());
|
||||
collation(effective_tenant())
|
||||
utf8mb4_general_ci
|
||||
select coercibility(effective_tenant());
|
||||
coercibility(effective_tenant())
|
||||
3
|
||||
select collation(uc like b) from coll_test;
|
||||
collation(uc like b)
|
||||
binary
|
||||
select cmp_meta(uc like b) from coll_test;
|
||||
cmp_meta(uc like b)
|
||||
{type:"BIGINT", collation:"binary", coercibility:"NUMERIC"}
|
||||
select cmp_meta(uc like ub) from coll_test;
|
||||
cmp_meta(uc like ub)
|
||||
{type:"BIGINT", collation:"binary", coercibility:"NUMERIC"}
|
||||
select cmp_meta(b like b) from coll_test;
|
||||
cmp_meta(b like b)
|
||||
{type:"BIGINT", collation:"binary", coercibility:"NUMERIC"}
|
||||
select cmp_meta(uc like b) from coll_test;
|
||||
cmp_meta(uc like b)
|
||||
{type:"BIGINT", collation:"binary", coercibility:"NUMERIC"}
|
||||
select collation(cast(uc as binary)) from coll_test;
|
||||
collation(cast(uc as binary))
|
||||
binary
|
||||
select collation(cast(pk as char)) from coll_test;
|
||||
collation(cast(pk as char))
|
||||
utf8mb4_general_ci
|
||||
select uc, collation(binary uc) from coll_test;
|
||||
uc collation(binary uc)
|
||||
abc binary
|
||||
select collation(binary binary uc collate utf8_bin) from coll_test;
|
||||
collation(binary binary uc collate utf8_bin)
|
||||
binary
|
||||
select collation(user());
|
||||
collation(user())
|
||||
utf8mb4_general_ci
|
||||
select coercibility(user());
|
||||
coercibility(user())
|
||||
3
|
||||
select collation(version());
|
||||
collation(version())
|
||||
utf8mb4_general_ci
|
||||
select coercibility(version());
|
||||
coercibility(version())
|
||||
3
|
||||
select collation(unhex('42'));
|
||||
collation(unhex('42'))
|
||||
binary
|
||||
select collation(unhex(null));
|
||||
collation(unhex(null))
|
||||
binary
|
||||
select collation(uc regexp b) from coll_test;
|
||||
collation(uc regexp b)
|
||||
binary
|
||||
select cmp_meta(uc regexp b) from coll_test;
|
||||
cmp_meta(uc regexp b)
|
||||
{type:"INT", collation:"binary", coercibility:"NUMERIC"}
|
||||
select cmp_meta(uc regexp ub) from coll_test;
|
||||
cmp_meta(uc regexp ub)
|
||||
{type:"INT", collation:"binary", coercibility:"NUMERIC"}
|
||||
select cmp_meta(b regexp b) from coll_test;
|
||||
cmp_meta(b regexp b)
|
||||
{type:"INT", collation:"binary", coercibility:"NUMERIC"}
|
||||
select cmp_meta(uc regexp b) from coll_test;
|
||||
cmp_meta(uc regexp b)
|
||||
{type:"INT", collation:"binary", coercibility:"NUMERIC"}
|
||||
select cmp_meta(uc regexp 'abc') from coll_test;
|
||||
cmp_meta(uc regexp 'abc')
|
||||
{type:"INT", collation:"binary", coercibility:"NUMERIC"}
|
||||
select collation(quote(uc)) from coll_test;
|
||||
collation(quote(uc))
|
||||
utf8mb4_general_ci
|
||||
select collation(quote(ub)) from coll_test;
|
||||
collation(quote(ub))
|
||||
utf8mb4_bin
|
||||
select collation(quote(b)) from coll_test;
|
||||
collation(quote(b))
|
||||
binary
|
||||
select collation(quote(pk)) from coll_test;
|
||||
collation(quote(pk))
|
||||
utf8mb4_general_ci
|
||||
select collation(quote(null)) from coll_test;
|
||||
collation(quote(null))
|
||||
binary
|
||||
select collation(md5(uc)) from coll_test;
|
||||
collation(md5(uc))
|
||||
utf8mb4_general_ci
|
||||
select collation(md5(ub)) from coll_test;
|
||||
collation(md5(ub))
|
||||
utf8mb4_general_ci
|
||||
select collation(md5(b)) from coll_test;
|
||||
collation(md5(b))
|
||||
utf8mb4_general_ci
|
||||
select collation(md5(pk)) from coll_test;
|
||||
collation(md5(pk))
|
||||
utf8mb4_general_ci
|
||||
select collation(md5(null)) from coll_test;
|
||||
collation(md5(null))
|
||||
utf8mb4_general_ci
|
||||
select collation(dump(null)) from coll_test;
|
||||
collation(dump(null))
|
||||
binary
|
||||
select collation(hex(uc)) from coll_test;
|
||||
collation(hex(uc))
|
||||
utf8mb4_general_ci
|
||||
select collation(hex(ub)) from coll_test;
|
||||
collation(hex(ub))
|
||||
utf8mb4_general_ci
|
||||
select collation(hex(b)) from coll_test;
|
||||
collation(hex(b))
|
||||
utf8mb4_general_ci
|
||||
select collation(hex(pk)) from coll_test;
|
||||
collation(hex(pk))
|
||||
utf8mb4_general_ci
|
||||
select collation(hex(null)) from coll_test;
|
||||
collation(hex(null))
|
||||
utf8mb4_general_ci
|
||||
select collation(int2ip(pk)) from coll_test;
|
||||
collation(int2ip(pk))
|
||||
utf8mb4_general_ci
|
||||
select collation(int2ip(null)) from coll_test;
|
||||
collation(int2ip(null))
|
||||
utf8mb4_general_ci
|
||||
SELECT collation(DATE_FORMAT('2009-10-04 22:23:00', '%W %M %Y'));
|
||||
collation(DATE_FORMAT('2009-10-04 22:23:00', '%W %M %Y'))
|
||||
utf8mb4_general_ci
|
||||
set collation_connection = utf8mb4_general_ci;
|
||||
select collation(cast(1 as char));
|
||||
collation(cast(1 as char))
|
||||
utf8mb4_general_ci
|
||||
SELECT collation(DATE_FORMAT('2009-10-04 22:23:00', '%W %M %Y'));
|
||||
collation(DATE_FORMAT('2009-10-04 22:23:00', '%W %M %Y'))
|
||||
utf8mb4_general_ci
|
||||
select collation(cast('A' as char)), cast('A' as char) < 'a';
|
||||
collation(cast('A' as char)) cast('A' as char) < 'a'
|
||||
utf8mb4_general_ci 0
|
||||
set collation_connection = utf8mb4_bin;
|
||||
select collation(cast(1 as char));
|
||||
collation(cast(1 as char))
|
||||
utf8mb4_bin
|
||||
SELECT collation(DATE_FORMAT('2009-10-04 22:23:00', '%W %M %Y'));
|
||||
collation(DATE_FORMAT('2009-10-04 22:23:00', '%W %M %Y'))
|
||||
utf8mb4_bin
|
||||
select collation(cast('A' as char)), cast('A' as char) < 'a';
|
||||
collation(cast('A' as char)) cast('A' as char) < 'a'
|
||||
utf8mb4_bin 1
|
||||
drop table coll_test;
|
||||
127
tools/deploy/mysql_test/test_suite/expr/r/mysql/expr_ceil.result
Normal file
127
tools/deploy/mysql_test/test_suite/expr/r/mysql/expr_ceil.result
Normal file
@ -0,0 +1,127 @@
|
||||
================ expression ceil ================
|
||||
drop table if exists test;
|
||||
create table test (pk int primary key, c1 tinyint, c2 smallint, c3 mediumint, c4 int, c5 bigint, c6 tinyint unsigned, c7 smallint unsigned, c8 mediumint unsigned, c9 int unsigned, c10 bigint unsigned, c11 float, c12 double, c13 float unsigned, c14 double unsigned, c15 decimal(20, 10), c16 decimal(20, 10) unsigned, c17 datetime(6), c18 timestamp(6) default "2012-01-01 12:00:00", c19 date, c20 time, c21 year , c22 varchar(10000), c23 char(255), c24 varbinary(10000), c25 binary(255));
|
||||
insert into test values (0, -128, 2, -3, 4, -5, 6, 7, 8, 9, 10, -11.49, -12.5, 13.5, 14.49, 15.99, 16.1, '2017-01-01 00:01:10.123456', '2018-02-02 00:02:20.123456', '2019-03-03', '20:04:40.123456', '2021', '22.5324', '-23.436456', '-24', '25');
|
||||
insert into test values (1, 1, -2, 3, -4, 5, 6, 7, 8, 9, 10, -11.49, -12.5, 13.5, 14.49, 15.99, 16.1, '2017-01-01 00:01:10.123456', '2018-02-02 00:02:20.123456', '2019-03-03', '20:04:40.123456', '2021', '-22.999999', '23.00001', '24.9999', '-25.00001');
|
||||
insert into test values (2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
select ceil(pk), ceil(c1), ceil(c2), ceil(c3), ceil(c4), ceil(c5), ceil(c6), ceil(c7), ceil(c8), ceil(c9), ceil(c10), ceil(c11), ceil(c12), ceil(c13), ceil(c14), ceil(c15), ceil(c16), ceil(c22), ceil(c23), ceil(c24), ceil(c25) from test;
|
||||
ceil(pk) ceil(c1) ceil(c2) ceil(c3) ceil(c4) ceil(c5) ceil(c6) ceil(c7) ceil(c8) ceil(c9) ceil(c10) ceil(c11) ceil(c12) ceil(c13) ceil(c14) ceil(c15) ceil(c16) ceil(c22) ceil(c23) ceil(c24) ceil(c25)
|
||||
0 -128 2 -3 4 -5 6 7 8 9 10 -11 -12 14 15 16 17 23 -23 -24 25
|
||||
1 1 -2 3 -4 5 6 7 8 9 10 -11 -12 14 15 16 17 -22 24 25 -25
|
||||
2 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: '25'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: '-25.00001'
|
||||
drop table if exists test;
|
||||
select ceil(3.1415926);
|
||||
ceil(3.1415926)
|
||||
4
|
||||
select ceil(-3.1415926);
|
||||
ceil(-3.1415926)
|
||||
-3
|
||||
select ceil(0.00);
|
||||
ceil(0.00)
|
||||
0
|
||||
select ceil(-0.0);
|
||||
ceil(-0.0)
|
||||
0
|
||||
select ceil(0.123456789);
|
||||
ceil(0.123456789)
|
||||
1
|
||||
select ceil(-0.123456789);
|
||||
ceil(-0.123456789)
|
||||
0
|
||||
select ceil(123456789.123456789);
|
||||
ceil(123456789.123456789)
|
||||
123456790
|
||||
select ceil(-99999999.999999999);
|
||||
ceil(-99999999.999999999)
|
||||
-99999999
|
||||
select ceil(999999999.123456789);
|
||||
ceil(999999999.123456789)
|
||||
1000000000
|
||||
select ceil(-999999999.123456789);
|
||||
ceil(-999999999.123456789)
|
||||
-999999999
|
||||
select ceil(-123456789123456789123456789.123456789);
|
||||
ceil(-123456789123456789123456789.123456789)
|
||||
-123456789123456789123456789
|
||||
select ceil(123456789123456789123456789123456789123456789123456789.123456789);
|
||||
ceil(123456789123456789123456789123456789123456789123456789.123456789)
|
||||
123456789123456789123456789123456789123456789123456790
|
||||
select ceil(-123456789123456789123456789123456789123456789123456789.123456789);
|
||||
ceil(-123456789123456789123456789123456789123456789123456789.123456789)
|
||||
-123456789123456789123456789123456789123456789123456789
|
||||
select ceil(123456789123456789123456789.123456789123456789123456789123456789);
|
||||
ceil(123456789123456789123456789.123456789123456789123456789123456789)
|
||||
123456789123456789123456790
|
||||
select ceil(-123456789123456789123456789.123456789123456789123456789123456789);
|
||||
ceil(-123456789123456789123456789.123456789123456789123456789123456789)
|
||||
-123456789123456789123456789
|
||||
select ceil(-123456789123456789123456789.123456789);
|
||||
ceil(-123456789123456789123456789.123456789)
|
||||
-123456789123456789123456789
|
||||
select ceil(999999999999999999999999999999999999999999999.499999999);
|
||||
ceil(999999999999999999999999999999999999999999999.499999999)
|
||||
1000000000000000000000000000000000000000000000
|
||||
select ceil(999999999999999999999999999999999999999999999.500000001);
|
||||
ceil(999999999999999999999999999999999999999999999.500000001)
|
||||
1000000000000000000000000000000000000000000000
|
||||
select ceil(99999999999999999999999999999999999999999999.399999999);
|
||||
ceil(99999999999999999999999999999999999999999999.399999999)
|
||||
100000000000000000000000000000000000000000000
|
||||
select ceil(-99999999999999999999999999999999999999999999.399999999);
|
||||
ceil(-99999999999999999999999999999999999999999999.399999999)
|
||||
-99999999999999999999999999999999999999999999
|
||||
select ceil(-99999999999999999999999999999999999999999999.399999999);
|
||||
ceil(-99999999999999999999999999999999999999999999.399999999)
|
||||
-99999999999999999999999999999999999999999999
|
||||
select ceil(999999999999999999999999999999999999999999999211111.399999999);
|
||||
ceil(999999999999999999999999999999999999999999999211111.399999999)
|
||||
999999999999999999999999999999999999999999999211112
|
||||
select ceil(-999999999999999999999999999999999999999999999211111.399999999);
|
||||
ceil(-999999999999999999999999999999999999999999999211111.399999999)
|
||||
-999999999999999999999999999999999999999999999211111
|
||||
select ceil(-999999999999999999999999999999999999999999999511111.399999999);
|
||||
ceil(-999999999999999999999999999999999999999999999511111.399999999)
|
||||
-999999999999999999999999999999999999999999999511111
|
||||
select ceil(-999999999999999999999999999999999999999999999499999.399999999);
|
||||
ceil(-999999999999999999999999999999999999999999999499999.399999999)
|
||||
-999999999999999999999999999999999999999999999499999
|
||||
select ceil(-1);
|
||||
ceil(-1)
|
||||
-1
|
||||
select ceil(-161);
|
||||
ceil(-161)
|
||||
-161
|
||||
select ceil(null);
|
||||
ceil(null)
|
||||
NULL
|
||||
select ceil("13547370213547370213547370213547370201354737021354737021354737021354737021354737021354737021354737021354737021354737021354737021354737021354737021354737020.0000135473702135473702135473702135473702135473702135473702135473702135473702013547370213547370201354737021354737021354737021354737021354737021354737021354737021.0000135473702135473702135473702135473702135473702111111111111111111");
|
||||
ceil("13547370213547370213547370213547370201354737021354737021354737021354737021354737021354737021354737021354737021354737021354737021354737021354737021354737020.000013547370213547370213547370213547370213547370213547370213547370213547370201354737021354737
|
||||
13547370213547370000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: '13547370213547370213547370213547370201354737021354737021354737021354737021354737021354737021354737021354737021354737021354737021354737021354737021354737020.0000135473702135473702135473702135473702135473702135473702135473702135473702013547370213547370201354737021354737021354737021354737021354737021354737021354737021.0000135473702135473702135473702135473702135473702111111111111111111'
|
||||
select ceil("13547370213547370213547370213547370201354737021354737021354737021354737021354737021354737021354737021354737021354737021354737021354737021354737021354737020.0000135473702135473702135473702135473702135473702135473702135473702135473702013547370213547370201354737021354737021354737021354737021354737021354737021354737021.0000135473702135473702135473702135473702135473702catters billet chloroplast's'");
|
||||
ceil("13547370213547370213547370213547370201354737021354737021354737021354737021354737021354737021354737021354737021354737021354737021354737021354737021354737020.000013547370213547370213547370213547370213547370213547370213547370213547370201354737021354737
|
||||
13547370213547370000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: '13547370213547370213547370213547370201354737021354737021354737021354737021354737021354737021354737021354737021354737021354737021354737021354737021354737020.0000135473702135473702135473702135473702135473702135473702135473702135473702013547370213547370201354737021354737021354737021354737021354737021354737021354737021.0000135473702135473702135473702135473702135473702catters billet chloroplast's''
|
||||
drop table if exists t1;
|
||||
CREATE TABLE t1(id int,consumer char(20), price varchar(20),sal int,datetime1 DATE,datetime2 bigint);
|
||||
INSERT INTO t1 VALUES(1,'苹果','6500',5000,'2020-09-22 12:11:59',20200923121200);
|
||||
INSERT INTO t1 VALUES(2,'小米','3000',4000,'2020-09-21 10:11:59',20200921101159);
|
||||
INSERT INTO t1 VALUES(3,'OPPO','5000',3000,'2020-08-21 10:11:59',20190821101159);
|
||||
INSERT INTO t1 VALUES(4,'华为','9111',10000,'2020-02-29 10:11:59',20200228101159);
|
||||
SELECT CEIL(rpad(price,20,sal)) FROM t1 ORDER BY id;
|
||||
CEIL(rpad(price,20,sal))
|
||||
65005000500050000000
|
||||
30004000400040006000
|
||||
50003000300030000000
|
||||
91111000010000100000
|
||||
SELECT rpad(CEIL(sal),20,CEIL(price)) FROM t1 ORDER BY id;
|
||||
rpad(CEIL(sal),20,CEIL(price))
|
||||
50006500650065006500
|
||||
40003000300030003000
|
||||
30005000500050005000
|
||||
10000911191119111911
|
||||
@ -0,0 +1,287 @@
|
||||
================ expression convert_tz ================
|
||||
SELECT CONVERT_TZ('2021-01-01 12:00:00','+00:00','+08:00');
|
||||
CONVERT_TZ('2021-01-01 12:00:00','+00:00','+08:00')
|
||||
2021-01-01 20:00:00.000000
|
||||
SELECT CONVERT_TZ('2021-01-01 12:00:00','+01:00','+08:00');
|
||||
CONVERT_TZ('2021-01-01 12:00:00','+01:00','+08:00')
|
||||
2021-01-01 19:00:00.000000
|
||||
SELECT CONVERT_TZ('2021-01-01 12:00:00','+01:00','+06:30');
|
||||
CONVERT_TZ('2021-01-01 12:00:00','+01:00','+06:30')
|
||||
2021-01-01 17:30:00.000000
|
||||
SELECT CONVERT_TZ('2021-01-01 12:00:00','+01:00','+10:10');
|
||||
CONVERT_TZ('2021-01-01 12:00:00','+01:00','+10:10')
|
||||
2021-01-01 21:10:00.000000
|
||||
SELECT CONVERT_TZ('2021-01-01 12:00:00','+01:30','+13:00');
|
||||
CONVERT_TZ('2021-01-01 12:00:00','+01:30','+13:00')
|
||||
2021-01-01 23:30:00.000000
|
||||
SELECT CONVERT_TZ('2021-01-01 12:00:00','-11:30','+13:00');
|
||||
CONVERT_TZ('2021-01-01 12:00:00','-11:30','+13:00')
|
||||
2021-01-02 12:30:00.000000
|
||||
SELECT CONVERT_TZ('2021-01-01 12:00:00','-12:00','+13:00');
|
||||
CONVERT_TZ('2021-01-01 12:00:00','-12:00','+13:00')
|
||||
2021-01-02 13:00:00.000000
|
||||
SELECT CONVERT_TZ('2021-01-01 00:00:00','-12:00','+13:00');
|
||||
CONVERT_TZ('2021-01-01 00:00:00','-12:00','+13:00')
|
||||
2021-01-02 01:00:00.000000
|
||||
SELECT CONVERT_TZ('2021-01-01 23:59:59','-12:00','+13:00');
|
||||
CONVERT_TZ('2021-01-01 23:59:59','-12:00','+13:00')
|
||||
2021-01-03 00:59:59.000000
|
||||
SELECT CONVERT_TZ('2021-01-01 13:19:38','-10:38','+10:12');
|
||||
CONVERT_TZ('2021-01-01 13:19:38','-10:38','+10:12')
|
||||
2021-01-02 10:09:38.000000
|
||||
SELECT CONVERT_TZ('2021-01-01 12:23:35','-09:23','-11:11');
|
||||
CONVERT_TZ('2021-01-01 12:23:35','-09:23','-11:11')
|
||||
2021-01-01 10:35:35.000000
|
||||
SELECT CONVERT_TZ('2021-01-01 00:01:00','+10:00','-11:00');
|
||||
CONVERT_TZ('2021-01-01 00:01:00','+10:00','-11:00')
|
||||
2020-12-31 03:01:00.000000
|
||||
SELECT CONVERT_TZ('2021-01-01 00:11:00','+00:00','-11:00');
|
||||
CONVERT_TZ('2021-01-01 00:11:00','+00:00','-11:00')
|
||||
2020-12-31 13:11:00.000000
|
||||
SELECT CONVERT_TZ('2021-03-01 00:11:00','+00:00','-11:00');
|
||||
CONVERT_TZ('2021-03-01 00:11:00','+00:00','-11:00')
|
||||
2021-02-28 13:11:00.000000
|
||||
SELECT CONVERT_TZ('2021-06-01 00:11:00','+00:00','-11:00');
|
||||
CONVERT_TZ('2021-06-01 00:11:00','+00:00','-11:00')
|
||||
2021-05-31 13:11:00.000000
|
||||
SELECT CONVERT_TZ('2020-03-01 00:11:00','+00:00','-11:00');
|
||||
CONVERT_TZ('2020-03-01 00:11:00','+00:00','-11:00')
|
||||
2020-02-29 13:11:00.000000
|
||||
SELECT CONVERT_TZ('2020-02-28 23:11:00','-00:00','+11:00');
|
||||
CONVERT_TZ('2020-02-28 23:11:00','-00:00','+11:00')
|
||||
2020-02-29 10:11:00.000000
|
||||
SELECT CONVERT_TZ('2020-12-31 23:11:00','-05:00','+11:00');
|
||||
CONVERT_TZ('2020-12-31 23:11:00','-05:00','+11:00')
|
||||
2021-01-01 15:11:00.000000
|
||||
SELECT CONVERT_TZ('2020-12-31 23:11:00',null,'+11:00');
|
||||
CONVERT_TZ('2020-12-31 23:11:00',null,'+11:00')
|
||||
NULL
|
||||
SELECT CONVERT_TZ('2020-12-31 23:11:00','+11:00', null);
|
||||
CONVERT_TZ('2020-12-31 23:11:00','+11:00', null)
|
||||
NULL
|
||||
SELECT CONVERT_TZ(null,'-13:00','+11:00');
|
||||
CONVERT_TZ(null,'-13:00','+11:00')
|
||||
NULL
|
||||
SELECT CONVERT_TZ(null, null,'+11:00');
|
||||
CONVERT_TZ(null, null,'+11:00')
|
||||
NULL
|
||||
SELECT CONVERT_TZ(null, null, null);
|
||||
CONVERT_TZ(null, null, null)
|
||||
NULL
|
||||
SELECT CONVERT_TZ('2020-12-31 23:11:00','America/Merida','Asia/Tokyo');
|
||||
CONVERT_TZ('2020-12-31 23:11:00','America/Merida','Asia/Tokyo')
|
||||
2021-01-01 14:11:00.000000
|
||||
SELECT CONVERT_TZ('2021-01-01 00:11:00','America/Merida','Australia/Darwin');
|
||||
CONVERT_TZ('2021-01-01 00:11:00','America/Merida','Australia/Darwin')
|
||||
2021-01-01 15:41:00.000000
|
||||
SELECT CONVERT_TZ('2021-01-01 00:11:00','America/Merida','Europe/Amsterdam');
|
||||
CONVERT_TZ('2021-01-01 00:11:00','America/Merida','Europe/Amsterdam')
|
||||
2021-01-01 07:11:00.000000
|
||||
SELECT CONVERT_TZ('2021-01-01 07:11:00','Europe/Amsterdam','America/Merida');
|
||||
CONVERT_TZ('2021-01-01 07:11:00','Europe/Amsterdam','America/Merida')
|
||||
2021-01-01 00:11:00.000000
|
||||
SELECT CONVERT_TZ('2021-01-01 07:11:00','MET','Libya');
|
||||
CONVERT_TZ('2021-01-01 07:11:00','MET','Libya')
|
||||
2021-01-01 08:11:00.000000
|
||||
SELECT CONVERT_TZ('2021-01-01 07:11:00','MET','MST');
|
||||
CONVERT_TZ('2021-01-01 07:11:00','MET','MST')
|
||||
2020-12-31 23:11:00.000000
|
||||
SELECT CONVERT_TZ('2021-01-01 07:11:00','PRC','MST');
|
||||
CONVERT_TZ('2021-01-01 07:11:00','PRC','MST')
|
||||
2020-12-31 16:11:00.000000
|
||||
SELECT CONVERT_TZ('2021-01-01 07:11:00','PRC','ROC');
|
||||
CONVERT_TZ('2021-01-01 07:11:00','PRC','ROC')
|
||||
2021-01-01 07:11:00.000000
|
||||
SELECT CONVERT_TZ('2021-01-01 07:11:00','UCT','ROC');
|
||||
CONVERT_TZ('2021-01-01 07:11:00','UCT','ROC')
|
||||
2021-01-01 15:11:00.000000
|
||||
SELECT CONVERT_TZ('2021-01-01 07:11:00','Universal','ROC');
|
||||
CONVERT_TZ('2021-01-01 07:11:00','Universal','ROC')
|
||||
2021-01-01 15:11:00.000000
|
||||
SELECT CONVERT_TZ('2021-01-01 07:11:00','Pacific/Marquesas','ROC');
|
||||
CONVERT_TZ('2021-01-01 07:11:00','Pacific/Marquesas','ROC')
|
||||
2021-01-02 00:41:00.000000
|
||||
SELECT CONVERT_TZ('2021-02-28 17:11:00','GMT+0','ROC');
|
||||
CONVERT_TZ('2021-02-28 17:11:00','GMT+0','ROC')
|
||||
2021-03-01 01:11:00.000000
|
||||
SELECT CONVERT_TZ('2021-02-28 17:11:00','GMT+0','Singapore');
|
||||
CONVERT_TZ('2021-02-28 17:11:00','GMT+0','Singapore')
|
||||
2021-03-01 01:11:00.000000
|
||||
SELECT CONVERT_TZ('2021-02-28 17:11:00','US/Michigan','ROC');
|
||||
CONVERT_TZ('2021-02-28 17:11:00','US/Michigan','ROC')
|
||||
2021-03-01 06:11:00.000000
|
||||
SELECT CONVERT_TZ('2021-02-28 17:11:00', null,'ROC');
|
||||
CONVERT_TZ('2021-02-28 17:11:00', null,'ROC')
|
||||
NULL
|
||||
SELECT CONVERT_TZ('2021-02-28 17:11:00','US/Michigan', null);
|
||||
CONVERT_TZ('2021-02-28 17:11:00','US/Michigan', null)
|
||||
NULL
|
||||
SELECT CONVERT_TZ('2021-02-28 17:11:00', null, null);
|
||||
CONVERT_TZ('2021-02-28 17:11:00', null, null)
|
||||
NULL
|
||||
SELECT CONVERT_TZ('2021-02-28 17:11:00', '+00:00','ROC');
|
||||
CONVERT_TZ('2021-02-28 17:11:00', '+00:00','ROC')
|
||||
2021-03-01 01:11:00.000000
|
||||
SELECT CONVERT_TZ('2021-02-28 17:11:00', '+00:00','US/Michigan');
|
||||
CONVERT_TZ('2021-02-28 17:11:00', '+00:00','US/Michigan')
|
||||
2021-02-28 12:11:00.000000
|
||||
SELECT CONVERT_TZ('2021-02-28 17:11:00', 'ROC','+00:00');
|
||||
CONVERT_TZ('2021-02-28 17:11:00', 'ROC','+00:00')
|
||||
2021-02-28 09:11:00.000000
|
||||
SELECT CONVERT_TZ('2021-02-28 17:11:00', 'US/Michigan', '+00:00');
|
||||
CONVERT_TZ('2021-02-28 17:11:00', 'US/Michigan', '+00:00')
|
||||
2021-02-28 22:11:00.000000
|
||||
SELECT CONVERT_TZ('2021-02-28 17:11:00', 'ROC','+12:58');
|
||||
CONVERT_TZ('2021-02-28 17:11:00', 'ROC','+12:58')
|
||||
2021-02-28 22:09:00.000000
|
||||
SELECT CONVERT_TZ('2021-01-01 07:11:00', 'UCT','-12:58');
|
||||
CONVERT_TZ('2021-01-01 07:11:00', 'UCT','-12:58')
|
||||
2020-12-31 18:13:00.000000
|
||||
SELECT CONVERT_TZ('2021-01-01 07:11:00', '-12:58','UCT');
|
||||
CONVERT_TZ('2021-01-01 07:11:00', '-12:58','UCT')
|
||||
2021-01-01 20:09:00.000000
|
||||
SELECT CONVERT_TZ('2021-01-01 07:11:00', '-12:58','US/Michigan');
|
||||
CONVERT_TZ('2021-01-01 07:11:00', '-12:58','US/Michigan')
|
||||
2021-01-01 15:09:00.000000
|
||||
SELECT CONVERT_TZ('2021-01-01 07:11:00', '+05:12','MET');
|
||||
CONVERT_TZ('2021-01-01 07:11:00', '+05:12','MET')
|
||||
2021-01-01 02:59:00.000000
|
||||
SELECT CONVERT_TZ('2021-01-01 07:11:00', '+03:32','PRC');
|
||||
CONVERT_TZ('2021-01-01 07:11:00', '+03:32','PRC')
|
||||
2021-01-01 11:39:00.000000
|
||||
SELECT CONVERT_TZ('2021-01-01 07:11:00', '+11:32','PRC');
|
||||
CONVERT_TZ('2021-01-01 07:11:00', '+11:32','PRC')
|
||||
2021-01-01 03:39:00.000000
|
||||
SELECT CONVERT_TZ('2004-01-01 12:00:00','-13:00','+10:00');
|
||||
CONVERT_TZ('2004-01-01 12:00:00','-13:00','+10:00')
|
||||
NULL
|
||||
SELECT CONVERT_TZ('2004-01-01 12:00:00','-12:00','+14:00');
|
||||
CONVERT_TZ('2004-01-01 12:00:00','-12:00','+14:00')
|
||||
NULL
|
||||
SELECT CONVERT_TZ('2004-01-01 12:00:00','-13:00','ABC');
|
||||
CONVERT_TZ('2004-01-01 12:00:00','-13:00','ABC')
|
||||
NULL
|
||||
SELECT CONVERT_TZ('2004-01-01 12:00:00','-12:00','OK');
|
||||
CONVERT_TZ('2004-01-01 12:00:00','-12:00','OK')
|
||||
NULL
|
||||
drop table if exists t;
|
||||
create table t(c1 timestamp);
|
||||
insert into t values(CONVERT_TZ('2004-01-01 12:00:00','-13:00','+10:00'));
|
||||
insert into t values(CONVERT_TZ('2004-01-01 12:00:00','-12:00','+14:00'));
|
||||
insert into t values(CONVERT_TZ('2004-01-01 12:00:00','-13:00','ABC'));
|
||||
insert into t values(CONVERT_TZ('2004-01-01 12:00:00','-12:00','OK'));
|
||||
select * from t;
|
||||
c1
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
delete from t;
|
||||
select convert_tz('9999-12-31 20:00:00', '+02:00', '+06:00');
|
||||
convert_tz('9999-12-31 20:00:00', '+02:00', '+06:00')
|
||||
NULL
|
||||
select convert_tz('0000-01-01 01:00:00', '+00:00', '-02:00');
|
||||
convert_tz('0000-01-01 01:00:00', '+00:00', '-02:00')
|
||||
NULL
|
||||
insert into t values(convert_tz('9999-12-31 20:00:00', '+02:00', '+06:00'));
|
||||
insert into t values(convert_tz('0000-01-01 01:00:00', '+00:00', '-02:00'));
|
||||
select * from t;
|
||||
c1
|
||||
NULL
|
||||
NULL
|
||||
SELECT CONVERT_TZ(123456,'-12:00','+10:00');
|
||||
CONVERT_TZ(123456,'-12:00','+10:00')
|
||||
NULL
|
||||
SELECT CONVERT_TZ('','-12:00','+10:00');
|
||||
CONVERT_TZ('','-12:00','+10:00')
|
||||
NULL
|
||||
SELECT CONVERT_TZ('aa','-12:00','+10:00');
|
||||
CONVERT_TZ('aa','-12:00','+10:00')
|
||||
NULL
|
||||
SELECT CONVERT_TZ('张三','-12:00','+10:00');
|
||||
CONVERT_TZ('张三','-12:00','+10:00')
|
||||
NULL
|
||||
SELECT CONVERT_TZ('1asd561ad','-12:00','+10:00');
|
||||
CONVERT_TZ('1asd561ad','-12:00','+10:00')
|
||||
NULL
|
||||
SELECT CONVERT_TZ('¥¥%……&*¥','-12:00','+10:00');
|
||||
CONVERT_TZ('¥¥%……&*¥','-12:00','+10:00')
|
||||
NULL
|
||||
drop table t;
|
||||
create table t(c1 year);
|
||||
insert into t values('1901'),('2155'), ('0000'), ('0001');
|
||||
SELECT c1, CONVERT_TZ(c1,'+00:00','+00:00') from t;
|
||||
c1 CONVERT_TZ(c1,'+00:00','+00:00')
|
||||
1901 NULL
|
||||
2155 NULL
|
||||
0000 NULL
|
||||
2001 NULL
|
||||
drop table t;
|
||||
create table t(a1 int,a2 year,c1 timestamp,c2 timestamp);
|
||||
insert into t values(1,'1998','1998-12-12 12:12:12','2038-01-19 03:14:07');
|
||||
insert into t values(2,'2002','2002-02-02 10:00:00','2034-02-22 00:50:20');
|
||||
insert into t values(3,'2006','2006-04-15 06:06:20','2038-01-19 03:14:07');
|
||||
insert into t values(4,'2012','2012-12-12 12:12:12','2030-08-16 14:05:50');
|
||||
select c1,c2 ,case c1 when convert_tz(c1,'+06:00','+00:00')<'2006-04-15 06:06:20' then convert_tz('2020-02-02 02:02:02','+00:00','+00:00') else convert_tz('1999-09-09 09:09:09','+00:00','+00:00') end as c1 from t;
|
||||
c1 c2 c1
|
||||
1998-12-12 12:12:12 2038-01-19 03:14:07 1999-09-09 09:09:09.000000
|
||||
2002-02-02 10:00:00 2034-02-22 00:50:20 1999-09-09 09:09:09.000000
|
||||
2006-04-15 06:06:20 2038-01-19 03:14:07 1999-09-09 09:09:09.000000
|
||||
2012-12-12 12:12:12 2030-08-16 14:05:50 1999-09-09 09:09:09.000000
|
||||
drop table t;
|
||||
create table t(c1 timestamp(0), c2 timestamp(3), c3 decimal(20,4));
|
||||
insert into t values('2020-01-01 12:00:00.123456', '2020-01-01 12:00:00.123456', '20200101120000.123456');
|
||||
select c1, convert_tz(c1, '+00:00', '+08:00') from t;
|
||||
c1 convert_tz(c1, '+00:00', '+08:00')
|
||||
2020-01-01 12:00:00 2020-01-01 20:00:00
|
||||
select c2, convert_tz(c2, '+00:00', '+08:00') from t;
|
||||
c2 convert_tz(c2, '+00:00', '+08:00')
|
||||
2020-01-01 12:00:00.123 2020-01-01 20:00:00.123
|
||||
select c3, convert_tz(c3, '+00:00', '+08:00') from t;
|
||||
c3 convert_tz(c3, '+00:00', '+08:00')
|
||||
20200101120000.1235 2020-01-01 20:00:00.1235
|
||||
drop table t;
|
||||
SELECT CONVERT_TZ('2007-03-11 2:00:00','US/Eastern','US/Central') AS time1,
|
||||
CONVERT_TZ('2007-03-11 2:00:01','US/Eastern','US/Central') AS time2,
|
||||
CONVERT_TZ('2007-03-11 3:00:00','US/Eastern','US/Central') AS time3,
|
||||
CONVERT_TZ('2007-03-11 3:00:01','US/Eastern','US/Central') AS time4;
|
||||
time1 time2 time3 time4
|
||||
NULL NULL 2007-03-11 01:00:00.000000 2007-03-11 01:00:01.000000
|
||||
SELECT CONVERT_TZ('2007-03-11 2:00:00','US/Eastern','+00:00') AS time1,
|
||||
CONVERT_TZ('2007-03-11 3:00:00','US/Eastern','+00:00') AS time2,
|
||||
CONVERT_TZ('2007-03-11 3:00:01','US/Eastern','+00:00') AS time3;
|
||||
time1 time2 time3
|
||||
NULL 2007-03-11 07:00:00.000000 2007-03-11 07:00:01.000000
|
||||
SELECT CONVERT_TZ('2007-11-04 01:00:00','US/Eastern','+00:00') AS time1,
|
||||
CONVERT_TZ('2007-11-04 01:00:01','US/Eastern','+00:00') AS time2,
|
||||
CONVERT_TZ('2007-11-04 02:00:00','US/Eastern','+00:00') AS time3,
|
||||
CONVERT_TZ('2007-11-04 02:00:01','US/Eastern','+00:00') AS time4;
|
||||
time1 time2 time3 time4
|
||||
2007-11-04 05:00:00.000000 2007-11-04 05:00:01.000000 2007-11-04 07:00:00.000000 2007-11-04 07:00:01.000000
|
||||
create table t(c1 datetime);
|
||||
insert into t values('2007-03-11 2:00:00'), ('2007-03-11 2:00:01'), ('2007-03-11 3:00:00'), ('2007-03-11 3:00:01');
|
||||
insert into t values('2007-11-04 1:00:00'), ('2007-11-04 1:00:01'), ('2007-11-04 2:00:00'), ('2007-11-04 2:00:01');
|
||||
select convert_tz(c1, 'US/Eastern', '+00:00') from t;
|
||||
convert_tz(c1, 'US/Eastern', '+00:00')
|
||||
NULL
|
||||
NULL
|
||||
2007-03-11 07:00:00
|
||||
2007-03-11 07:00:01
|
||||
2007-11-04 05:00:00
|
||||
2007-11-04 05:00:01
|
||||
2007-11-04 07:00:00
|
||||
2007-11-04 07:00:01
|
||||
drop table t;
|
||||
create table t(c1 timestamp);
|
||||
insert into t values('2007-03-11 1:59:59'), ('2007-03-11 3:00:00'), ('2007-03-11 3:00:01');
|
||||
insert into t values('2007-11-04 1:00:00'), ('2007-11-04 1:00:01'), ('2007-11-04 2:00:00'), ('2007-11-04 2:00:01');
|
||||
select convert_tz(c1, 'US/Eastern', '+00:00') from t;
|
||||
convert_tz(c1, 'US/Eastern', '+00:00')
|
||||
2007-03-11 06:59:59
|
||||
2007-03-11 07:00:00
|
||||
2007-03-11 07:00:01
|
||||
2007-11-04 05:00:00
|
||||
2007-11-04 05:00:01
|
||||
2007-11-04 07:00:00
|
||||
2007-11-04 07:00:01
|
||||
drop table t;
|
||||
@ -0,0 +1,337 @@
|
||||
================ expression export_set ================
|
||||
select export_set(0,"Y","N","-",5);
|
||||
export_set(0,"Y","N","-",5)
|
||||
N-N-N-N-N
|
||||
select export_set(7,"Y","N","-",5);
|
||||
export_set(7,"Y","N","-",5)
|
||||
Y-Y-Y-N-N
|
||||
select export_set(11,"Y","N","-",5);
|
||||
export_set(11,"Y","N","-",5)
|
||||
Y-Y-N-Y-N
|
||||
select export_set(20,"Y","N","-",5);
|
||||
export_set(20,"Y","N","-",5)
|
||||
N-N-Y-N-Y
|
||||
select export_set(9,"","","-",5);
|
||||
export_set(9,"","","-",5)
|
||||
----
|
||||
select export_set(9,"Y","N","-",5);
|
||||
export_set(9,"Y","N","-",5)
|
||||
Y-N-N-Y-N
|
||||
select export_set(9,"左","右","-",5);
|
||||
export_set(9,"左","右","-",5)
|
||||
左-右-右-左-右
|
||||
select export_set(9,"上","下","-",5);
|
||||
export_set(9,"上","下","-",5)
|
||||
上-下-下-上-下
|
||||
select export_set(5,"Y","N",".",5);
|
||||
export_set(5,"Y","N",".",5)
|
||||
Y.N.Y.N.N
|
||||
select export_set(5,"Y","N","=",5);
|
||||
export_set(5,"Y","N","=",5)
|
||||
Y=N=Y=N=N
|
||||
select export_set(5,"Y","N","????????",5);
|
||||
export_set(5,"Y","N","????????",5)
|
||||
Y????????N????????Y????????N????????N
|
||||
select export_set(100,"Y","N",".",3);
|
||||
export_set(100,"Y","N",".",3)
|
||||
N.N.Y
|
||||
select export_set(100,"Y","N",".",5);
|
||||
export_set(100,"Y","N",".",5)
|
||||
N.N.Y.N.N
|
||||
select export_set(100,"Y","N",".",7);
|
||||
export_set(100,"Y","N",".",7)
|
||||
N.N.Y.N.N.Y.Y
|
||||
select export_set(100,"Y","N",".",10);
|
||||
export_set(100,"Y","N",".",10)
|
||||
N.N.Y.N.N.Y.Y.N.N.N
|
||||
select export_set(null,"Y","N",".",5);
|
||||
export_set(null,"Y","N",".",5)
|
||||
NULL
|
||||
select export_set(0,"Y","N",".",5);
|
||||
export_set(0,"Y","N",".",5)
|
||||
N.N.N.N.N
|
||||
select export_set(5,null,"N",".",5);
|
||||
export_set(5,null,"N",".",5)
|
||||
NULL
|
||||
select export_set(5,'',"N",".",5);
|
||||
export_set(5,'',"N",".",5)
|
||||
.N..N.N
|
||||
select export_set(5,"Y",null,".",5);
|
||||
export_set(5,"Y",null,".",5)
|
||||
NULL
|
||||
select export_set(5,"Y",'',".",5);
|
||||
export_set(5,"Y",'',".",5)
|
||||
Y..Y..
|
||||
select export_set(5,"Y","N",null,5);
|
||||
export_set(5,"Y","N",null,5)
|
||||
NULL
|
||||
select export_set(5,"Y","N",'',5);
|
||||
export_set(5,"Y","N",'',5)
|
||||
YNYNN
|
||||
select export_set(5,"Y","N",".",null);
|
||||
export_set(5,"Y","N",".",null)
|
||||
NULL
|
||||
select export_set(5,"Y","N",".",0);
|
||||
export_set(5,"Y","N",".",0)
|
||||
|
||||
select export_set(55555555555555,"YY","NN",".",0);
|
||||
export_set(55555555555555,"YY","NN",".",0)
|
||||
|
||||
select export_set(55555555555555,"YY","NN",".......",0);
|
||||
export_set(55555555555555,"YY","NN",".......",0)
|
||||
|
||||
select export_set(100,'',1);
|
||||
export_set(100,'',1)
|
||||
1,1,,1,1,,,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
|
||||
select export_set(100,1,'');
|
||||
export_set(100,1,'')
|
||||
,,1,,,1,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
select export_set(100,1,0,'');
|
||||
export_set(100,1,0,'')
|
||||
0010011000000000000000000000000000000000000000000000000000000000
|
||||
select export_set(1000,'',1);
|
||||
export_set(1000,'',1)
|
||||
1,1,1,,1,,,,,,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
|
||||
select export_set(1000,1,'');
|
||||
export_set(1000,1,'')
|
||||
,,,1,,1,1,1,1,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||
select export_set(1000,1,0,'');
|
||||
export_set(1000,1,0,'')
|
||||
0001011111000000000000000000000000000000000000000000000000000000
|
||||
select export_set(8,"Y","N");
|
||||
export_set(8,"Y","N")
|
||||
N,N,N,Y,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N
|
||||
select export_set(88,"Y","N");
|
||||
export_set(88,"Y","N")
|
||||
N,N,N,Y,Y,N,Y,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N
|
||||
select export_set(888,"Y","N");
|
||||
export_set(888,"Y","N")
|
||||
N,N,N,Y,Y,Y,Y,N,Y,Y,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N
|
||||
select export_set(8888,"Y","N");
|
||||
export_set(8888,"Y","N")
|
||||
N,N,N,Y,Y,Y,N,Y,N,Y,N,N,N,Y,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N
|
||||
select export_set(8,"1","0");
|
||||
export_set(8,"1","0")
|
||||
0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
select export_set(8,"X","Y");
|
||||
export_set(8,"X","Y")
|
||||
Y,Y,Y,X,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y
|
||||
select export_set(8,"Y","N",'+');
|
||||
export_set(8,"Y","N",'+')
|
||||
N+N+N+Y+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N+N
|
||||
select export_set(8,"1","0",'*');
|
||||
export_set(8,"1","0",'*')
|
||||
0*0*0*1*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0*0
|
||||
select export_set(8,"X","Y",'*');
|
||||
export_set(8,"X","Y",'*')
|
||||
Y*Y*Y*X*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y*Y
|
||||
select export_set(7,1,0,"-",5);
|
||||
export_set(7,1,0,"-",5)
|
||||
1-1-1-0-0
|
||||
select export_set(7,11,00,"-",5);
|
||||
export_set(7,11,00,"-",5)
|
||||
11-11-11-0-0
|
||||
select export_set(7,111,000,"-",5);
|
||||
export_set(7,111,000,"-",5)
|
||||
111-111-111-0-0
|
||||
select export_set(7,111,000,5,5);
|
||||
export_set(7,111,000,5,5)
|
||||
111511151115050
|
||||
select export_set(true,1,0);
|
||||
export_set(true,1,0)
|
||||
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
select export_set(true,"1","0");
|
||||
export_set(true,"1","0")
|
||||
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
select export_set(false,1,0);
|
||||
export_set(false,1,0)
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
select export_set(false,"1","0");
|
||||
export_set(false,"1","0")
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
select export_set(1.4,1,0);
|
||||
export_set(1.4,1,0)
|
||||
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
select export_set(2.4,1,0);
|
||||
export_set(2.4,1,0)
|
||||
0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
select export_set(1.4,"y","n");
|
||||
export_set(1.4,"y","n")
|
||||
y,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n
|
||||
select export_set(2.4,"y","n");
|
||||
export_set(2.4,"y","n")
|
||||
n,y,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n
|
||||
select export_set(9223372036854775808,"Y","N");
|
||||
export_set(9223372036854775808,"Y","N")
|
||||
Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,N
|
||||
select export_set(9223372036854775809,"Y","N");
|
||||
export_set(9223372036854775809,"Y","N")
|
||||
Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,N
|
||||
select export_set(-9223372036854775808,"Y","N");
|
||||
export_set(-9223372036854775808,"Y","N")
|
||||
N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,Y
|
||||
select export_set(18446744073709551615,"Y","N");
|
||||
export_set(18446744073709551615,"Y","N")
|
||||
Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,N
|
||||
select export_set(9223372036854775808,"Y","N",",",92233720368547758080000000000);
|
||||
export_set(9223372036854775808,"Y","N",",",92233720368547758080000000000)
|
||||
Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,N
|
||||
select export_set(9223372036854775808,"Y","N",",",9223372036854775808);
|
||||
export_set(9223372036854775808,"Y","N",",",9223372036854775808)
|
||||
Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,N
|
||||
select export_set(9223372036854775809,"Y","N",",",9223372036854775809);
|
||||
export_set(9223372036854775809,"Y","N",",",9223372036854775809)
|
||||
Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,N
|
||||
select export_set(9223372036854775809,"Y","N",",",9223372036854775809000000000000);
|
||||
export_set(9223372036854775809,"Y","N",",",9223372036854775809000000000000)
|
||||
Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,N
|
||||
select export_set(-9223372036854775808,"Y","N",",",-9223372036854775808);
|
||||
export_set(-9223372036854775808,"Y","N",",",-9223372036854775808)
|
||||
N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,Y
|
||||
select export_set(-9223372036854775808,"Y","N",",",-9223372036854775808000000000);
|
||||
export_set(-9223372036854775808,"Y","N",",",-9223372036854775808000000000)
|
||||
N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,Y
|
||||
select export_set(18446744073709551615,"Y","N",",",18446744073709551615);
|
||||
export_set(18446744073709551615,"Y","N",",",18446744073709551615)
|
||||
Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,N
|
||||
select export_set(18446744073709551615,"Y","N",",",1844674407370955161500000000000);
|
||||
export_set(18446744073709551615,"Y","N",",",1844674407370955161500000000000)
|
||||
Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,N
|
||||
select export_set();
|
||||
ERROR 42000: Incorrect parameter count in the call to native function 'export_set'
|
||||
select export_set(1);
|
||||
ERROR 42000: Incorrect parameter count in the call to native function 'export_set'
|
||||
select export_set(1,2);
|
||||
ERROR 42000: Incorrect parameter count in the call to native function 'export_set'
|
||||
select export_set("");
|
||||
ERROR 42000: Incorrect parameter count in the call to native function 'export_set'
|
||||
select export_set("","");
|
||||
ERROR 42000: Incorrect parameter count in the call to native function 'export_set'
|
||||
select export_set(5,5);
|
||||
ERROR 42000: Incorrect parameter count in the call to native function 'export_set'
|
||||
select export_set(a,2,3);
|
||||
ERROR 42S22: Unknown column 'a' in 'field list'
|
||||
select export_set(1,2,3,a);
|
||||
ERROR 42S22: Unknown column 'a' in 'field list'
|
||||
select export_set(1,2,3,4,a);
|
||||
ERROR 42S22: Unknown column 'a' in 'field list'
|
||||
drop table if exists test;
|
||||
create table test(c1 int, c2 varchar(20), c3 varchar(20), c4 varchar(20), c5 int);
|
||||
insert into test values(11,"Y","N",",",10);
|
||||
insert into test values(null,"Y","N",",",10);
|
||||
insert into test values(11,null,"N",",",10);
|
||||
insert into test values(11,"Y",null,",",10);
|
||||
insert into test values(11,"Y","N",null,10);
|
||||
insert into test values(11,"Y","N",",",null);
|
||||
insert into test values(null,null,null,null,null);
|
||||
select export_set(c1,c2,c3,c4,c5) from test;
|
||||
export_set(c1,c2,c3,c4,c5)
|
||||
Y,Y,N,Y,N,N,N,N,N,N
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
select export_set(c1,c2,c3,c4) from test;
|
||||
export_set(c1,c2,c3,c4)
|
||||
Y,Y,N,Y,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
Y,Y,N,Y,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N
|
||||
NULL
|
||||
select export_set(c1,c2,c3) from test;
|
||||
export_set(c1,c2,c3)
|
||||
Y,Y,N,Y,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
Y,Y,N,Y,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N
|
||||
Y,Y,N,Y,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N
|
||||
NULL
|
||||
insert into test values(100000,"+","-",",",1000000);
|
||||
insert into test values(55555555,"+","-",",",100000);
|
||||
insert into test values(7777777,"+","-",",",10000);
|
||||
select export_set(c1,c2,c3,c4,5) from test;
|
||||
export_set(c1,c2,c3,c4,5)
|
||||
Y,Y,N,Y,N
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
Y,Y,N,Y,N
|
||||
NULL
|
||||
-,-,-,-,-
|
||||
+,+,-,-,-
|
||||
+,-,-,-,+
|
||||
select export_set(c1,c2,c3,'??',5) from test;
|
||||
export_set(c1,c2,c3,'??',5)
|
||||
Y??Y??N??Y??N
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
Y??Y??N??Y??N
|
||||
Y??Y??N??Y??N
|
||||
NULL
|
||||
-??-??-??-??-
|
||||
+??+??-??-??-
|
||||
+??-??-??-??+
|
||||
select export_set(c1,c2,c3) from test;
|
||||
export_set(c1,c2,c3)
|
||||
Y,Y,N,Y,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N
|
||||
NULL
|
||||
NULL
|
||||
NULL
|
||||
Y,Y,N,Y,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N
|
||||
Y,Y,N,Y,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N
|
||||
NULL
|
||||
-,-,-,-,-,+,-,+,-,+,+,-,-,-,-,+,+,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-
|
||||
+,+,-,-,-,+,+,+,+,-,+,-,+,+,-,+,+,+,+,+,-,-,+,-,+,+,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-
|
||||
+,-,-,-,+,+,+,+,+,-,+,+,-,+,-,+,-,+,+,-,+,+,+,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-
|
||||
select export_set(c1) from test;
|
||||
ERROR 42000: Incorrect parameter count in the call to native function 'export_set'
|
||||
select export_set(c1,c2) from test;
|
||||
ERROR 42000: Incorrect parameter count in the call to native function 'export_set'
|
||||
select export_set() from test;
|
||||
ERROR 42000: Incorrect parameter count in the call to native function 'export_set'
|
||||
drop table test;
|
||||
drop table if exists t1;
|
||||
create table t1 as select export_set(0,"Y","N","-",5);
|
||||
desc t1;
|
||||
Field Type Null Key Default Extra
|
||||
export_set(0,"Y","N","-",5) varchar(127) YES NULL
|
||||
drop table t1;
|
||||
create table t1 as select export_set(99,"YYY","NX","---",77);
|
||||
desc t1;
|
||||
Field Type Null Key Default Extra
|
||||
export_set(99,"YYY","NX","---",77) varchar(381) YES NULL
|
||||
drop table t1;
|
||||
create table t1 as select export_set(99,"1","11","111",77);
|
||||
desc t1;
|
||||
Field Type Null Key Default Extra
|
||||
export_set(99,"1","11","111",77) varchar(317) YES NULL
|
||||
drop table t1;
|
||||
drop table if exists T_36895309;
|
||||
CREATE TABLE T_36895309(A_0 INT,A_1 INT,A_2 VARCHAR(20),A_3 FLOAT,A_4 DATE);
|
||||
INSERT INTO T_36895309 VALUES(1,1,'A',1.23,'1999-09-09'),(2,-1,'nb',3.21,'1111-11-11'),(3,0,'#',6666.6666,'11-11-11'),(4,NULL,NULL,NULL,NULL);
|
||||
SELECT EXPORT_SET(A_2,'Y','N',',',5) FROM T_36895309 ;
|
||||
EXPORT_SET(A_2,'Y','N',',',5)
|
||||
N,N,N,N,N
|
||||
N,N,N,N,N
|
||||
N,N,N,N,N
|
||||
NULL
|
||||
SELECT EXPORT_SET(A_3,'Y','N',',',5) FROM T_36895309 ;
|
||||
EXPORT_SET(A_3,'Y','N',',',5)
|
||||
Y,N,N,N,N
|
||||
Y,Y,N,N,N
|
||||
Y,Y,N,Y,N
|
||||
NULL
|
||||
SELECT EXPORT_SET(A_4,'Y','N',',',5) FROM T_36895309 ;
|
||||
EXPORT_SET(A_4,'Y','N',',',5)
|
||||
Y,N,Y,Y,Y
|
||||
Y,Y,Y,N,N
|
||||
Y,Y,Y,N,N
|
||||
NULL
|
||||
drop table T_36895309;
|
||||
@ -0,0 +1,265 @@
|
||||
================ expression floor ================
|
||||
select floor(null);
|
||||
floor(null)
|
||||
NULL
|
||||
select floor(-123);
|
||||
floor(-123)
|
||||
-123
|
||||
select floor(-123.123);
|
||||
floor(-123.123)
|
||||
-124
|
||||
select floor(123);
|
||||
floor(123)
|
||||
123
|
||||
select floor(3.1415926);
|
||||
floor(3.1415926)
|
||||
3
|
||||
select floor(-3.1415926);
|
||||
floor(-3.1415926)
|
||||
-4
|
||||
select floor(0.00);
|
||||
floor(0.00)
|
||||
0
|
||||
select floor(-0.0);
|
||||
floor(-0.0)
|
||||
0
|
||||
select floor(0.123456789);
|
||||
floor(0.123456789)
|
||||
0
|
||||
select floor(-0.123456789);
|
||||
floor(-0.123456789)
|
||||
-1
|
||||
select floor(123456789.123456789);
|
||||
floor(123456789.123456789)
|
||||
123456789
|
||||
select floor(-99999999.999999999);
|
||||
floor(-99999999.999999999)
|
||||
-100000000
|
||||
select floor(999999999.123456789);
|
||||
floor(999999999.123456789)
|
||||
999999999
|
||||
select floor(-999999999.123456789);
|
||||
floor(-999999999.123456789)
|
||||
-1000000000
|
||||
select floor(-123456789123456789123456789.123456789);
|
||||
floor(-123456789123456789123456789.123456789)
|
||||
-123456789123456789123456790
|
||||
select floor(123456789123456789123456789123456789123456789123456789.123456789);
|
||||
floor(123456789123456789123456789123456789123456789123456789.123456789)
|
||||
123456789123456789123456789123456789123456789123456789
|
||||
select floor(-123456789123456789123456789123456789123456789123456789.123456789);
|
||||
floor(-123456789123456789123456789123456789123456789123456789.123456789)
|
||||
-123456789123456789123456789123456789123456789123456790
|
||||
select floor(123456789123456789123456789.123456789123456789123456789123456789);
|
||||
floor(123456789123456789123456789.123456789123456789123456789123456789)
|
||||
123456789123456789123456789
|
||||
select floor(-123456789123456789123456789.123456789123456789123456789123456789);
|
||||
floor(-123456789123456789123456789.123456789123456789123456789123456789)
|
||||
-123456789123456789123456790
|
||||
select floor(-123456789123456789123456789.123456789);
|
||||
floor(-123456789123456789123456789.123456789)
|
||||
-123456789123456789123456790
|
||||
select floor(999999999999999999999999999999999999999999999.499999999);
|
||||
floor(999999999999999999999999999999999999999999999.499999999)
|
||||
999999999999999999999999999999999999999999999
|
||||
select floor(999999999999999999999999999999999999999999999.500000001);
|
||||
floor(999999999999999999999999999999999999999999999.500000001)
|
||||
999999999999999999999999999999999999999999999
|
||||
select floor(99999999999999999999999999999999999999999999.399999999);
|
||||
floor(99999999999999999999999999999999999999999999.399999999)
|
||||
99999999999999999999999999999999999999999999
|
||||
select floor(-99999999999999999999999999999999999999999999.399999999);
|
||||
floor(-99999999999999999999999999999999999999999999.399999999)
|
||||
-100000000000000000000000000000000000000000000
|
||||
select floor(-99999999999999999999999999999999999999999999.399999999);
|
||||
floor(-99999999999999999999999999999999999999999999.399999999)
|
||||
-100000000000000000000000000000000000000000000
|
||||
select floor(999999999999999999999999999999999999999999999211111.399999999);
|
||||
floor(999999999999999999999999999999999999999999999211111.399999999)
|
||||
999999999999999999999999999999999999999999999211111
|
||||
select floor(-999999999999999999999999999999999999999999999211111.399999999);
|
||||
floor(-999999999999999999999999999999999999999999999211111.399999999)
|
||||
-999999999999999999999999999999999999999999999211112
|
||||
select floor(-999999999999999999999999999999999999999999999511111.399999999);
|
||||
floor(-999999999999999999999999999999999999999999999511111.399999999)
|
||||
-999999999999999999999999999999999999999999999511112
|
||||
select floor(-999999999999999999999999999999999999999999999499999.399999999);
|
||||
floor(-999999999999999999999999999999999999999999999499999.399999999)
|
||||
-999999999999999999999999999999999999999999999500000
|
||||
select floor(0.00000000000),ceil(0.00000);
|
||||
floor(0.00000000000) ceil(0.00000)
|
||||
0 0
|
||||
drop table if exists tbl1;
|
||||
create table tbl1 (i1 int, v2 varchar(80), i3 char(20),i4 float, d4 datetime(6),i5 decimal(5,3), primary key(i1));
|
||||
insert into tbl1 values(1,'now','haha1',1.6256,'2014-05-04 12:00:00',-10.235);
|
||||
insert into tbl1 values(2,'now','haha2',-1.6256,'2014-05-04 12:00:00',1.243);
|
||||
insert into tbl1 values(3,'now','haha3',1.156,'2014-05-04 12:00:00',-1.45);
|
||||
insert into tbl1 values(4,'now','haha1',5.9256,'2014-05-04 12:00:00',3.45);
|
||||
insert into tbl1 values(5,'now1','haha2',1.2356,'2014-05-04 12:00:00',-0.25);
|
||||
insert into tbl1 values(6,'now2','haha3',-10.4256,'2014-05-04 12:00:00',0.253);
|
||||
insert into tbl1 values(7,'now3','haha4',0.6256,'2014-05-04 12:00:00',1.677);
|
||||
select floor(i4),floor(i5) from tbl1;
|
||||
floor(i4) floor(i5)
|
||||
1 -11
|
||||
-2 1
|
||||
1 -2
|
||||
5 3
|
||||
1 -1
|
||||
-11 0
|
||||
0 1
|
||||
select max(floor(i4)),max(floor(i5)) from tbl1;
|
||||
max(floor(i4)) max(floor(i5))
|
||||
5 3
|
||||
select min(floor(i4)),min(floor(i5)) from tbl1;
|
||||
min(floor(i4)) min(floor(i5))
|
||||
-11 -11
|
||||
select max(ceil(i4)),max(ceil(i5)) from tbl1;
|
||||
max(ceil(i4)) max(ceil(i5))
|
||||
6 4
|
||||
select min(ceil(i4)),min(ceil(i5)) from tbl1;
|
||||
min(ceil(i4)) min(ceil(i5))
|
||||
-10 -10
|
||||
select avg(ceil(i4)),avg(ceil(i5)) from tbl1;
|
||||
avg(ceil(i4)) avg(ceil(i5))
|
||||
0.2857 -0.2857
|
||||
select avg(ceil(i5)),avg(floor(i5)) from tbl1;
|
||||
avg(ceil(i5)) avg(floor(i5))
|
||||
-0.2857 -1.2857
|
||||
select sum(ceil(i4)),sum(ceil(i5)) from tbl1;
|
||||
sum(ceil(i4)) sum(ceil(i5))
|
||||
2 -2
|
||||
select count(ceil(i4)),count(ceil(i5)) from tbl1;
|
||||
count(ceil(i4)) count(ceil(i5))
|
||||
7 7
|
||||
select ceil(count(ceil(i4))),floor(count(ceil(i5))) from tbl1;
|
||||
ceil(count(ceil(i4))) floor(count(ceil(i5)))
|
||||
7 7
|
||||
select ceil(avg(ceil(i4))),floor(avg(ceil(i5))) from tbl1;
|
||||
ceil(avg(ceil(i4))) floor(avg(ceil(i5)))
|
||||
1 -1
|
||||
select ceil(avg(ceil(i4))),ceil(avg(ceil(i5))) from tbl1;
|
||||
ceil(avg(ceil(i4))) ceil(avg(ceil(i5)))
|
||||
1 0
|
||||
select * from tbl1 where floor(i4)=2;
|
||||
i1 v2 i3 i4 d4 i5
|
||||
select * from tbl1 where floor(i4)=ceil(i4)-1;
|
||||
i1 v2 i3 i4 d4 i5
|
||||
1 now haha1 1.6256 2014-05-04 12:00:00.000000 -10.235
|
||||
2 now haha2 -1.6256 2014-05-04 12:00:00.000000 1.243
|
||||
3 now haha3 1.156 2014-05-04 12:00:00.000000 -1.450
|
||||
4 now haha1 5.9256 2014-05-04 12:00:00.000000 3.450
|
||||
5 now1 haha2 1.2356 2014-05-04 12:00:00.000000 -0.250
|
||||
6 now2 haha3 -10.4256 2014-05-04 12:00:00.000000 0.253
|
||||
7 now3 haha4 0.6256 2014-05-04 12:00:00.000000 1.677
|
||||
select * from tbl1 where floor(i1)=ceil(i1);
|
||||
i1 v2 i3 i4 d4 i5
|
||||
1 now haha1 1.6256 2014-05-04 12:00:00.000000 -10.235
|
||||
2 now haha2 -1.6256 2014-05-04 12:00:00.000000 1.243
|
||||
3 now haha3 1.156 2014-05-04 12:00:00.000000 -1.450
|
||||
4 now haha1 5.9256 2014-05-04 12:00:00.000000 3.450
|
||||
5 now1 haha2 1.2356 2014-05-04 12:00:00.000000 -0.250
|
||||
6 now2 haha3 -10.4256 2014-05-04 12:00:00.000000 0.253
|
||||
7 now3 haha4 0.6256 2014-05-04 12:00:00.000000 1.677
|
||||
select floor(i1/10*8),i1/10*8 from tbl1;
|
||||
floor(i1/10*8) i1/10*8
|
||||
0 0.8000
|
||||
1 1.6000
|
||||
2 2.4000
|
||||
3 3.2000
|
||||
4 4.0000
|
||||
4 4.8000
|
||||
5 5.6000
|
||||
select * from tbl1 order by floor(i4);
|
||||
i1 v2 i3 i4 d4 i5
|
||||
6 now2 haha3 -10.4256 2014-05-04 12:00:00.000000 0.253
|
||||
2 now haha2 -1.6256 2014-05-04 12:00:00.000000 1.243
|
||||
7 now3 haha4 0.6256 2014-05-04 12:00:00.000000 1.677
|
||||
1 now haha1 1.6256 2014-05-04 12:00:00.000000 -10.235
|
||||
3 now haha3 1.156 2014-05-04 12:00:00.000000 -1.450
|
||||
5 now1 haha2 1.2356 2014-05-04 12:00:00.000000 -0.250
|
||||
4 now haha1 5.9256 2014-05-04 12:00:00.000000 3.450
|
||||
select * from tbl1 order by floor(i4) desc;
|
||||
i1 v2 i3 i4 d4 i5
|
||||
4 now haha1 5.9256 2014-05-04 12:00:00.000000 3.450
|
||||
1 now haha1 1.6256 2014-05-04 12:00:00.000000 -10.235
|
||||
3 now haha3 1.156 2014-05-04 12:00:00.000000 -1.450
|
||||
5 now1 haha2 1.2356 2014-05-04 12:00:00.000000 -0.250
|
||||
7 now3 haha4 0.6256 2014-05-04 12:00:00.000000 1.677
|
||||
2 now haha2 -1.6256 2014-05-04 12:00:00.000000 1.243
|
||||
6 now2 haha3 -10.4256 2014-05-04 12:00:00.000000 0.253
|
||||
select floor(i4) abc from tbl1 order by abc desc;
|
||||
abc
|
||||
5
|
||||
1
|
||||
1
|
||||
1
|
||||
0
|
||||
-2
|
||||
-11
|
||||
select floor(v2) from tbl1;
|
||||
floor(v2)
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'now'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'now'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'now'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'now'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'now1'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'now2'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'now3'
|
||||
select floor(i3) from tbl1;
|
||||
floor(i3)
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'haha1'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'haha2'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'haha3'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'haha1'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'haha2'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'haha3'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'haha4'
|
||||
select floor(d4) from tbl1;
|
||||
floor(d4)
|
||||
20140504120000
|
||||
20140504120000
|
||||
20140504120000
|
||||
20140504120000
|
||||
20140504120000
|
||||
20140504120000
|
||||
20140504120000
|
||||
drop table if exists tbl2;
|
||||
create table tbl2 (i1 int, v2 varchar(80), primary key(i1));
|
||||
insert into tbl2 values(1,'1');
|
||||
insert into tbl2 values(2,'2.5');
|
||||
insert into tbl2 values(3,'-3.2');
|
||||
select floor(v2),ceil(v2) from tbl2;
|
||||
floor(v2) ceil(v2)
|
||||
1 1
|
||||
2 3
|
||||
-4 -3
|
||||
drop table if exists test;
|
||||
create table test (pk int primary key, c1 tinyint, c2 smallint, c3 mediumint, c4 int, c5 bigint, c6 tinyint unsigned, c7 smallint unsigned, c8 mediumint unsigned, c9 int unsigned, c10 bigint unsigned, c11 float, c12 double, c13 float unsigned, c14 double unsigned, c15 decimal(20, 10), c16 decimal(20, 10) unsigned, c17 datetime(6), c18 timestamp(6) default "2012-01-01 12:00:00", c19 date, c20 time, c21 year , c22 varchar(10000), c23 char(255), c24 varbinary(10000), c25 binary(255));
|
||||
insert into test values (0, -128, 2, -3, 4, -5, 6, 7, 8, 9, 10, -11.49, -12.5, 13.5, 14.49, 15.99, 16.1, '2017-01-01 00:01:10.123456', '2018-02-02 00:02:20.123456', '2019-03-03', '20:04:40.123456', '2021', '22.5324', '-23.436456', '-24', '25');
|
||||
insert into test values (1, 1, -2, 3, -4, 5, 6, 7, 8, 9, 10, -11.49, -12.5, 13.5, 14.49, 15.99, 16.1, '2017-01-01 00:01:10.123456', '2018-02-02 00:02:20.123456', '2019-03-03', '20:04:40.123456', '2021', '-22.999999', '23.00001', '24.9999', '-25.00001');
|
||||
insert into test values (2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
select floor(pk), floor(c1), floor(c2), floor(c3), floor(c4), floor(c5), floor(c6), floor(c7), floor(c8), floor(c9), floor(c10), floor(c11), floor(c12), floor(c13), floor(c14), floor(c15), floor(c16), floor(c22), floor(c23), floor(c24), floor(c25) from test;
|
||||
floor(pk) floor(c1) floor(c2) floor(c3) floor(c4) floor(c5) floor(c6) floor(c7) floor(c8) floor(c9) floor(c10) floor(c11) floor(c12) floor(c13) floor(c14) floor(c15) floor(c16) floor(c22) floor(c23) floor(c24) floor(c25)
|
||||
0 -128 2 -3 4 -5 6 7 8 9 10 -12 -13 13 14 15 16 22 -24 -24 25
|
||||
1 1 -2 3 -4 5 6 7 8 9 10 -12 -13 13 14 15 16 -23 23 24 -26
|
||||
2 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: '25'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: '-25.00001'
|
||||
drop table if exists test;
|
||||
@ -0,0 +1,167 @@
|
||||
================ expression instr ================
|
||||
select instr('abc', '');
|
||||
instr('abc', '')
|
||||
1
|
||||
select instr('', '');
|
||||
instr('', '')
|
||||
1
|
||||
select instr('', 'abc');
|
||||
instr('', 'abc')
|
||||
0
|
||||
select instr('abc', 'abcd');
|
||||
instr('abc', 'abcd')
|
||||
0
|
||||
select instr('abc', 'abc');
|
||||
instr('abc', 'abc')
|
||||
1
|
||||
select instr('abc', 'a');
|
||||
instr('abc', 'a')
|
||||
1
|
||||
select instr('abc', 'b');
|
||||
instr('abc', 'b')
|
||||
2
|
||||
select instr('abc', 'c');
|
||||
instr('abc', 'c')
|
||||
3
|
||||
select instr('abc', 'bc');
|
||||
instr('abc', 'bc')
|
||||
2
|
||||
select instr('abcbc', 'bc');
|
||||
instr('abcbc', 'bc')
|
||||
2
|
||||
select instr('阿里巴巴', '阿里');
|
||||
instr('阿里巴巴', '阿里')
|
||||
1
|
||||
select instr('阿里巴巴', '巴巴');
|
||||
instr('阿里巴巴', '巴巴')
|
||||
3
|
||||
select instr('阿里巴巴巴巴', '巴巴');
|
||||
instr('阿里巴巴巴巴', '巴巴')
|
||||
3
|
||||
select instr('阿里巴巴', '阿里巴巴');
|
||||
instr('阿里巴巴', '阿里巴巴')
|
||||
1
|
||||
select instr('123', true);
|
||||
instr('123', true)
|
||||
1
|
||||
select instr('23', true);
|
||||
instr('23', true)
|
||||
0
|
||||
select instr(123, '23');
|
||||
instr(123, '23')
|
||||
2
|
||||
select instr('123', 123);
|
||||
instr('123', 123)
|
||||
1
|
||||
select instr('123.400000', 23.4);
|
||||
instr('123.400000', 23.4)
|
||||
2
|
||||
select instr('123.400000', 123.4);
|
||||
instr('123.400000', 123.4)
|
||||
1
|
||||
select instr('123.400000', null);
|
||||
instr('123.400000', null)
|
||||
NULL
|
||||
select instr(null, '巴巴');
|
||||
instr(null, '巴巴')
|
||||
NULL
|
||||
select instr('巴巴', null);
|
||||
instr('巴巴', null)
|
||||
NULL
|
||||
select instr(null, null);
|
||||
instr(null, null)
|
||||
NULL
|
||||
select instr(true, false);
|
||||
instr(true, false)
|
||||
0
|
||||
select instr(true, true);
|
||||
instr(true, true)
|
||||
1
|
||||
select instr(123, true);
|
||||
instr(123, true)
|
||||
1
|
||||
select instr(123, false);
|
||||
instr(123, false)
|
||||
0
|
||||
select instr(0123, false);
|
||||
instr(0123, false)
|
||||
0
|
||||
select instr(1023, false);
|
||||
instr(1023, false)
|
||||
2
|
||||
select instr(1023.4, false);
|
||||
instr(1023.4, false)
|
||||
2
|
||||
select instr(1023.4, true);
|
||||
instr(1023.4, true)
|
||||
1
|
||||
select instr(null, true);
|
||||
instr(null, true)
|
||||
NULL
|
||||
select instr(true, null);
|
||||
instr(true, null)
|
||||
NULL
|
||||
select instr(123, 23);
|
||||
instr(123, 23)
|
||||
2
|
||||
select instr(123, 23456);
|
||||
instr(123, 23456)
|
||||
0
|
||||
select instr(123.4, 123);
|
||||
instr(123.4, 123)
|
||||
1
|
||||
select instr(1234, 123.4);
|
||||
instr(1234, 123.4)
|
||||
0
|
||||
select instr(1234, null);
|
||||
instr(1234, null)
|
||||
NULL
|
||||
select instr(null, 123);
|
||||
instr(null, 123)
|
||||
NULL
|
||||
select instr(123.400000, 123.4);
|
||||
instr(123.400000, 123.4)
|
||||
1
|
||||
select instr(123.400000, 123.41);
|
||||
instr(123.400000, 123.41)
|
||||
0
|
||||
select instr(123.400000, null);
|
||||
instr(123.400000, null)
|
||||
NULL
|
||||
select instr(null, 123.41);
|
||||
instr(null, 123.41)
|
||||
NULL
|
||||
drop table if exists test;
|
||||
create table test(c1 datetime primary key);
|
||||
insert into test values('2015-5-5');
|
||||
select instr(c1, '201') from test;
|
||||
instr(c1, '201')
|
||||
1
|
||||
select instr(c1, '') from test;
|
||||
instr(c1, '')
|
||||
1
|
||||
select instr(c1, 'haha') from test;
|
||||
instr(c1, 'haha')
|
||||
0
|
||||
select instr(c1, '-5') from test;
|
||||
instr(c1, '-5')
|
||||
0
|
||||
select instr(c1, '2015-5-5') from test;
|
||||
instr(c1, '2015-5-5')
|
||||
0
|
||||
select instr(c1, true) from test;
|
||||
instr(c1, true)
|
||||
3
|
||||
select instr(c1, 201) from test;
|
||||
instr(c1, 201)
|
||||
1
|
||||
select instr(c1, 201.1) from test;
|
||||
instr(c1, 201.1)
|
||||
0
|
||||
select instr(c1, null) from test;
|
||||
instr(c1, null)
|
||||
NULL
|
||||
select instr(null, c1) from test;
|
||||
instr(null, c1)
|
||||
NULL
|
||||
drop table if exists test;
|
||||
@ -0,0 +1,481 @@
|
||||
================ expression locate ================
|
||||
select locate('', 'abc');
|
||||
locate('', 'abc')
|
||||
1
|
||||
select locate('', '');
|
||||
locate('', '')
|
||||
1
|
||||
select locate('abcd', 'abc');
|
||||
locate('abcd', 'abc')
|
||||
0
|
||||
select locate('abc', 'abc');
|
||||
locate('abc', 'abc')
|
||||
1
|
||||
select locate('a', 'abc');
|
||||
locate('a', 'abc')
|
||||
1
|
||||
select locate('b', 'abc');
|
||||
locate('b', 'abc')
|
||||
2
|
||||
select locate('c', 'abc');
|
||||
locate('c', 'abc')
|
||||
3
|
||||
select locate('bc', 'abc');
|
||||
locate('bc', 'abc')
|
||||
2
|
||||
select locate('bc', 'abcbc');
|
||||
locate('bc', 'abcbc')
|
||||
2
|
||||
select locate('阿里', '阿里巴巴');
|
||||
locate('阿里', '阿里巴巴')
|
||||
1
|
||||
select locate('巴巴', '阿里巴巴巴巴');
|
||||
locate('巴巴', '阿里巴巴巴巴')
|
||||
3
|
||||
select locate('阿里巴巴', '阿里巴巴');
|
||||
locate('阿里巴巴', '阿里巴巴')
|
||||
1
|
||||
select locate(true, '123');
|
||||
locate(true, '123')
|
||||
1
|
||||
select locate(true, '23');
|
||||
locate(true, '23')
|
||||
0
|
||||
select locate(23, 123);
|
||||
locate(23, 123)
|
||||
2
|
||||
select locate('', 23);
|
||||
locate('', 23)
|
||||
1
|
||||
select locate('23', 123);
|
||||
locate('23', 123)
|
||||
2
|
||||
select locate(123.4, '123.400000');
|
||||
locate(123.4, '123.400000')
|
||||
1
|
||||
select locate('123.400000', 123.4);
|
||||
locate('123.400000', 123.4)
|
||||
0
|
||||
select locate('123.400000', null);
|
||||
locate('123.400000', null)
|
||||
NULL
|
||||
select locate(null, '巴巴');
|
||||
locate(null, '巴巴')
|
||||
NULL
|
||||
select locate('巴巴', null);
|
||||
locate('巴巴', null)
|
||||
NULL
|
||||
select locate(null, null);
|
||||
locate(null, null)
|
||||
NULL
|
||||
select locate(false, true);
|
||||
locate(false, true)
|
||||
0
|
||||
select locate(true, true);
|
||||
locate(true, true)
|
||||
1
|
||||
select locate(true, 123);
|
||||
locate(true, 123)
|
||||
1
|
||||
select locate(false, 123);
|
||||
locate(false, 123)
|
||||
0
|
||||
select locate(false, 0123);
|
||||
locate(false, 0123)
|
||||
0
|
||||
select locate(false, 1023);
|
||||
locate(false, 1023)
|
||||
2
|
||||
select locate(false,1023.4);
|
||||
locate(false,1023.4)
|
||||
2
|
||||
select locate(true, 1023.4);
|
||||
locate(true, 1023.4)
|
||||
1
|
||||
select locate(true, null);
|
||||
locate(true, null)
|
||||
NULL
|
||||
select locate(null, true);
|
||||
locate(null, true)
|
||||
NULL
|
||||
select locate(23, 123);
|
||||
locate(23, 123)
|
||||
2
|
||||
select locate(123456, 123);
|
||||
locate(123456, 123)
|
||||
0
|
||||
select locate(123, 123.4);
|
||||
locate(123, 123.4)
|
||||
1
|
||||
select locate(123.4, 1234);
|
||||
locate(123.4, 1234)
|
||||
0
|
||||
select locate(123, null);
|
||||
locate(123, null)
|
||||
NULL
|
||||
select locate(null, 123);
|
||||
locate(null, 123)
|
||||
NULL
|
||||
select locate(123.4, 123.400000);
|
||||
locate(123.4, 123.400000)
|
||||
1
|
||||
select locate(123.41, 123.400000);
|
||||
locate(123.41, 123.400000)
|
||||
0
|
||||
select locate(123.400000, null);
|
||||
locate(123.400000, null)
|
||||
NULL
|
||||
select locate(null, 123.41);
|
||||
locate(null, 123.41)
|
||||
NULL
|
||||
drop table if exists test;
|
||||
drop table if exists t1;
|
||||
create table t1(c1 bigint unsigned);
|
||||
insert into t1 values(locate('a','b',9223372036854775807));
|
||||
insert into t1 values(locate('a','b',9223372036854775808));
|
||||
insert into t1 values(locate('a','b',12233720368547758000));
|
||||
select * from t1;
|
||||
c1
|
||||
0
|
||||
0
|
||||
0
|
||||
create table test(c1 datetime primary key);
|
||||
insert into test values('2015-5-5');
|
||||
select locate('201', c1) from test;
|
||||
locate('201', c1)
|
||||
1
|
||||
select locate('', c1) from test;
|
||||
locate('', c1)
|
||||
1
|
||||
select locate('haha', c1) from test;
|
||||
locate('haha', c1)
|
||||
0
|
||||
select locate('-5',c1) from test;
|
||||
locate('-5',c1)
|
||||
0
|
||||
select locate('2015-5-5', c1) from test;
|
||||
locate('2015-5-5', c1)
|
||||
0
|
||||
select locate(true, c1) from test;
|
||||
locate(true, c1)
|
||||
3
|
||||
select locate(201, c1) from test;
|
||||
locate(201, c1)
|
||||
1
|
||||
select locate(201.1, c1) from test;
|
||||
locate(201.1, c1)
|
||||
0
|
||||
select locate(c1, null) from test;
|
||||
locate(c1, null)
|
||||
NULL
|
||||
select locate(null, c1) from test;
|
||||
locate(null, c1)
|
||||
NULL
|
||||
drop table if exists test,t1;
|
||||
select locate('', 'abc', 0);
|
||||
locate('', 'abc', 0)
|
||||
0
|
||||
select locate('', 'abc', 1);
|
||||
locate('', 'abc', 1)
|
||||
1
|
||||
select locate('', 'abc', -1);
|
||||
locate('', 'abc', -1)
|
||||
0
|
||||
select locate('', '', 0);
|
||||
locate('', '', 0)
|
||||
0
|
||||
select locate('', '', 1);
|
||||
locate('', '', 1)
|
||||
1
|
||||
select locate('', '', -1);
|
||||
locate('', '', -1)
|
||||
0
|
||||
select locate('abc', '', 0);
|
||||
locate('abc', '', 0)
|
||||
0
|
||||
select locate('abc', '', -1);
|
||||
locate('abc', '', -1)
|
||||
0
|
||||
select locate('abc', '', 1);
|
||||
locate('abc', '', 1)
|
||||
0
|
||||
select locate('abcd', 'abc', 1);
|
||||
locate('abcd', 'abc', 1)
|
||||
0
|
||||
select locate('abc', 'abc', 1);
|
||||
locate('abc', 'abc', 1)
|
||||
1
|
||||
select locate('abc', 'abc', 2);
|
||||
locate('abc', 'abc', 2)
|
||||
0
|
||||
select locate('a', 'abc', 1);
|
||||
locate('a', 'abc', 1)
|
||||
1
|
||||
select locate('a', 'abc', 2);
|
||||
locate('a', 'abc', 2)
|
||||
0
|
||||
select locate('a', 'abac', 1);
|
||||
locate('a', 'abac', 1)
|
||||
1
|
||||
select locate('a', 'abac', 2);
|
||||
locate('a', 'abac', 2)
|
||||
3
|
||||
select locate('b', 'abc', 1);
|
||||
locate('b', 'abc', 1)
|
||||
2
|
||||
select locate('b', 'abc', 2);
|
||||
locate('b', 'abc', 2)
|
||||
2
|
||||
select locate('b', 'abc', 3);
|
||||
locate('b', 'abc', 3)
|
||||
0
|
||||
select locate('c', 'abc', 1);
|
||||
locate('c', 'abc', 1)
|
||||
3
|
||||
select locate('c', 'abc', 3);
|
||||
locate('c', 'abc', 3)
|
||||
3
|
||||
select locate('c', 'abc', 4);
|
||||
locate('c', 'abc', 4)
|
||||
0
|
||||
select locate('bc', 'abc', 1);
|
||||
locate('bc', 'abc', 1)
|
||||
2
|
||||
select locate('bc', 'abc', 3);
|
||||
locate('bc', 'abc', 3)
|
||||
0
|
||||
select locate('', 'abc', 3);
|
||||
locate('', 'abc', 3)
|
||||
3
|
||||
select locate('', 'abc', 4);
|
||||
locate('', 'abc', 4)
|
||||
4
|
||||
select locate('', 'abc', 5);
|
||||
locate('', 'abc', 5)
|
||||
0
|
||||
select locate('阿里', '阿里巴巴', 1);
|
||||
locate('阿里', '阿里巴巴', 1)
|
||||
1
|
||||
select locate('阿里', '阿里巴巴', 2);
|
||||
locate('阿里', '阿里巴巴', 2)
|
||||
0
|
||||
select locate('巴巴', '阿里巴巴', 1);
|
||||
locate('巴巴', '阿里巴巴', 1)
|
||||
3
|
||||
select locate('巴巴', '阿里巴巴', 3);
|
||||
locate('巴巴', '阿里巴巴', 3)
|
||||
3
|
||||
select locate('巴巴', '阿里巴巴', 4);
|
||||
locate('巴巴', '阿里巴巴', 4)
|
||||
0
|
||||
select locate('巴巴', '阿里巴巴', 5);
|
||||
locate('巴巴', '阿里巴巴', 5)
|
||||
0
|
||||
select locate('', '阿里阿里', 3);
|
||||
locate('', '阿里阿里', 3)
|
||||
7
|
||||
select locate('', '阿里阿里', 4);
|
||||
locate('', '阿里阿里', 4)
|
||||
10
|
||||
select locate('', '阿里阿里', 5);
|
||||
locate('', '阿里阿里', 5)
|
||||
13
|
||||
select locate('阿里巴巴', '阿里巴巴', 0);
|
||||
locate('阿里巴巴', '阿里巴巴', 0)
|
||||
0
|
||||
select locate('阿里巴巴', '阿里巴巴', 1);
|
||||
locate('阿里巴巴', '阿里巴巴', 1)
|
||||
1
|
||||
select locate(23, 123, 1);
|
||||
locate(23, 123, 1)
|
||||
2
|
||||
select locate('', 23, 1);
|
||||
locate('', 23, 1)
|
||||
1
|
||||
select locate('23', 123, 1);
|
||||
locate('23', 123, 1)
|
||||
2
|
||||
select locate(true, '123', 1);
|
||||
locate(true, '123', 1)
|
||||
1
|
||||
select locate(true, '123', 2);
|
||||
locate(true, '123', 2)
|
||||
0
|
||||
select locate(true, '123', 2);
|
||||
locate(true, '123', 2)
|
||||
0
|
||||
select locate(true, '123', 2);
|
||||
locate(true, '123', 2)
|
||||
0
|
||||
select locate(true, '1', 1);
|
||||
locate(true, '1', 1)
|
||||
1
|
||||
select locate('1', true, 1);
|
||||
locate('1', true, 1)
|
||||
1
|
||||
select locate(1.3, '1.300000', 2);
|
||||
locate(1.3, '1.300000', 2)
|
||||
0
|
||||
select locate(1.3, '2321.300000', 2);
|
||||
locate(1.3, '2321.300000', 2)
|
||||
4
|
||||
select locate(1.3, '2321.3', 2);
|
||||
locate(1.3, '2321.3', 2)
|
||||
4
|
||||
select locate('1.3000', 451.3, 2);
|
||||
locate('1.3000', 451.3, 2)
|
||||
0
|
||||
select locate(null, '巴巴', 3);
|
||||
locate(null, '巴巴', 3)
|
||||
NULL
|
||||
select locate(null, '巴巴', 2);
|
||||
locate(null, '巴巴', 2)
|
||||
NULL
|
||||
select locate('巴巴', null, 3);
|
||||
locate('巴巴', null, 3)
|
||||
NULL
|
||||
select locate('巴巴', null, 2);
|
||||
locate('巴巴', null, 2)
|
||||
NULL
|
||||
select locate('巴巴', '阿里巴巴', null);
|
||||
locate('巴巴', '阿里巴巴', null)
|
||||
0
|
||||
select locate(null, null, 0);
|
||||
locate(null, null, 0)
|
||||
NULL
|
||||
select locate(null, null, 1);
|
||||
locate(null, null, 1)
|
||||
NULL
|
||||
select locate(false, true, 1);
|
||||
locate(false, true, 1)
|
||||
0
|
||||
select locate(false, true, 2);
|
||||
locate(false, true, 2)
|
||||
0
|
||||
select locate(true, true, 1);
|
||||
locate(true, true, 1)
|
||||
1
|
||||
select locate(true, 123, 1);
|
||||
locate(true, 123, 1)
|
||||
1
|
||||
select locate(true, 123, 2);
|
||||
locate(true, 123, 2)
|
||||
0
|
||||
select locate(false, 1023.4, 2);
|
||||
locate(false, 1023.4, 2)
|
||||
2
|
||||
select locate(false, 1023.4, 3);
|
||||
locate(false, 1023.4, 3)
|
||||
0
|
||||
select locate(true, null, 0);
|
||||
locate(true, null, 0)
|
||||
NULL
|
||||
select locate(true, null, 1);
|
||||
locate(true, null, 1)
|
||||
NULL
|
||||
select locate(null, true, 0);
|
||||
locate(null, true, 0)
|
||||
NULL
|
||||
select locate(null, true, 3);
|
||||
locate(null, true, 3)
|
||||
NULL
|
||||
select locate(true, true, null);
|
||||
locate(true, true, null)
|
||||
0
|
||||
select locate(23, 123, 1);
|
||||
locate(23, 123, 1)
|
||||
2
|
||||
select locate(23, 123, 3);
|
||||
locate(23, 123, 3)
|
||||
0
|
||||
select locate(123456, 123, 9);
|
||||
locate(123456, 123, 9)
|
||||
0
|
||||
select locate(123, 123.4, 1);
|
||||
locate(123, 123.4, 1)
|
||||
1
|
||||
select locate(123, 123.4, 2);
|
||||
locate(123, 123.4, 2)
|
||||
0
|
||||
select locate(123.4, 1234, 4);
|
||||
locate(123.4, 1234, 4)
|
||||
0
|
||||
select locate(123, null, 1);
|
||||
locate(123, null, 1)
|
||||
NULL
|
||||
select locate(123, null, null);
|
||||
locate(123, null, null)
|
||||
NULL
|
||||
select locate(null, 123, 1);
|
||||
locate(null, 123, 1)
|
||||
NULL
|
||||
select locate(null, 123, null);
|
||||
locate(null, 123, null)
|
||||
NULL
|
||||
select locate(123.4, 123.400000, 1);
|
||||
locate(123.4, 123.400000, 1)
|
||||
1
|
||||
select locate(123.4, 123.400000, 2);
|
||||
locate(123.4, 123.400000, 2)
|
||||
0
|
||||
select locate(123.41, 123.400000, 3);
|
||||
locate(123.41, 123.400000, 3)
|
||||
0
|
||||
select locate(123.400000, null, 3);
|
||||
locate(123.400000, null, 3)
|
||||
NULL
|
||||
select locate(null, 123.41, 3);
|
||||
locate(null, 123.41, 3)
|
||||
NULL
|
||||
select locate(null, 123.41, null);
|
||||
locate(null, 123.41, null)
|
||||
NULL
|
||||
select locate(null, 123.41, 126);
|
||||
locate(null, 123.41, 126)
|
||||
NULL
|
||||
drop table if exists test;
|
||||
create table test(c1 datetime primary key);
|
||||
insert into test values('2015-5-5');
|
||||
select locate('201', c1, 1) from test;
|
||||
locate('201', c1, 1)
|
||||
1
|
||||
select locate('', c1 , 1) from test;
|
||||
locate('', c1 , 1)
|
||||
1
|
||||
select locate('haha', c1 , 1) from test;
|
||||
locate('haha', c1 , 1)
|
||||
0
|
||||
select locate('-5',c1 , 1) from test;
|
||||
locate('-5',c1 , 1)
|
||||
0
|
||||
select locate('2015-5-5', c1 , 1) from test;
|
||||
locate('2015-5-5', c1 , 1)
|
||||
0
|
||||
select locate(true, c1 , 1) from test;
|
||||
locate(true, c1 , 1)
|
||||
3
|
||||
select locate(true, c1 , 4) from test;
|
||||
locate(true, c1 , 4)
|
||||
0
|
||||
select locate(201, c1 , 1) from test;
|
||||
locate(201, c1 , 1)
|
||||
1
|
||||
select locate(201.1, c1 , 1) from test;
|
||||
locate(201.1, c1 , 1)
|
||||
0
|
||||
select locate(null, c1 , 1) from test;
|
||||
locate(null, c1 , 1)
|
||||
NULL
|
||||
select locate(c1, null, 1) from test;
|
||||
locate(c1, null, 1)
|
||||
NULL
|
||||
select locate(c1, null, null) from test;
|
||||
locate(c1, null, null)
|
||||
NULL
|
||||
select mod(locate('a','b'),1.000);
|
||||
mod(locate('a','b'),1.000)
|
||||
0.000
|
||||
select ifnull(locate('a','a'),2.345 );
|
||||
ifnull(locate('a','a'),2.345 )
|
||||
1.000
|
||||
drop table if exists test;
|
||||
@ -0,0 +1,81 @@
|
||||
drop table if exists t1,t2;
|
||||
create table t1(a int, b int, c int, d int, primary key(a));
|
||||
insert into t1 values(1,2,3,4);
|
||||
insert into t1 values(2,null,3,4);
|
||||
insert into t1 values(3,null,null,4);
|
||||
insert into t1 values(4,2,null,null);
|
||||
create table t2(a int, b int, c int, d int, primary key(a,b));
|
||||
insert into t2 values(1,2,3,4);
|
||||
insert into t2 values(2,2,3,4);
|
||||
insert into t2 values(3,3,null,4);
|
||||
insert into t2 values(4,2,null,null);
|
||||
select 1<=>1;
|
||||
1<=>1
|
||||
1
|
||||
select 1<=>null;
|
||||
1<=>null
|
||||
0
|
||||
select null<=>1;
|
||||
null<=>1
|
||||
0
|
||||
select null<=>null;
|
||||
null<=>null
|
||||
1
|
||||
select 1.0<=>1.0;
|
||||
1.0<=>1.0
|
||||
1
|
||||
select 1.0<=>null;
|
||||
1.0<=>null
|
||||
0
|
||||
select null<=>1.0;
|
||||
null<=>1.0
|
||||
0
|
||||
select 'abc'<=>null;
|
||||
'abc'<=>null
|
||||
0
|
||||
select 'abc'<=>'abc';
|
||||
'abc'<=>'abc'
|
||||
1
|
||||
select 'null'<=>null;
|
||||
'null'<=>null
|
||||
0
|
||||
select (1,2,3)<=>(1,2,3);
|
||||
(1,2,3)<=>(1,2,3)
|
||||
1
|
||||
select (1,null, 3) <=> (1,null,3);
|
||||
(1,null, 3) <=> (1,null,3)
|
||||
1
|
||||
select (1,null,'abc')<=>(1,null,'abc');
|
||||
(1,null,'abc')<=>(1,null,'abc')
|
||||
1
|
||||
select * from t1 where b<=>null;
|
||||
a b c d
|
||||
2 NULL 3 4
|
||||
3 NULL NULL 4
|
||||
select * from t1 where a<=>2;
|
||||
a b c d
|
||||
2 NULL 3 4
|
||||
select * from t1 where a<=>2 and b<=>null;
|
||||
a b c d
|
||||
2 NULL 3 4
|
||||
select * from t1 where b<=>null and c<=>null;
|
||||
a b c d
|
||||
3 NULL NULL 4
|
||||
select * from t1 where b=null and c=null;
|
||||
a b c d
|
||||
select * from t1 where b<=>null and c=null;
|
||||
a b c d
|
||||
select * from t1 join t2 on t1.a=t2.a;
|
||||
a b c d a b c d
|
||||
1 2 3 4 1 2 3 4
|
||||
2 NULL 3 4 2 2 3 4
|
||||
3 NULL NULL 4 3 3 NULL 4
|
||||
4 2 NULL NULL 4 2 NULL NULL
|
||||
select * from t1 join t2 on t1.a=t2.a where t1.b<=>null and t2.b<=>null;
|
||||
a b c d a b c d
|
||||
select * from t1 join t2 on t1.a<=>t2.a;
|
||||
a b c d a b c d
|
||||
1 2 3 4 1 2 3 4
|
||||
2 NULL 3 4 2 2 3 4
|
||||
3 NULL NULL 4 3 3 NULL 4
|
||||
4 2 NULL NULL 4 2 NULL NULL
|
||||
@ -0,0 +1,143 @@
|
||||
================ expression position ================
|
||||
select position(' ' in 'abc');
|
||||
position(' ' in 'abc')
|
||||
0
|
||||
select position('abcd' in 'abc');
|
||||
position('abcd' in 'abc')
|
||||
0
|
||||
select position('abc' in 'abc');
|
||||
position('abc' in 'abc')
|
||||
1
|
||||
select position('a' in 'abc');
|
||||
position('a' in 'abc')
|
||||
1
|
||||
select position('b' in 'abc');
|
||||
position('b' in 'abc')
|
||||
2
|
||||
select position('c' in 'abc');
|
||||
position('c' in 'abc')
|
||||
3
|
||||
select position('bc' in 'abc');
|
||||
position('bc' in 'abc')
|
||||
2
|
||||
select position('bc' in 'abcbc');
|
||||
position('bc' in 'abcbc')
|
||||
2
|
||||
select position('BC' in 'abcbc');
|
||||
position('BC' in 'abcbc')
|
||||
2
|
||||
select position('bC' in 'abcbc');
|
||||
position('bC' in 'abcbc')
|
||||
2
|
||||
select position('阿里' in '阿里巴巴');
|
||||
position('阿里' in '阿里巴巴')
|
||||
1
|
||||
select position('巴巴' in '阿里巴巴巴巴');
|
||||
position('巴巴' in '阿里巴巴巴巴')
|
||||
3
|
||||
select position('阿里巴巴' in '阿里巴巴');
|
||||
position('阿里巴巴' in '阿里巴巴')
|
||||
1
|
||||
select position(true in '123');
|
||||
position(true in '123')
|
||||
1
|
||||
select position(true in '23');
|
||||
position(true in '23')
|
||||
0
|
||||
select position(23 in 123);
|
||||
position(23 in 123)
|
||||
2
|
||||
select position('' in 23);
|
||||
position('' in 23)
|
||||
1
|
||||
select position('23' in 123);
|
||||
position('23' in 123)
|
||||
2
|
||||
select position(123.4 in '123.400000');
|
||||
position(123.4 in '123.400000')
|
||||
1
|
||||
select position('123.400000' in 123.4);
|
||||
position('123.400000' in 123.4)
|
||||
0
|
||||
select position('123.400000' in null);
|
||||
position('123.400000' in null)
|
||||
NULL
|
||||
select position(null in '巴巴');
|
||||
position(null in '巴巴')
|
||||
NULL
|
||||
select position('巴巴' in null);
|
||||
position('巴巴' in null)
|
||||
NULL
|
||||
select position(null in null);
|
||||
position(null in null)
|
||||
NULL
|
||||
select position(false in true);
|
||||
position(false in true)
|
||||
0
|
||||
select position(true in true);
|
||||
position(true in true)
|
||||
1
|
||||
select position(true in 123);
|
||||
position(true in 123)
|
||||
1
|
||||
select position(false in 123);
|
||||
position(false in 123)
|
||||
0
|
||||
select position(false in 0123);
|
||||
position(false in 0123)
|
||||
0
|
||||
select position(false in 1023);
|
||||
position(false in 1023)
|
||||
2
|
||||
select position(23 in 123);
|
||||
position(23 in 123)
|
||||
2
|
||||
select position(123456 in 123);
|
||||
position(123456 in 123)
|
||||
0
|
||||
select position(123 in 123.4);
|
||||
position(123 in 123.4)
|
||||
1
|
||||
select position(123.4 in 1234);
|
||||
position(123.4 in 1234)
|
||||
0
|
||||
select position(123 in null);
|
||||
position(123 in null)
|
||||
NULL
|
||||
select position(null in 123);
|
||||
position(null in 123)
|
||||
NULL
|
||||
drop table if exists test;
|
||||
create table test(c1 datetime primary key);
|
||||
insert into test values('2015-5-5');
|
||||
select position('201' in c1) from test;
|
||||
position('201' in c1)
|
||||
1
|
||||
select position('' in c1) from test;
|
||||
position('' in c1)
|
||||
1
|
||||
select position('haha' in c1) from test;
|
||||
position('haha' in c1)
|
||||
0
|
||||
select position('-5' in c1) from test;
|
||||
position('-5' in c1)
|
||||
0
|
||||
select position('2015-5-5' in c1) from test;
|
||||
position('2015-5-5' in c1)
|
||||
0
|
||||
select position(true in c1) from test;
|
||||
position(true in c1)
|
||||
3
|
||||
select position(201 in c1) from test;
|
||||
position(201 in c1)
|
||||
1
|
||||
select position(201.1 in c1) from test;
|
||||
position(201.1 in c1)
|
||||
0
|
||||
select position(c1 in null) from test;
|
||||
position(c1 in null)
|
||||
NULL
|
||||
select position(null in c1) from test;
|
||||
position(null in c1)
|
||||
NULL
|
||||
drop table if exists test;
|
||||
@ -0,0 +1,57 @@
|
||||
drop table if exists t1,t2;
|
||||
select 0<=>0,0.0<=>0.0,0E0=0E0,'A'<=>'A',NULL<=>NULL;
|
||||
0<=>0 0.0<=>0.0 0E0=0E0 'A'<=>'A' NULL<=>NULL
|
||||
1 1 1 1 1
|
||||
select 1<=>0,0<=>NULL,NULL<=>0;
|
||||
1<=>0 0<=>NULL NULL<=>0
|
||||
0 0 0
|
||||
select 1.0<=>0.0,0.0<=>NULL,NULL<=>0.0;
|
||||
1.0<=>0.0 0.0<=>NULL NULL<=>0.0
|
||||
0 0 0
|
||||
select 'A'<=>'B','A'<=>NULL,NULL<=>'A';
|
||||
'A'<=>'B' 'A'<=>NULL NULL<=>'A'
|
||||
0 0 0
|
||||
select 0<=>0.0, 0.0<=>0E0, 0E0<=>'0', 10.0<=>1E1, 10<=>10.0, 10<=>1E1;
|
||||
0<=>0.0 0.0<=>0E0 0E0<=>'0' 10.0<=>1E1 10<=>10.0 10<=>1E1
|
||||
1 1 1 1 1 1
|
||||
select 1.0<=>0E1,10<=>NULL,NULL<=>0.0, NULL<=>0E0;
|
||||
1.0<=>0E1 10<=>NULL NULL<=>0.0 NULL<=>0E0
|
||||
0 0 0 0
|
||||
create table t1 (id int primary key, value int);
|
||||
create table t2 (id int primary key, value int);
|
||||
insert into t1 values (1,null);
|
||||
insert into t2 values (1,null);
|
||||
select t1.*, t2.*, t1.value=t2.value from t1, t2 where t1.id=t2.id and t1.id=1;
|
||||
id value id value t1.value=t2.value
|
||||
1 NULL 1 NULL NULL
|
||||
select * from t1 where id =id;
|
||||
id value
|
||||
1 NULL
|
||||
select * from t1 where value = value;
|
||||
id value
|
||||
select * from t1 where id = value or value=id;
|
||||
id value
|
||||
select * from t1 where value = null;
|
||||
id value
|
||||
select * from t1 where (value) = (null);
|
||||
id value
|
||||
select * from t1 where ROW(value) = ROW(null);
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near ') = ROW(null)' at line 1
|
||||
select * from t1 where (id, value) = (1, null);
|
||||
id value
|
||||
drop table t1,t2;
|
||||
create table t1 (a bigint primary key);
|
||||
insert into t1 values (4828532208463511553);
|
||||
select * from t1 where a = '4828532208463511553';
|
||||
a
|
||||
4828532208463511553
|
||||
select * from t1 where a = 4828532208463511553;
|
||||
a
|
||||
4828532208463511553
|
||||
select * from t1 where a in ('4828532208463511553');
|
||||
a
|
||||
4828532208463511553
|
||||
select * from t1 where a in (4828532208463511553,1);
|
||||
a
|
||||
4828532208463511553
|
||||
drop table t1;
|
||||
@ -0,0 +1,100 @@
|
||||
select length('ab');
|
||||
length('ab')
|
||||
2
|
||||
select length('ab ');
|
||||
length('ab ')
|
||||
3
|
||||
select length('ab\t');
|
||||
length('ab\t')
|
||||
3
|
||||
select length('ab\0');
|
||||
length('ab\0')
|
||||
3
|
||||
select length('\_');
|
||||
length('\_')
|
||||
2
|
||||
select length('\%');
|
||||
length('\%')
|
||||
2
|
||||
select length('\\');
|
||||
length('\\')
|
||||
1
|
||||
select length('\z');
|
||||
length('\z')
|
||||
1
|
||||
select length('\n\t\r\b\0\_\%\\');
|
||||
length('\n\t\r\b\0\_\%\\')
|
||||
10
|
||||
select length('\a');
|
||||
length('\a')
|
||||
1
|
||||
select length('\m');
|
||||
length('\m')
|
||||
1
|
||||
select length(12.466);
|
||||
length(12.466)
|
||||
6
|
||||
select length(4334);
|
||||
length(4334)
|
||||
4
|
||||
select length(0.00);
|
||||
length(0.00)
|
||||
4
|
||||
select length('好');
|
||||
length('好')
|
||||
3
|
||||
select length(13bd);
|
||||
ERROR 42S22: Unknown column '13bd' in 'field list'
|
||||
select length(db24);
|
||||
ERROR 42S22: Unknown column 'db24' in 'field list'
|
||||
select length(00.000);
|
||||
length(00.000)
|
||||
5
|
||||
select length(00.000);
|
||||
length(00.000)
|
||||
5
|
||||
select length(1.00000);
|
||||
length(1.00000)
|
||||
7
|
||||
select length(10000.10);
|
||||
length(10000.10)
|
||||
8
|
||||
create database if not exists db1;
|
||||
use db1;
|
||||
drop table if exists utf,tx,gbk;
|
||||
create table utf(c1 int primary key, c2 char(10)) collate 'utf8mb4_bin';
|
||||
insert into utf values(1, '好');
|
||||
select length(c2) from utf;
|
||||
length(c2)
|
||||
3
|
||||
create table tx(s int(255) zerofill);
|
||||
insert into tx values (2);
|
||||
select * from tx;
|
||||
s
|
||||
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002
|
||||
select * from tx;
|
||||
s
|
||||
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002
|
||||
select * from tx;
|
||||
s
|
||||
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002
|
||||
select length(s) from tx;
|
||||
length(s)
|
||||
255
|
||||
drop table tx;
|
||||
create table tx(s int(121) zerofill);
|
||||
insert into tx values (1234);
|
||||
select * from tx;
|
||||
s
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001234
|
||||
select * from tx;
|
||||
s
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001234
|
||||
select * from tx;
|
||||
s
|
||||
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001234
|
||||
select length(s) from tx;
|
||||
length(s)
|
||||
121
|
||||
drop table tx;
|
||||
drop database db1;
|
||||
6289
tools/deploy/mysql_test/test_suite/expr/r/mysql/func_regexp.result
Normal file
6289
tools/deploy/mysql_test/test_suite/expr/r/mysql/func_regexp.result
Normal file
File diff suppressed because it is too large
Load Diff
256
tools/deploy/mysql_test/test_suite/expr/t/collation_expr.test
Normal file
256
tools/deploy/mysql_test/test_suite/expr/t/collation_expr.test
Normal file
@ -0,0 +1,256 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: luofan.zp
|
||||
# owner group: SQL3
|
||||
# description: collation of all expression operator
|
||||
# Author: zhuweng.yzf
|
||||
# ....yzf....Fri, 21 Aug 2015....17:55....
|
||||
|
||||
# set-up
|
||||
--disable_warnings
|
||||
drop table if exists coll_test;
|
||||
--enable_warnings
|
||||
create table coll_test(pk bigint primary key, uc varchar(10) collate utf8_general_ci, ub varchar(10) collate utf8_bin, b varbinary(10));
|
||||
--source mysql_test/include/show_create_table_old_version.inc
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create table coll_test;
|
||||
insert into coll_test values (1314, 'abc', 'def', 'xyz');
|
||||
select * from coll_test;
|
||||
################################################################
|
||||
# concat
|
||||
select collation(concat(null)) from coll_test;
|
||||
select collation(concat(uc, ub)) from coll_test;
|
||||
select collation(concat(uc, b)) from coll_test;
|
||||
select collation(concat(uc, x'41')) from coll_test;
|
||||
select collation(concat('abc', x'41')) from coll_test;
|
||||
select collation(concat('abc' collate utf8mb4_general_ci, x'41')) from coll_test;
|
||||
select collation(concat(1, 2)) from coll_test;
|
||||
select collation(concat(1, null)) from coll_test;
|
||||
|
||||
# group_concat
|
||||
select collation(group_concat(null)) from coll_test;
|
||||
select collation(group_concat(uc, ub)) from coll_test;
|
||||
select collation(group_concat(uc, b)) from coll_test;
|
||||
select collation(group_concat(uc, x'41')) from coll_test;
|
||||
select collation(group_concat('abc', x'41')) from coll_test;
|
||||
select collation(group_concat('abc' collate utf8mb4_general_ci, x'41')) from coll_test;
|
||||
select collation(group_concat(1, 2)) from coll_test;
|
||||
select collation(group_concat(1, null)) from coll_test;
|
||||
|
||||
# concat_ws
|
||||
select collation(concat_ws(',', null)) from coll_test;
|
||||
select collation(concat_ws(',', uc, ub)) from coll_test;
|
||||
select collation(concat_ws(',', uc, b)) from coll_test;
|
||||
select collation(concat_ws(',', uc, x'41')) from coll_test;
|
||||
select collation(concat_ws(',', 'abc', x'41')) from coll_test;
|
||||
select collation(concat_ws(',', 'abc' collate utf8mb4_general_ci, x'41')) from coll_test;
|
||||
select collation(concat_ws(',', 1, 2)) from coll_test;
|
||||
select collation(concat_ws(',', 1, null)) from coll_test;
|
||||
|
||||
# reverse
|
||||
select collation(reverse(null)) from coll_test;
|
||||
select collation(reverse(uc)) from coll_test;
|
||||
select collation(reverse(ub)) from coll_test;
|
||||
select collation(reverse(b)) from coll_test;
|
||||
select collation(reverse(pk)) from coll_test;
|
||||
select collation(reverse(X'41')) from coll_test;
|
||||
|
||||
# lower
|
||||
select collation(lower(null)) from coll_test;
|
||||
select collation(lower(uc)) from coll_test;
|
||||
select collation(lower(ub)) from coll_test;
|
||||
select collation(lower(b)) from coll_test;
|
||||
select collation(lower(pk)) from coll_test;
|
||||
select collation(lower(X'41')) from coll_test;
|
||||
|
||||
# upper
|
||||
select collation(upper(null)) from coll_test;
|
||||
select collation(upper(uc)) from coll_test;
|
||||
select collation(upper(ub)) from coll_test;
|
||||
select collation(upper(b)) from coll_test;
|
||||
select collation(upper(pk)) from coll_test;
|
||||
select collation(upper(X'41')) from coll_test;
|
||||
|
||||
# right
|
||||
select collation(right(null, 2)) from coll_test;
|
||||
select collation(right(uc, 2)) from coll_test;
|
||||
select collation(right(ub, 2)) from coll_test;
|
||||
select collation(right(b, 2)) from coll_test;
|
||||
select collation(right(pk, 2)) from coll_test;
|
||||
select collation(right(X'41', 2)) from coll_test;
|
||||
|
||||
#substr
|
||||
select collation(substr(null, 2)) from coll_test;
|
||||
select collation(substr(uc, 2)) from coll_test;
|
||||
select collation(substr(ub, 2)) from coll_test;
|
||||
select collation(substr(b, 2)) from coll_test;
|
||||
select collation(substr(pk, 2)) from coll_test;
|
||||
select collation(substr(X'41', 2)) from coll_test;
|
||||
|
||||
#trim
|
||||
select collation(trim('a' from null)) from coll_test;
|
||||
select collation(trim('a' from uc)) from coll_test;
|
||||
select collation(trim('a' from ub)) from coll_test;
|
||||
select collation(trim('a' from b)) from coll_test;
|
||||
select collation(trim('a' from pk)) from coll_test;
|
||||
select collation(trim('a' from X'41')) from coll_test;
|
||||
|
||||
#repeat
|
||||
select collation(repeat(null, 2)) from coll_test;
|
||||
select collation(repeat(uc, 2)) from coll_test;
|
||||
select collation(repeat(ub, 2)) from coll_test;
|
||||
select collation(repeat(b, 2)) from coll_test;
|
||||
select collation(repeat(pk, 2)) from coll_test;
|
||||
select collation(repeat(X'41', 2)) from coll_test;
|
||||
|
||||
# rpad
|
||||
select collation(rpad(null, 2, 'a')) from coll_test;
|
||||
select collation(rpad(uc, 2, ub)) from coll_test;
|
||||
select collation(rpad(ub, 2, b)) from coll_test;
|
||||
select collation(rpad(b, 2, uc)) from coll_test;
|
||||
select collation(rpad(pk, 2, uc)) from coll_test;
|
||||
select collation(rpad(X'41', 2, uc)) from coll_test;
|
||||
|
||||
#replace
|
||||
select collation(replace(null, b, 'a')) from coll_test;
|
||||
select collation(replace(uc, b, ub)) from coll_test;
|
||||
select collation(replace(ub, uc, ub)) from coll_test;
|
||||
select collation(replace(uc, 'a', 'b')) from coll_test;
|
||||
select collation(replace(pk, 1, 2)) from coll_test;
|
||||
select collation(replace(X'41', 'a', 'b')) from coll_test;
|
||||
|
||||
#replace
|
||||
select collation(replace(null, b, 'a')) from coll_test;
|
||||
select collation(replace(uc, b, ub)) from coll_test;
|
||||
select collation(replace(ub, uc, ub)) from coll_test;
|
||||
select collation(replace(uc, 'a', 'b')) from coll_test;
|
||||
select collation(replace(pk, 1, 2)) from coll_test;
|
||||
select collation(replace(X'41', 'a', 'b')) from coll_test;
|
||||
|
||||
#substring_index
|
||||
select collation(substring_index(null, b, 2)) from coll_test;
|
||||
select collation(substring_index(uc, b, 2)) from coll_test;
|
||||
select collation(substring_index(ub, uc, 2)) from coll_test;
|
||||
select collation(substring_index(ub, b, 2)) from coll_test;
|
||||
select collation(substring_index(uc, 'a', 2)) from coll_test;
|
||||
select collation(substring_index(pk, 1, 2)) from coll_test;
|
||||
select collation(substring_index(X'41', 'a', 2)) from coll_test;
|
||||
|
||||
# locate
|
||||
select cmp_meta(locate('b' collate utf8mb4_general_ci, 'aBc' collate utf8mb4_general_ci));
|
||||
select cmp_meta(locate('b' collate utf8mb4_bin, 'aBc' collate utf8mb4_bin));
|
||||
select cmp_meta(locate('b', 'aBc'));
|
||||
select cmp_meta(locate('b' collate utf8mb4_general_ci, 'aBc' collate utf8mb4_general_ci, 1));
|
||||
select cmp_meta(locate('b' collate utf8mb4_bin, 'aBc' collate utf8mb4_bin, 1));
|
||||
select cmp_meta(locate('b', 'aBc', 1));
|
||||
select cmp_meta(locate(uc, ub)) from coll_test;
|
||||
select cmp_meta(locate(uc, b)) from coll_test;
|
||||
select cmp_meta(locate(b, b)) from coll_test;
|
||||
select cmp_meta(locate(b, pk)) from coll_test;
|
||||
|
||||
# instr
|
||||
select cmp_meta(instr('abc' collate utf8_bin, 'B' collate utf8_bin));
|
||||
select cmp_meta(instr('abc' collate utf8_general_ci, 'B' collate utf8_general_ci));
|
||||
select cmp_meta(instr('abc', 'B'));
|
||||
|
||||
# current_user
|
||||
select collation(current_user());
|
||||
select coercibility(current_user());
|
||||
|
||||
# database
|
||||
select collation(database());
|
||||
select coercibility(database());
|
||||
|
||||
# conv
|
||||
select collation(conv(null, 10, 8));
|
||||
select collation(conv(1024, 10, 8));
|
||||
|
||||
# bin
|
||||
select collation(bin(null));
|
||||
select collation(bin(uc)) from coll_test;
|
||||
select collation(bin(pk)) from coll_test;
|
||||
select collation(bin(b)) from coll_test;
|
||||
|
||||
# effective_tenant
|
||||
select collation(effective_tenant());
|
||||
select coercibility(effective_tenant());
|
||||
|
||||
# like
|
||||
select collation(uc like b) from coll_test;
|
||||
select cmp_meta(uc like b) from coll_test;
|
||||
select cmp_meta(uc like ub) from coll_test;
|
||||
select cmp_meta(b like b) from coll_test;
|
||||
select cmp_meta(uc like b) from coll_test;
|
||||
|
||||
# cast
|
||||
select collation(cast(uc as binary)) from coll_test;
|
||||
select collation(cast(pk as char)) from coll_test;
|
||||
select uc, collation(binary uc) from coll_test;
|
||||
select collation(binary binary uc collate utf8_bin) from coll_test;
|
||||
|
||||
# user
|
||||
select collation(user());
|
||||
select coercibility(user());
|
||||
|
||||
# version
|
||||
select collation(version());
|
||||
select coercibility(version());
|
||||
|
||||
# unhex
|
||||
select collation(unhex('42'));
|
||||
select collation(unhex(null));
|
||||
|
||||
# regexp
|
||||
select collation(uc regexp b) from coll_test;
|
||||
select cmp_meta(uc regexp b) from coll_test;
|
||||
select cmp_meta(uc regexp ub) from coll_test;
|
||||
select cmp_meta(b regexp b) from coll_test;
|
||||
select cmp_meta(uc regexp b) from coll_test;
|
||||
select cmp_meta(uc regexp 'abc') from coll_test;
|
||||
|
||||
# quote
|
||||
select collation(quote(uc)) from coll_test;
|
||||
select collation(quote(ub)) from coll_test;
|
||||
select collation(quote(b)) from coll_test;
|
||||
select collation(quote(pk)) from coll_test;
|
||||
select collation(quote(null)) from coll_test;
|
||||
|
||||
# md5
|
||||
select collation(md5(uc)) from coll_test;
|
||||
select collation(md5(ub)) from coll_test;
|
||||
select collation(md5(b)) from coll_test;
|
||||
select collation(md5(pk)) from coll_test;
|
||||
select collation(md5(null)) from coll_test;
|
||||
|
||||
# dump
|
||||
select collation(dump(null)) from coll_test;
|
||||
|
||||
# hex
|
||||
select collation(hex(uc)) from coll_test;
|
||||
select collation(hex(ub)) from coll_test;
|
||||
select collation(hex(b)) from coll_test;
|
||||
select collation(hex(pk)) from coll_test;
|
||||
select collation(hex(null)) from coll_test;
|
||||
|
||||
# int2ip
|
||||
select collation(int2ip(pk)) from coll_test;
|
||||
select collation(int2ip(null)) from coll_test;
|
||||
|
||||
# date_format
|
||||
SELECT collation(DATE_FORMAT('2009-10-04 22:23:00', '%W %M %Y'));
|
||||
|
||||
# all implicit cast should use the connection_collation as the result collation
|
||||
set collation_connection = utf8mb4_general_ci;
|
||||
select collation(cast(1 as char));
|
||||
SELECT collation(DATE_FORMAT('2009-10-04 22:23:00', '%W %M %Y'));
|
||||
select collation(cast('A' as char)), cast('A' as char) < 'a';
|
||||
|
||||
set collation_connection = utf8mb4_bin;
|
||||
select collation(cast(1 as char));
|
||||
SELECT collation(DATE_FORMAT('2009-10-04 22:23:00', '%W %M %Y'));
|
||||
select collation(cast('A' as char)), cast('A' as char) < 'a';
|
||||
|
||||
################################################################
|
||||
# tear-down
|
||||
drop table coll_test;
|
||||
61
tools/deploy/mysql_test/test_suite/expr/t/expr_ceil.test
Normal file
61
tools/deploy/mysql_test/test_suite/expr/t/expr_ceil.test
Normal file
@ -0,0 +1,61 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#### owner: peihan.dph
|
||||
#### owner group: sql3
|
||||
#### description: 测试向上取整函数(天花板函数)
|
||||
--echo ================ expression ceil ================
|
||||
--disable_warnings
|
||||
drop table if exists test;
|
||||
--enable_warnings
|
||||
create table test (pk int primary key, c1 tinyint, c2 smallint, c3 mediumint, c4 int, c5 bigint, c6 tinyint unsigned, c7 smallint unsigned, c8 mediumint unsigned, c9 int unsigned, c10 bigint unsigned, c11 float, c12 double, c13 float unsigned, c14 double unsigned, c15 decimal(20, 10), c16 decimal(20, 10) unsigned, c17 datetime(6), c18 timestamp(6) default "2012-01-01 12:00:00", c19 date, c20 time, c21 year , c22 varchar(10000), c23 char(255), c24 varbinary(10000), c25 binary(255));
|
||||
insert into test values (0, -128, 2, -3, 4, -5, 6, 7, 8, 9, 10, -11.49, -12.5, 13.5, 14.49, 15.99, 16.1, '2017-01-01 00:01:10.123456', '2018-02-02 00:02:20.123456', '2019-03-03', '20:04:40.123456', '2021', '22.5324', '-23.436456', '-24', '25');
|
||||
insert into test values (1, 1, -2, 3, -4, 5, 6, 7, 8, 9, 10, -11.49, -12.5, 13.5, 14.49, 15.99, 16.1, '2017-01-01 00:01:10.123456', '2018-02-02 00:02:20.123456', '2019-03-03', '20:04:40.123456', '2021', '-22.999999', '23.00001', '24.9999', '-25.00001');
|
||||
insert into test values (2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
select ceil(pk), ceil(c1), ceil(c2), ceil(c3), ceil(c4), ceil(c5), ceil(c6), ceil(c7), ceil(c8), ceil(c9), ceil(c10), ceil(c11), ceil(c12), ceil(c13), ceil(c14), ceil(c15), ceil(c16), ceil(c22), ceil(c23), ceil(c24), ceil(c25) from test;
|
||||
--disable_warnings
|
||||
drop table if exists test;
|
||||
--enable_warnings
|
||||
select ceil(3.1415926);
|
||||
select ceil(-3.1415926);
|
||||
select ceil(0.00);
|
||||
select ceil(-0.0);
|
||||
select ceil(0.123456789);
|
||||
select ceil(-0.123456789);
|
||||
select ceil(123456789.123456789);
|
||||
select ceil(-99999999.999999999);
|
||||
select ceil(999999999.123456789);
|
||||
select ceil(-999999999.123456789);
|
||||
select ceil(-123456789123456789123456789.123456789);
|
||||
select ceil(123456789123456789123456789123456789123456789123456789.123456789);
|
||||
select ceil(-123456789123456789123456789123456789123456789123456789.123456789);
|
||||
select ceil(123456789123456789123456789.123456789123456789123456789123456789);
|
||||
select ceil(-123456789123456789123456789.123456789123456789123456789123456789);
|
||||
select ceil(-123456789123456789123456789.123456789);
|
||||
select ceil(999999999999999999999999999999999999999999999.499999999);
|
||||
select ceil(999999999999999999999999999999999999999999999.500000001);
|
||||
select ceil(99999999999999999999999999999999999999999999.399999999);
|
||||
select ceil(-99999999999999999999999999999999999999999999.399999999);
|
||||
select ceil(-99999999999999999999999999999999999999999999.399999999);
|
||||
select ceil(999999999999999999999999999999999999999999999211111.399999999);
|
||||
select ceil(-999999999999999999999999999999999999999999999211111.399999999);
|
||||
select ceil(-999999999999999999999999999999999999999999999511111.399999999);
|
||||
select ceil(-999999999999999999999999999999999999999999999499999.399999999);
|
||||
select ceil(-1);
|
||||
select ceil(-161);
|
||||
select ceil(null);
|
||||
select ceil("13547370213547370213547370213547370201354737021354737021354737021354737021354737021354737021354737021354737021354737021354737021354737021354737021354737020.0000135473702135473702135473702135473702135473702135473702135473702135473702013547370213547370201354737021354737021354737021354737021354737021354737021354737021.0000135473702135473702135473702135473702135473702111111111111111111");
|
||||
select ceil("13547370213547370213547370213547370201354737021354737021354737021354737021354737021354737021354737021354737021354737021354737021354737021354737021354737020.0000135473702135473702135473702135473702135473702135473702135473702135473702013547370213547370201354737021354737021354737021354737021354737021354737021354737021.0000135473702135473702135473702135473702135473702catters billet chloroplast's'");
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
CREATE TABLE t1(id int,consumer char(20), price varchar(20),sal int,datetime1 DATE,datetime2 bigint);
|
||||
INSERT INTO t1 VALUES(1,'苹果','6500',5000,'2020-09-22 12:11:59',20200923121200);
|
||||
INSERT INTO t1 VALUES(2,'小米','3000',4000,'2020-09-21 10:11:59',20200921101159);
|
||||
INSERT INTO t1 VALUES(3,'OPPO','5000',3000,'2020-08-21 10:11:59',20190821101159);
|
||||
INSERT INTO t1 VALUES(4,'华为','9111',10000,'2020-02-29 10:11:59',20200228101159);
|
||||
|
||||
|
||||
SELECT CEIL(rpad(price,20,sal)) FROM t1 ORDER BY id;
|
||||
SELECT rpad(CEIL(sal),20,CEIL(price)) FROM t1 ORDER BY id;
|
||||
155
tools/deploy/mysql_test/test_suite/expr/t/expr_convert_tz.test
Normal file
155
tools/deploy/mysql_test/test_suite/expr/t/expr_convert_tz.test
Normal file
@ -0,0 +1,155 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=on;
|
||||
--enable_query_log
|
||||
# owner: dachuan.sdc
|
||||
# owner group: SQL2
|
||||
# Test of functions convert_tz
|
||||
|
||||
|
||||
--echo ================ expression convert_tz ================
|
||||
--source mysql_test/test_suite/otimestamp/t/otimestamp_import_time_zone_mysql.inc
|
||||
# 直接时刻类型
|
||||
SELECT CONVERT_TZ('2021-01-01 12:00:00','+00:00','+08:00');
|
||||
SELECT CONVERT_TZ('2021-01-01 12:00:00','+01:00','+08:00');
|
||||
SELECT CONVERT_TZ('2021-01-01 12:00:00','+01:00','+06:30');
|
||||
SELECT CONVERT_TZ('2021-01-01 12:00:00','+01:00','+10:10');
|
||||
SELECT CONVERT_TZ('2021-01-01 12:00:00','+01:30','+13:00');
|
||||
SELECT CONVERT_TZ('2021-01-01 12:00:00','-11:30','+13:00');
|
||||
SELECT CONVERT_TZ('2021-01-01 12:00:00','-12:00','+13:00');
|
||||
SELECT CONVERT_TZ('2021-01-01 00:00:00','-12:00','+13:00');
|
||||
SELECT CONVERT_TZ('2021-01-01 23:59:59','-12:00','+13:00');
|
||||
SELECT CONVERT_TZ('2021-01-01 13:19:38','-10:38','+10:12');
|
||||
SELECT CONVERT_TZ('2021-01-01 12:23:35','-09:23','-11:11');
|
||||
SELECT CONVERT_TZ('2021-01-01 00:01:00','+10:00','-11:00');
|
||||
SELECT CONVERT_TZ('2021-01-01 00:11:00','+00:00','-11:00');
|
||||
SELECT CONVERT_TZ('2021-03-01 00:11:00','+00:00','-11:00');
|
||||
SELECT CONVERT_TZ('2021-06-01 00:11:00','+00:00','-11:00');
|
||||
SELECT CONVERT_TZ('2020-03-01 00:11:00','+00:00','-11:00');
|
||||
SELECT CONVERT_TZ('2020-02-28 23:11:00','-00:00','+11:00');
|
||||
SELECT CONVERT_TZ('2020-12-31 23:11:00','-05:00','+11:00');
|
||||
|
||||
#直接时刻类型异常
|
||||
SELECT CONVERT_TZ('2020-12-31 23:11:00',null,'+11:00');
|
||||
SELECT CONVERT_TZ('2020-12-31 23:11:00','+11:00', null);
|
||||
SELECT CONVERT_TZ(null,'-13:00','+11:00');
|
||||
SELECT CONVERT_TZ(null, null,'+11:00');
|
||||
SELECT CONVERT_TZ(null, null, null);
|
||||
|
||||
#时区类型
|
||||
SELECT CONVERT_TZ('2020-12-31 23:11:00','America/Merida','Asia/Tokyo');
|
||||
SELECT CONVERT_TZ('2021-01-01 00:11:00','America/Merida','Australia/Darwin');
|
||||
SELECT CONVERT_TZ('2021-01-01 00:11:00','America/Merida','Europe/Amsterdam');
|
||||
SELECT CONVERT_TZ('2021-01-01 07:11:00','Europe/Amsterdam','America/Merida');
|
||||
SELECT CONVERT_TZ('2021-01-01 07:11:00','MET','Libya');
|
||||
SELECT CONVERT_TZ('2021-01-01 07:11:00','MET','MST');
|
||||
SELECT CONVERT_TZ('2021-01-01 07:11:00','PRC','MST');
|
||||
SELECT CONVERT_TZ('2021-01-01 07:11:00','PRC','ROC');
|
||||
SELECT CONVERT_TZ('2021-01-01 07:11:00','UCT','ROC');
|
||||
SELECT CONVERT_TZ('2021-01-01 07:11:00','Universal','ROC');
|
||||
SELECT CONVERT_TZ('2021-01-01 07:11:00','Pacific/Marquesas','ROC');
|
||||
SELECT CONVERT_TZ('2021-02-28 17:11:00','GMT+0','ROC');
|
||||
SELECT CONVERT_TZ('2021-02-28 17:11:00','GMT+0','Singapore');
|
||||
SELECT CONVERT_TZ('2021-02-28 17:11:00','US/Michigan','ROC');
|
||||
|
||||
#时区类型异常
|
||||
SELECT CONVERT_TZ('2021-02-28 17:11:00', null,'ROC');
|
||||
SELECT CONVERT_TZ('2021-02-28 17:11:00','US/Michigan', null);
|
||||
SELECT CONVERT_TZ('2021-02-28 17:11:00', null, null);
|
||||
|
||||
#混合类型
|
||||
SELECT CONVERT_TZ('2021-02-28 17:11:00', '+00:00','ROC');
|
||||
SELECT CONVERT_TZ('2021-02-28 17:11:00', '+00:00','US/Michigan');
|
||||
SELECT CONVERT_TZ('2021-02-28 17:11:00', 'ROC','+00:00');
|
||||
SELECT CONVERT_TZ('2021-02-28 17:11:00', 'US/Michigan', '+00:00');
|
||||
SELECT CONVERT_TZ('2021-02-28 17:11:00', 'ROC','+12:58');
|
||||
SELECT CONVERT_TZ('2021-01-01 07:11:00', 'UCT','-12:58');
|
||||
SELECT CONVERT_TZ('2021-01-01 07:11:00', '-12:58','UCT');
|
||||
SELECT CONVERT_TZ('2021-01-01 07:11:00', '-12:58','US/Michigan');
|
||||
SELECT CONVERT_TZ('2021-01-01 07:11:00', '+05:12','MET');
|
||||
SELECT CONVERT_TZ('2021-01-01 07:11:00', '+03:32','PRC');
|
||||
SELECT CONVERT_TZ('2021-01-01 07:11:00', '+11:32','PRC');
|
||||
|
||||
##bugfix: https://work.aone.alibaba-inc.com/issue/37089894
|
||||
SELECT CONVERT_TZ('2004-01-01 12:00:00','-13:00','+10:00');
|
||||
SELECT CONVERT_TZ('2004-01-01 12:00:00','-12:00','+14:00');
|
||||
SELECT CONVERT_TZ('2004-01-01 12:00:00','-13:00','ABC');
|
||||
SELECT CONVERT_TZ('2004-01-01 12:00:00','-12:00','OK');
|
||||
--disable_warnings
|
||||
drop table if exists t;
|
||||
--enable_warnings
|
||||
create table t(c1 timestamp);
|
||||
insert into t values(CONVERT_TZ('2004-01-01 12:00:00','-13:00','+10:00'));
|
||||
insert into t values(CONVERT_TZ('2004-01-01 12:00:00','-12:00','+14:00'));
|
||||
insert into t values(CONVERT_TZ('2004-01-01 12:00:00','-13:00','ABC'));
|
||||
insert into t values(CONVERT_TZ('2004-01-01 12:00:00','-12:00','OK'));
|
||||
select * from t;
|
||||
delete from t;
|
||||
|
||||
## test result out of range
|
||||
select convert_tz('9999-12-31 20:00:00', '+02:00', '+06:00');
|
||||
select convert_tz('0000-01-01 01:00:00', '+00:00', '-02:00');
|
||||
insert into t values(convert_tz('9999-12-31 20:00:00', '+02:00', '+06:00'));
|
||||
insert into t values(convert_tz('0000-01-01 01:00:00', '+00:00', '-02:00'));
|
||||
select * from t;
|
||||
|
||||
|
||||
##bugfix: https://work.aone.alibaba-inc.com/issue/37089982
|
||||
SELECT CONVERT_TZ(123456,'-12:00','+10:00');
|
||||
SELECT CONVERT_TZ('','-12:00','+10:00');
|
||||
SELECT CONVERT_TZ('aa','-12:00','+10:00');
|
||||
SELECT CONVERT_TZ('张三','-12:00','+10:00');
|
||||
SELECT CONVERT_TZ('1asd561ad','-12:00','+10:00');
|
||||
SELECT CONVERT_TZ('¥¥%……&*¥','-12:00','+10:00');
|
||||
|
||||
|
||||
##bugfix: https://work.aone.alibaba-inc.com/issue/37090102
|
||||
drop table t;
|
||||
create table t(c1 year);
|
||||
insert into t values('1901'),('2155'), ('0000'), ('0001');
|
||||
SELECT c1, CONVERT_TZ(c1,'+00:00','+00:00') from t;
|
||||
|
||||
|
||||
##bugfix: https://work.aone.alibaba-inc.com/issue/37090351
|
||||
drop table t;
|
||||
create table t(a1 int,a2 year,c1 timestamp,c2 timestamp);
|
||||
insert into t values(1,'1998','1998-12-12 12:12:12','2038-01-19 03:14:07');
|
||||
insert into t values(2,'2002','2002-02-02 10:00:00','2034-02-22 00:50:20');
|
||||
insert into t values(3,'2006','2006-04-15 06:06:20','2038-01-19 03:14:07');
|
||||
insert into t values(4,'2012','2012-12-12 12:12:12','2030-08-16 14:05:50');
|
||||
select c1,c2 ,case c1 when convert_tz(c1,'+06:00','+00:00')<'2006-04-15 06:06:20' then convert_tz('2020-02-02 02:02:02','+00:00','+00:00') else convert_tz('1999-09-09 09:09:09','+00:00','+00:00') end as c1 from t;
|
||||
drop table t;
|
||||
|
||||
create table t(c1 timestamp(0), c2 timestamp(3), c3 decimal(20,4));
|
||||
insert into t values('2020-01-01 12:00:00.123456', '2020-01-01 12:00:00.123456', '20200101120000.123456');
|
||||
select c1, convert_tz(c1, '+00:00', '+08:00') from t;
|
||||
select c2, convert_tz(c2, '+00:00', '+08:00') from t;
|
||||
select c3, convert_tz(c3, '+00:00', '+08:00') from t;
|
||||
drop table t;
|
||||
|
||||
|
||||
##bugfix: https://work.aone.alibaba-inc.com/issue/38186028
|
||||
SELECT CONVERT_TZ('2007-03-11 2:00:00','US/Eastern','US/Central') AS time1,
|
||||
CONVERT_TZ('2007-03-11 2:00:01','US/Eastern','US/Central') AS time2,
|
||||
CONVERT_TZ('2007-03-11 3:00:00','US/Eastern','US/Central') AS time3,
|
||||
CONVERT_TZ('2007-03-11 3:00:01','US/Eastern','US/Central') AS time4;
|
||||
|
||||
SELECT CONVERT_TZ('2007-03-11 2:00:00','US/Eastern','+00:00') AS time1,
|
||||
CONVERT_TZ('2007-03-11 3:00:00','US/Eastern','+00:00') AS time2,
|
||||
CONVERT_TZ('2007-03-11 3:00:01','US/Eastern','+00:00') AS time3;
|
||||
|
||||
SELECT CONVERT_TZ('2007-11-04 01:00:00','US/Eastern','+00:00') AS time1,
|
||||
CONVERT_TZ('2007-11-04 01:00:01','US/Eastern','+00:00') AS time2,
|
||||
CONVERT_TZ('2007-11-04 02:00:00','US/Eastern','+00:00') AS time3,
|
||||
CONVERT_TZ('2007-11-04 02:00:01','US/Eastern','+00:00') AS time4;
|
||||
|
||||
create table t(c1 datetime);
|
||||
insert into t values('2007-03-11 2:00:00'), ('2007-03-11 2:00:01'), ('2007-03-11 3:00:00'), ('2007-03-11 3:00:01');
|
||||
insert into t values('2007-11-04 1:00:00'), ('2007-11-04 1:00:01'), ('2007-11-04 2:00:00'), ('2007-11-04 2:00:01');
|
||||
select convert_tz(c1, 'US/Eastern', '+00:00') from t;
|
||||
drop table t;
|
||||
|
||||
create table t(c1 timestamp);
|
||||
insert into t values('2007-03-11 1:59:59'), ('2007-03-11 3:00:00'), ('2007-03-11 3:00:01');
|
||||
insert into t values('2007-11-04 1:00:00'), ('2007-11-04 1:00:01'), ('2007-11-04 2:00:00'), ('2007-11-04 2:00:01');
|
||||
select convert_tz(c1, 'US/Eastern', '+00:00') from t;
|
||||
drop table t;
|
||||
162
tools/deploy/mysql_test/test_suite/expr/t/expr_export_set.test
Normal file
162
tools/deploy/mysql_test/test_suite/expr/t/expr_export_set.test
Normal file
@ -0,0 +1,162 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#/--disableabortonerror/
|
||||
#/test for export_set function in ob_expr_export_set.cpp/
|
||||
--enable_abort_on_error
|
||||
--echo ================ expression export_set ================
|
||||
|
||||
# 基本检查
|
||||
select export_set(0,"Y","N","-",5);
|
||||
select export_set(7,"Y","N","-",5);
|
||||
select export_set(11,"Y","N","-",5);
|
||||
select export_set(20,"Y","N","-",5);
|
||||
select export_set(9,"","","-",5);
|
||||
select export_set(9,"Y","N","-",5);
|
||||
select export_set(9,"左","右","-",5);
|
||||
select export_set(9,"上","下","-",5);
|
||||
select export_set(5,"Y","N",".",5);
|
||||
select export_set(5,"Y","N","=",5);
|
||||
select export_set(5,"Y","N","????????",5);
|
||||
select export_set(100,"Y","N",".",3);
|
||||
select export_set(100,"Y","N",".",5);
|
||||
select export_set(100,"Y","N",".",7);
|
||||
select export_set(100,"Y","N",".",10);
|
||||
|
||||
# 参数NULL检查
|
||||
select export_set(null,"Y","N",".",5);
|
||||
select export_set(0,"Y","N",".",5);
|
||||
select export_set(5,null,"N",".",5);
|
||||
select export_set(5,'',"N",".",5);
|
||||
select export_set(5,"Y",null,".",5);
|
||||
select export_set(5,"Y",'',".",5);
|
||||
select export_set(5,"Y","N",null,5);
|
||||
select export_set(5,"Y","N",'',5);
|
||||
select export_set(5,"Y","N",".",null);
|
||||
select export_set(5,"Y","N",".",0);
|
||||
select export_set(55555555555555,"YY","NN",".",0);
|
||||
select export_set(55555555555555,"YY","NN",".......",0);
|
||||
select export_set(100,'',1);
|
||||
select export_set(100,1,'');
|
||||
select export_set(100,1,0,'');
|
||||
select export_set(1000,'',1);
|
||||
select export_set(1000,1,'');
|
||||
select export_set(1000,1,0,'');
|
||||
|
||||
# 默认参数检查
|
||||
select export_set(8,"Y","N");
|
||||
select export_set(88,"Y","N");
|
||||
select export_set(888,"Y","N");
|
||||
select export_set(8888,"Y","N");
|
||||
select export_set(8,"1","0");
|
||||
select export_set(8,"X","Y");
|
||||
select export_set(8,"Y","N",'+');
|
||||
select export_set(8,"1","0",'*');
|
||||
select export_set(8,"X","Y",'*');
|
||||
|
||||
# 参数类型不同
|
||||
select export_set(7,1,0,"-",5);
|
||||
select export_set(7,11,00,"-",5);
|
||||
select export_set(7,111,000,"-",5);
|
||||
select export_set(7,111,000,5,5);
|
||||
select export_set(true,1,0);
|
||||
select export_set(true,"1","0");
|
||||
select export_set(false,1,0);
|
||||
select export_set(false,"1","0");
|
||||
select export_set(1.4,1,0);
|
||||
select export_set(2.4,1,0);
|
||||
select export_set(1.4,"y","n");
|
||||
select export_set(2.4,"y","n");
|
||||
|
||||
# 边界检查
|
||||
# 超过uint64的上界,int64的下界,ob对溢出的处理和mysql不同,这是mysql的bug,不兼容
|
||||
# 目前保证-9223372036854775808到18446744073709551615与mysql兼容
|
||||
# select export_set(1111111111111111111111111111111111111111111111111111,"Y","N");
|
||||
select export_set(9223372036854775808,"Y","N");
|
||||
select export_set(9223372036854775809,"Y","N");
|
||||
select export_set(-9223372036854775808,"Y","N");
|
||||
select export_set(18446744073709551615,"Y","N");
|
||||
select export_set(9223372036854775808,"Y","N",",",92233720368547758080000000000);
|
||||
select export_set(9223372036854775808,"Y","N",",",9223372036854775808);
|
||||
select export_set(9223372036854775809,"Y","N",",",9223372036854775809);
|
||||
select export_set(9223372036854775809,"Y","N",",",9223372036854775809000000000000);
|
||||
select export_set(-9223372036854775808,"Y","N",",",-9223372036854775808);
|
||||
select export_set(-9223372036854775808,"Y","N",",",-9223372036854775808000000000);
|
||||
select export_set(18446744073709551615,"Y","N",",",18446744073709551615);
|
||||
select export_set(18446744073709551615,"Y","N",",",1844674407370955161500000000000);
|
||||
|
||||
# 参数错误检查
|
||||
--error 1582
|
||||
select export_set();
|
||||
--error 1582
|
||||
select export_set(1);
|
||||
--error 1582
|
||||
select export_set(1,2);
|
||||
--error 1582
|
||||
select export_set("");
|
||||
--error 1582
|
||||
select export_set("","");
|
||||
--error 1582
|
||||
select export_set(5,5);
|
||||
--error 1054
|
||||
select export_set(a,2,3);
|
||||
--error 1054
|
||||
select export_set(1,2,3,a);
|
||||
--error 1054
|
||||
select export_set(1,2,3,4,a);
|
||||
|
||||
# 用表数据做参数
|
||||
--disable_warnings
|
||||
drop table if exists test;
|
||||
--enable_warnings
|
||||
create table test(c1 int, c2 varchar(20), c3 varchar(20), c4 varchar(20), c5 int);
|
||||
insert into test values(11,"Y","N",",",10);
|
||||
insert into test values(null,"Y","N",",",10);
|
||||
insert into test values(11,null,"N",",",10);
|
||||
insert into test values(11,"Y",null,",",10);
|
||||
insert into test values(11,"Y","N",null,10);
|
||||
insert into test values(11,"Y","N",",",null);
|
||||
insert into test values(null,null,null,null,null);
|
||||
select export_set(c1,c2,c3,c4,c5) from test;
|
||||
select export_set(c1,c2,c3,c4) from test;
|
||||
select export_set(c1,c2,c3) from test;
|
||||
insert into test values(100000,"+","-",",",1000000);
|
||||
insert into test values(55555555,"+","-",",",100000);
|
||||
insert into test values(7777777,"+","-",",",10000);
|
||||
select export_set(c1,c2,c3,c4,5) from test;
|
||||
select export_set(c1,c2,c3,'??',5) from test;
|
||||
select export_set(c1,c2,c3) from test;
|
||||
--error 1582
|
||||
select export_set(c1) from test;
|
||||
--error 1582
|
||||
select export_set(c1,c2) from test;
|
||||
--error 1582
|
||||
select export_set() from test;
|
||||
|
||||
drop table test;
|
||||
|
||||
# ctas cases
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1 as select export_set(0,"Y","N","-",5);
|
||||
desc t1;
|
||||
drop table t1;
|
||||
create table t1 as select export_set(99,"YYY","NX","---",77);
|
||||
desc t1;
|
||||
drop table t1;
|
||||
create table t1 as select export_set(99,"1","11","111",77);
|
||||
desc t1;
|
||||
drop table t1;
|
||||
|
||||
|
||||
## bugfix#https://work.aone.alibaba-inc.com/issue/36895309
|
||||
--disable_warnings
|
||||
drop table if exists T_36895309;
|
||||
--enable_warnings
|
||||
CREATE TABLE T_36895309(A_0 INT,A_1 INT,A_2 VARCHAR(20),A_3 FLOAT,A_4 DATE);
|
||||
INSERT INTO T_36895309 VALUES(1,1,'A',1.23,'1999-09-09'),(2,-1,'nb',3.21,'1111-11-11'),(3,0,'#',6666.6666,'11-11-11'),(4,NULL,NULL,NULL,NULL);
|
||||
SELECT EXPORT_SET(A_2,'Y','N',',',5) FROM T_36895309 ;
|
||||
SELECT EXPORT_SET(A_3,'Y','N',',',5) FROM T_36895309 ;
|
||||
SELECT EXPORT_SET(A_4,'Y','N',',',5) FROM T_36895309 ;
|
||||
drop table T_36895309;
|
||||
92
tools/deploy/mysql_test/test_suite/expr/t/expr_floor.test
Normal file
92
tools/deploy/mysql_test/test_suite/expr/t/expr_floor.test
Normal file
@ -0,0 +1,92 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#### owner: yuchen.wyc
|
||||
#### owner group: sql3
|
||||
#### description: 测试地板函数(向下取整函数,高斯函数)
|
||||
#/--disableabortonerror/
|
||||
#/test for floor function in ob_expr_func_floor.cpp/
|
||||
--enable_abort_on_error
|
||||
--echo ================ expression floor ================
|
||||
select floor(null);
|
||||
select floor(-123);
|
||||
select floor(-123.123);
|
||||
select floor(123);
|
||||
select floor(3.1415926);
|
||||
select floor(-3.1415926);
|
||||
select floor(0.00);
|
||||
select floor(-0.0);
|
||||
select floor(0.123456789);
|
||||
select floor(-0.123456789);
|
||||
select floor(123456789.123456789);
|
||||
select floor(-99999999.999999999);
|
||||
select floor(999999999.123456789);
|
||||
select floor(-999999999.123456789);
|
||||
select floor(-123456789123456789123456789.123456789);
|
||||
select floor(123456789123456789123456789123456789123456789123456789.123456789);
|
||||
select floor(-123456789123456789123456789123456789123456789123456789.123456789);
|
||||
select floor(123456789123456789123456789.123456789123456789123456789123456789);
|
||||
select floor(-123456789123456789123456789.123456789123456789123456789123456789);
|
||||
select floor(-123456789123456789123456789.123456789);
|
||||
select floor(999999999999999999999999999999999999999999999.499999999);
|
||||
select floor(999999999999999999999999999999999999999999999.500000001);
|
||||
select floor(99999999999999999999999999999999999999999999.399999999);
|
||||
select floor(-99999999999999999999999999999999999999999999.399999999);
|
||||
select floor(-99999999999999999999999999999999999999999999.399999999);
|
||||
select floor(999999999999999999999999999999999999999999999211111.399999999);
|
||||
select floor(-999999999999999999999999999999999999999999999211111.399999999);
|
||||
select floor(-999999999999999999999999999999999999999999999511111.399999999);
|
||||
select floor(-999999999999999999999999999999999999999999999499999.399999999);
|
||||
select floor(0.00000000000),ceil(0.00000);
|
||||
--disable_warnings
|
||||
drop table if exists tbl1;
|
||||
--enable_warnings
|
||||
create table tbl1 (i1 int, v2 varchar(80), i3 char(20),i4 float, d4 datetime(6),i5 decimal(5,3), primary key(i1));
|
||||
insert into tbl1 values(1,'now','haha1',1.6256,'2014-05-04 12:00:00',-10.235);
|
||||
insert into tbl1 values(2,'now','haha2',-1.6256,'2014-05-04 12:00:00',1.243);
|
||||
insert into tbl1 values(3,'now','haha3',1.156,'2014-05-04 12:00:00',-1.45);
|
||||
insert into tbl1 values(4,'now','haha1',5.9256,'2014-05-04 12:00:00',3.45);
|
||||
insert into tbl1 values(5,'now1','haha2',1.2356,'2014-05-04 12:00:00',-0.25);
|
||||
insert into tbl1 values(6,'now2','haha3',-10.4256,'2014-05-04 12:00:00',0.253);
|
||||
insert into tbl1 values(7,'now3','haha4',0.6256,'2014-05-04 12:00:00',1.677);
|
||||
select floor(i4),floor(i5) from tbl1;
|
||||
select max(floor(i4)),max(floor(i5)) from tbl1;
|
||||
select min(floor(i4)),min(floor(i5)) from tbl1;
|
||||
select max(ceil(i4)),max(ceil(i5)) from tbl1;
|
||||
select min(ceil(i4)),min(ceil(i5)) from tbl1;
|
||||
select avg(ceil(i4)),avg(ceil(i5)) from tbl1;
|
||||
select avg(ceil(i5)),avg(floor(i5)) from tbl1;
|
||||
select sum(ceil(i4)),sum(ceil(i5)) from tbl1;
|
||||
select count(ceil(i4)),count(ceil(i5)) from tbl1;
|
||||
select ceil(count(ceil(i4))),floor(count(ceil(i5))) from tbl1;
|
||||
select ceil(avg(ceil(i4))),floor(avg(ceil(i5))) from tbl1;
|
||||
select ceil(avg(ceil(i4))),ceil(avg(ceil(i5))) from tbl1;
|
||||
select * from tbl1 where floor(i4)=2;
|
||||
select * from tbl1 where floor(i4)=ceil(i4)-1;
|
||||
select * from tbl1 where floor(i1)=ceil(i1);
|
||||
select floor(i1/10*8),i1/10*8 from tbl1;
|
||||
select * from tbl1 order by floor(i4);
|
||||
select * from tbl1 order by floor(i4) desc;
|
||||
select floor(i4) abc from tbl1 order by abc desc;
|
||||
select floor(v2) from tbl1;
|
||||
select floor(i3) from tbl1;
|
||||
select floor(d4) from tbl1;
|
||||
--disable_warnings
|
||||
drop table if exists tbl2;
|
||||
--enable_warnings
|
||||
create table tbl2 (i1 int, v2 varchar(80), primary key(i1));
|
||||
insert into tbl2 values(1,'1');
|
||||
insert into tbl2 values(2,'2.5');
|
||||
insert into tbl2 values(3,'-3.2');
|
||||
select floor(v2),ceil(v2) from tbl2;
|
||||
--disable_warnings
|
||||
drop table if exists test;
|
||||
--enable_warnings
|
||||
create table test (pk int primary key, c1 tinyint, c2 smallint, c3 mediumint, c4 int, c5 bigint, c6 tinyint unsigned, c7 smallint unsigned, c8 mediumint unsigned, c9 int unsigned, c10 bigint unsigned, c11 float, c12 double, c13 float unsigned, c14 double unsigned, c15 decimal(20, 10), c16 decimal(20, 10) unsigned, c17 datetime(6), c18 timestamp(6) default "2012-01-01 12:00:00", c19 date, c20 time, c21 year , c22 varchar(10000), c23 char(255), c24 varbinary(10000), c25 binary(255));
|
||||
insert into test values (0, -128, 2, -3, 4, -5, 6, 7, 8, 9, 10, -11.49, -12.5, 13.5, 14.49, 15.99, 16.1, '2017-01-01 00:01:10.123456', '2018-02-02 00:02:20.123456', '2019-03-03', '20:04:40.123456', '2021', '22.5324', '-23.436456', '-24', '25');
|
||||
insert into test values (1, 1, -2, 3, -4, 5, 6, 7, 8, 9, 10, -11.49, -12.5, 13.5, 14.49, 15.99, 16.1, '2017-01-01 00:01:10.123456', '2018-02-02 00:02:20.123456', '2019-03-03', '20:04:40.123456', '2021', '-22.999999', '23.00001', '24.9999', '-25.00001');
|
||||
insert into test values (2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
select floor(pk), floor(c1), floor(c2), floor(c3), floor(c4), floor(c5), floor(c6), floor(c7), floor(c8), floor(c9), floor(c10), floor(c11), floor(c12), floor(c13), floor(c14), floor(c15), floor(c16), floor(c22), floor(c23), floor(c24), floor(c25) from test;
|
||||
--disable_warnings
|
||||
drop table if exists test;
|
||||
--enable_warnings
|
||||
74
tools/deploy/mysql_test/test_suite/expr/t/expr_instr.test
Normal file
74
tools/deploy/mysql_test/test_suite/expr/t/expr_instr.test
Normal file
@ -0,0 +1,74 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#### owner: yuchen.wyc
|
||||
#### owner group: sql3
|
||||
#### description: 测试instr函数
|
||||
--echo ================ expression instr ================
|
||||
select instr('abc', '');
|
||||
select instr('', '');
|
||||
select instr('', 'abc');
|
||||
select instr('abc', 'abcd');
|
||||
select instr('abc', 'abc');
|
||||
select instr('abc', 'a');
|
||||
select instr('abc', 'b');
|
||||
select instr('abc', 'c');
|
||||
select instr('abc', 'bc');
|
||||
select instr('abcbc', 'bc');
|
||||
select instr('阿里巴巴', '阿里');
|
||||
select instr('阿里巴巴', '巴巴');
|
||||
select instr('阿里巴巴巴巴', '巴巴');
|
||||
select instr('阿里巴巴', '阿里巴巴');
|
||||
select instr('123', true);
|
||||
select instr('23', true);
|
||||
select instr(123, '23');
|
||||
select instr('123', 123);
|
||||
select instr('123.400000', 23.4);
|
||||
select instr('123.400000', 123.4);
|
||||
select instr('123.400000', null);
|
||||
select instr(null, '巴巴');
|
||||
select instr('巴巴', null);
|
||||
select instr(null, null);
|
||||
|
||||
select instr(true, false);
|
||||
select instr(true, true);
|
||||
select instr(123, true);
|
||||
select instr(123, false);
|
||||
select instr(0123, false);
|
||||
select instr(1023, false);
|
||||
select instr(1023.4, false);
|
||||
select instr(1023.4, true);
|
||||
select instr(null, true);
|
||||
select instr(true, null);
|
||||
|
||||
select instr(123, 23);
|
||||
select instr(123, 23456);
|
||||
select instr(123.4, 123);
|
||||
select instr(1234, 123.4);
|
||||
select instr(1234, null);
|
||||
select instr(null, 123);
|
||||
|
||||
select instr(123.400000, 123.4);
|
||||
select instr(123.400000, 123.41);
|
||||
select instr(123.400000, null);
|
||||
select instr(null, 123.41);
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists test;
|
||||
--enable_warnings
|
||||
create table test(c1 datetime primary key);
|
||||
sleep 5;
|
||||
insert into test values('2015-5-5');
|
||||
select instr(c1, '201') from test;
|
||||
select instr(c1, '') from test;
|
||||
select instr(c1, 'haha') from test;
|
||||
select instr(c1, '-5') from test;
|
||||
select instr(c1, '2015-5-5') from test;
|
||||
select instr(c1, true) from test;
|
||||
select instr(c1, 201) from test;
|
||||
select instr(c1, 201.1) from test;
|
||||
select instr(c1, null) from test;
|
||||
select instr(null, c1) from test;
|
||||
--disable_warnings
|
||||
drop table if exists test;
|
||||
--enable_warnings
|
||||
198
tools/deploy/mysql_test/test_suite/expr/t/expr_locate.test
Normal file
198
tools/deploy/mysql_test/test_suite/expr/t/expr_locate.test
Normal file
@ -0,0 +1,198 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#### owner: yuchen.wyc
|
||||
#### owner group: sql3
|
||||
#### description: 测试locate函数
|
||||
# tags: expr, datatype
|
||||
|
||||
--echo ================ expression locate ================
|
||||
|
||||
select locate('', 'abc');
|
||||
select locate('', '');
|
||||
select locate('abcd', 'abc');
|
||||
select locate('abc', 'abc');
|
||||
select locate('a', 'abc');
|
||||
select locate('b', 'abc');
|
||||
select locate('c', 'abc');
|
||||
select locate('bc', 'abc');
|
||||
select locate('bc', 'abcbc');
|
||||
select locate('阿里', '阿里巴巴');
|
||||
select locate('巴巴', '阿里巴巴巴巴');
|
||||
select locate('阿里巴巴', '阿里巴巴');
|
||||
select locate(true, '123');
|
||||
select locate(true, '23');
|
||||
select locate(23, 123);
|
||||
select locate('', 23);
|
||||
select locate('23', 123);
|
||||
select locate(123.4, '123.400000');
|
||||
select locate('123.400000', 123.4);
|
||||
select locate('123.400000', null);
|
||||
select locate(null, '巴巴');
|
||||
select locate('巴巴', null);
|
||||
select locate(null, null);
|
||||
|
||||
|
||||
select locate(false, true);
|
||||
select locate(true, true);
|
||||
select locate(true, 123);
|
||||
select locate(false, 123);
|
||||
select locate(false, 0123);
|
||||
select locate(false, 1023);
|
||||
select locate(false,1023.4);
|
||||
select locate(true, 1023.4);
|
||||
select locate(true, null);
|
||||
select locate(null, true);
|
||||
|
||||
select locate(23, 123);
|
||||
select locate(123456, 123);
|
||||
select locate(123, 123.4);
|
||||
select locate(123.4, 1234);
|
||||
select locate(123, null);
|
||||
select locate(null, 123);
|
||||
|
||||
select locate(123.4, 123.400000);
|
||||
select locate(123.41, 123.400000);
|
||||
select locate(123.400000, null);
|
||||
select locate(null, 123.41);
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists test;
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1(c1 bigint unsigned);
|
||||
insert into t1 values(locate('a','b',9223372036854775807));
|
||||
insert into t1 values(locate('a','b',9223372036854775808));
|
||||
insert into t1 values(locate('a','b',12233720368547758000));
|
||||
select * from t1;
|
||||
create table test(c1 datetime primary key);
|
||||
sleep 5;
|
||||
insert into test values('2015-5-5');
|
||||
select locate('201', c1) from test;
|
||||
select locate('', c1) from test;
|
||||
select locate('haha', c1) from test;
|
||||
select locate('-5',c1) from test;
|
||||
select locate('2015-5-5', c1) from test;
|
||||
select locate(true, c1) from test;
|
||||
select locate(201, c1) from test;
|
||||
select locate(201.1, c1) from test;
|
||||
select locate(c1, null) from test;
|
||||
select locate(null, c1) from test;
|
||||
--disable_warnings
|
||||
drop table if exists test,t1;
|
||||
--enable_warnings
|
||||
|
||||
select locate('', 'abc', 0);
|
||||
select locate('', 'abc', 1);
|
||||
select locate('', 'abc', -1);
|
||||
select locate('', '', 0);
|
||||
select locate('', '', 1);
|
||||
select locate('', '', -1);
|
||||
select locate('abc', '', 0);
|
||||
select locate('abc', '', -1);
|
||||
select locate('abc', '', 1);
|
||||
select locate('abcd', 'abc', 1);
|
||||
select locate('abc', 'abc', 1);
|
||||
select locate('abc', 'abc', 2);
|
||||
select locate('a', 'abc', 1);
|
||||
select locate('a', 'abc', 2);
|
||||
select locate('a', 'abac', 1);
|
||||
select locate('a', 'abac', 2);
|
||||
select locate('b', 'abc', 1);
|
||||
select locate('b', 'abc', 2);
|
||||
select locate('b', 'abc', 3);
|
||||
select locate('c', 'abc', 1);
|
||||
select locate('c', 'abc', 3);
|
||||
select locate('c', 'abc', 4);
|
||||
select locate('bc', 'abc', 1);
|
||||
select locate('bc', 'abc', 3);
|
||||
select locate('', 'abc', 3);
|
||||
select locate('', 'abc', 4);
|
||||
select locate('', 'abc', 5);
|
||||
select locate('阿里', '阿里巴巴', 1);
|
||||
select locate('阿里', '阿里巴巴', 2);
|
||||
select locate('巴巴', '阿里巴巴', 1);
|
||||
select locate('巴巴', '阿里巴巴', 3);
|
||||
select locate('巴巴', '阿里巴巴', 4);
|
||||
select locate('巴巴', '阿里巴巴', 5);
|
||||
select locate('', '阿里阿里', 3);
|
||||
select locate('', '阿里阿里', 4);
|
||||
select locate('', '阿里阿里', 5);
|
||||
select locate('阿里巴巴', '阿里巴巴', 0);
|
||||
select locate('阿里巴巴', '阿里巴巴', 1);
|
||||
select locate(23, 123, 1);
|
||||
select locate('', 23, 1);
|
||||
select locate('23', 123, 1);
|
||||
select locate(true, '123', 1);
|
||||
select locate(true, '123', 2);
|
||||
select locate(true, '123', 2);
|
||||
select locate(true, '123', 2);
|
||||
select locate(true, '1', 1);
|
||||
select locate('1', true, 1);
|
||||
select locate(1.3, '1.300000', 2);
|
||||
select locate(1.3, '2321.300000', 2);
|
||||
select locate(1.3, '2321.3', 2);
|
||||
select locate('1.3000', 451.3, 2);
|
||||
select locate(null, '巴巴', 3);
|
||||
select locate(null, '巴巴', 2);
|
||||
select locate('巴巴', null, 3);
|
||||
select locate('巴巴', null, 2);
|
||||
select locate('巴巴', '阿里巴巴', null);
|
||||
select locate(null, null, 0);
|
||||
select locate(null, null, 1);
|
||||
|
||||
select locate(false, true, 1);
|
||||
select locate(false, true, 2);
|
||||
select locate(true, true, 1);
|
||||
select locate(true, 123, 1);
|
||||
select locate(true, 123, 2);
|
||||
select locate(false, 1023.4, 2);
|
||||
select locate(false, 1023.4, 3);
|
||||
select locate(true, null, 0);
|
||||
select locate(true, null, 1);
|
||||
select locate(null, true, 0);
|
||||
select locate(null, true, 3);
|
||||
select locate(true, true, null);
|
||||
|
||||
select locate(23, 123, 1);
|
||||
select locate(23, 123, 3);
|
||||
select locate(123456, 123, 9);
|
||||
select locate(123, 123.4, 1);
|
||||
select locate(123, 123.4, 2);
|
||||
select locate(123.4, 1234, 4);
|
||||
select locate(123, null, 1);
|
||||
select locate(123, null, null);
|
||||
select locate(null, 123, 1);
|
||||
select locate(null, 123, null);
|
||||
|
||||
select locate(123.4, 123.400000, 1);
|
||||
select locate(123.4, 123.400000, 2);
|
||||
select locate(123.41, 123.400000, 3);
|
||||
select locate(123.400000, null, 3);
|
||||
select locate(null, 123.41, 3);
|
||||
select locate(null, 123.41, null);
|
||||
select locate(null, 123.41, 126);
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists test;
|
||||
--enable_warnings
|
||||
create table test(c1 datetime primary key);
|
||||
sleep 5;
|
||||
insert into test values('2015-5-5');
|
||||
select locate('201', c1, 1) from test;
|
||||
select locate('', c1 , 1) from test;
|
||||
select locate('haha', c1 , 1) from test;
|
||||
select locate('-5',c1 , 1) from test;
|
||||
select locate('2015-5-5', c1 , 1) from test;
|
||||
select locate(true, c1 , 1) from test;
|
||||
select locate(true, c1 , 4) from test;
|
||||
select locate(201, c1 , 1) from test;
|
||||
select locate(201.1, c1 , 1) from test;
|
||||
select locate(null, c1 , 1) from test;
|
||||
select locate(c1, null, 1) from test;
|
||||
select locate(c1, null, null) from test;
|
||||
select mod(locate('a','b'),1.000);
|
||||
select ifnull(locate('a','a'),2.345 );
|
||||
--disable_warnings
|
||||
drop table if exists test;
|
||||
--enable_warnings
|
||||
45
tools/deploy/mysql_test/test_suite/expr/t/expr_nseq.test
Normal file
45
tools/deploy/mysql_test/test_suite/expr/t/expr_nseq.test
Normal file
@ -0,0 +1,45 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#### owner: yuchen.wyc
|
||||
#### owner group: sql3
|
||||
#### description: 测试<=>运算符
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
create table t1(a int, b int, c int, d int, primary key(a));
|
||||
insert into t1 values(1,2,3,4);
|
||||
insert into t1 values(2,null,3,4);
|
||||
insert into t1 values(3,null,null,4);
|
||||
insert into t1 values(4,2,null,null);
|
||||
create table t2(a int, b int, c int, d int, primary key(a,b));
|
||||
insert into t2 values(1,2,3,4);
|
||||
insert into t2 values(2,2,3,4);
|
||||
insert into t2 values(3,3,null,4);
|
||||
insert into t2 values(4,2,null,null);
|
||||
|
||||
|
||||
select 1<=>1;
|
||||
select 1<=>null;
|
||||
select null<=>1;
|
||||
select null<=>null;
|
||||
select 1.0<=>1.0;
|
||||
select 1.0<=>null;
|
||||
select null<=>1.0;
|
||||
select 'abc'<=>null;
|
||||
select 'abc'<=>'abc';
|
||||
select 'null'<=>null;
|
||||
select (1,2,3)<=>(1,2,3);
|
||||
select (1,null, 3) <=> (1,null,3);
|
||||
select (1,null,'abc')<=>(1,null,'abc');
|
||||
select * from t1 where b<=>null;
|
||||
select * from t1 where a<=>2;
|
||||
select * from t1 where a<=>2 and b<=>null;
|
||||
select * from t1 where b<=>null and c<=>null;
|
||||
select * from t1 where b=null and c=null;
|
||||
select * from t1 where b<=>null and c=null;
|
||||
select * from t1 join t2 on t1.a=t2.a;
|
||||
select * from t1 join t2 on t1.a=t2.a where t1.b<=>null and t2.b<=>null;
|
||||
|
||||
|
||||
select * from t1 join t2 on t1.a<=>t2.a;
|
||||
65
tools/deploy/mysql_test/test_suite/expr/t/expr_position.test
Normal file
65
tools/deploy/mysql_test/test_suite/expr/t/expr_position.test
Normal file
@ -0,0 +1,65 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#### owner: yuchen.wyc
|
||||
#### owner group: sql3
|
||||
#### description: 测试position函数
|
||||
--echo ================ expression position ================
|
||||
select position(' ' in 'abc');
|
||||
select position('abcd' in 'abc');
|
||||
select position('abc' in 'abc');
|
||||
select position('a' in 'abc');
|
||||
select position('b' in 'abc');
|
||||
select position('c' in 'abc');
|
||||
select position('bc' in 'abc');
|
||||
select position('bc' in 'abcbc');
|
||||
select position('BC' in 'abcbc');
|
||||
select position('bC' in 'abcbc');
|
||||
select position('阿里' in '阿里巴巴');
|
||||
select position('巴巴' in '阿里巴巴巴巴');
|
||||
select position('阿里巴巴' in '阿里巴巴');
|
||||
select position(true in '123');
|
||||
select position(true in '23');
|
||||
select position(23 in 123);
|
||||
select position('' in 23);
|
||||
select position('23' in 123);
|
||||
select position(123.4 in '123.400000');
|
||||
select position('123.400000' in 123.4);
|
||||
select position('123.400000' in null);
|
||||
select position(null in '巴巴');
|
||||
select position('巴巴' in null);
|
||||
select position(null in null);
|
||||
|
||||
|
||||
select position(false in true);
|
||||
select position(true in true);
|
||||
select position(true in 123);
|
||||
select position(false in 123);
|
||||
select position(false in 0123);
|
||||
select position(false in 1023);
|
||||
select position(23 in 123);
|
||||
select position(123456 in 123);
|
||||
select position(123 in 123.4);
|
||||
select position(123.4 in 1234);
|
||||
select position(123 in null);
|
||||
select position(null in 123);
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists test;
|
||||
--enable_warnings
|
||||
create table test(c1 datetime primary key);
|
||||
sleep 5;
|
||||
insert into test values('2015-5-5');
|
||||
select position('201' in c1) from test;
|
||||
select position('' in c1) from test;
|
||||
select position('haha' in c1) from test;
|
||||
select position('-5' in c1) from test;
|
||||
select position('2015-5-5' in c1) from test;
|
||||
select position(true in c1) from test;
|
||||
select position(201 in c1) from test;
|
||||
select position(201.1 in c1) from test;
|
||||
select position(c1 in null) from test;
|
||||
select position(null in c1) from test;
|
||||
--disable_warnings
|
||||
drop table if exists test;
|
||||
--enable_warnings
|
||||
59
tools/deploy/mysql_test/test_suite/expr/t/func_equal.test
Normal file
59
tools/deploy/mysql_test/test_suite/expr/t/func_equal.test
Normal file
@ -0,0 +1,59 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#### owner: yuchen.wyc
|
||||
#### owner group: sql3
|
||||
#### description: 测试相等比较运算符
|
||||
# Initialise
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
#
|
||||
##
|
||||
## Testing of the <=> operator
|
||||
##
|
||||
#
|
||||
##
|
||||
## First some simple tests
|
||||
##
|
||||
#
|
||||
select 0<=>0,0.0<=>0.0,0E0=0E0,'A'<=>'A',NULL<=>NULL;
|
||||
select 1<=>0,0<=>NULL,NULL<=>0;
|
||||
select 1.0<=>0.0,0.0<=>NULL,NULL<=>0.0;
|
||||
select 'A'<=>'B','A'<=>NULL,NULL<=>'A';
|
||||
select 0<=>0.0, 0.0<=>0E0, 0E0<=>'0', 10.0<=>1E1, 10<=>10.0, 10<=>1E1;
|
||||
select 1.0<=>0E1,10<=>NULL,NULL<=>0.0, NULL<=>0E0;
|
||||
#
|
||||
##
|
||||
## Test with tables
|
||||
##
|
||||
#
|
||||
create table t1 (id int primary key, value int);
|
||||
create table t2 (id int primary key, value int);
|
||||
#
|
||||
insert into t1 values (1,null);
|
||||
insert into t2 values (1,null);
|
||||
#
|
||||
select t1.*, t2.*, t1.value=t2.value from t1, t2 where t1.id=t2.id and t1.id=1;
|
||||
select * from t1 where id =id;
|
||||
select * from t1 where value = value;
|
||||
select * from t1 where id = value or value=id;
|
||||
select * from t1 where value = null;
|
||||
select * from t1 where (value) = (null);
|
||||
--error 1064
|
||||
select * from t1 where ROW(value) = ROW(null);
|
||||
select * from t1 where (id, value) = (1, null);
|
||||
drop table t1,t2;
|
||||
#
|
||||
##
|
||||
## Bug #12612: quoted bigint unsigned value and the use of 'in' in where clause
|
||||
##
|
||||
create table t1 (a bigint primary key);
|
||||
insert into t1 values (4828532208463511553);
|
||||
select * from t1 where a = '4828532208463511553';
|
||||
select * from t1 where a = 4828532208463511553;
|
||||
select * from t1 where a in ('4828532208463511553');
|
||||
select * from t1 where a in (4828532208463511553,1);
|
||||
drop table t1;
|
||||
#
|
||||
## End of 4.1 tests
|
||||
72
tools/deploy/mysql_test/test_suite/expr/t/func_length.test
Normal file
72
tools/deploy/mysql_test/test_suite/expr/t/func_length.test
Normal file
@ -0,0 +1,72 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: guoping.wgp
|
||||
#owner group: sql1
|
||||
|
||||
--disable_abort_on_error
|
||||
--disable_warnings
|
||||
|
||||
select length('ab');
|
||||
select length('ab ');
|
||||
select length('ab\t');
|
||||
select length('ab\0');
|
||||
#特殊处理
|
||||
select length('\_');
|
||||
select length('\%');
|
||||
#转义字符
|
||||
select length('\\');
|
||||
select length('\z');
|
||||
select length('\n\t\r\b\0\_\%\\');
|
||||
#直接忽略'\'
|
||||
select length('\a');
|
||||
select length('\m');
|
||||
#数字转换
|
||||
select length(12.466);
|
||||
select length(4334);
|
||||
select length(0.00);
|
||||
#根据collation判断
|
||||
select length('好');
|
||||
|
||||
#作为列名
|
||||
select length(13bd);
|
||||
select length(db24);
|
||||
|
||||
###带小数点且以0结尾
|
||||
select length(00.000);
|
||||
select length(00.000);
|
||||
select length(1.00000);
|
||||
select length(10000.10);
|
||||
|
||||
|
||||
create database if not exists db1;
|
||||
use db1;
|
||||
--disable_warnings
|
||||
drop table if exists utf,tx,gbk;
|
||||
--enable_warnings
|
||||
|
||||
create table utf(c1 int primary key, c2 char(10)) collate 'utf8mb4_bin';
|
||||
insert into utf values(1, '好');
|
||||
select length(c2) from utf;
|
||||
|
||||
create table tx(s int(255) zerofill);
|
||||
insert into tx values (2);
|
||||
select * from tx;
|
||||
select * from tx;
|
||||
select * from tx;
|
||||
select length(s) from tx;
|
||||
|
||||
drop table tx;
|
||||
create table tx(s int(121) zerofill);
|
||||
insert into tx values (1234);
|
||||
select * from tx;
|
||||
select * from tx;
|
||||
select * from tx;
|
||||
select length(s) from tx;
|
||||
|
||||
drop table tx;
|
||||
|
||||
#create table gbk(c1 int primary key, c2 char(10)) collate 'gbk_bin';
|
||||
#insert into gbk values (1, '好');
|
||||
#select length(c2) from gbk;
|
||||
drop database db1;
|
||||
444
tools/deploy/mysql_test/test_suite/expr/t/func_regexp.test
Normal file
444
tools/deploy/mysql_test/test_suite/expr/t/func_regexp.test
Normal file
@ -0,0 +1,444 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: guoyun.lgy
|
||||
# modifier: jiangxiu.wt
|
||||
# owner group: SQL1
|
||||
# description: regexp的测试
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
##
|
||||
#--real_sleep 10
|
||||
create table t1 (a varchar(10) primary key, b int default 0);
|
||||
#--real_sleep 10
|
||||
insert into t1 (a) values ('a'),('abc'),('abcd'),('hello'),('test');
|
||||
|
||||
--error 5813
|
||||
select * from t1 where a regexp 'a(';
|
||||
--error 5813
|
||||
select * from t1 where a regexp 'a(b';
|
||||
--error 5820
|
||||
select * from t1 where a regexp '*';
|
||||
--error 5820
|
||||
select * from t1 where a regexp '+';
|
||||
--error 5820
|
||||
select * from t1 where a regexp '?';
|
||||
--error 5820
|
||||
select * from t1 where a regexp '(*a)';
|
||||
--error 5820
|
||||
select * from t1 where a regexp '(+a)';
|
||||
--error 5824
|
||||
select * from t1 where a regexp '(?a)';
|
||||
--error 5820
|
||||
select * from t1 where a regexp '({1}a)';
|
||||
--error 5820
|
||||
select * from t1 where a regexp '(a|*b)';
|
||||
--error 5820
|
||||
select * from t1 where a regexp '(a|+b)';
|
||||
--error 5820
|
||||
select * from t1 where a regexp '(a|?b)';
|
||||
--error 5820
|
||||
select * from t1 where a regexp '(a|{1}b)';
|
||||
--error 5820
|
||||
select * from t1 where a regexp '^*';
|
||||
--error 5820
|
||||
select * from t1 where a regexp '^+';
|
||||
--error 5820
|
||||
select * from t1 where a regexp '^?';
|
||||
--error 5820
|
||||
select * from t1 where a regexp '^{1}';
|
||||
--error 5820
|
||||
select * from t1 where a regexp '{1';
|
||||
--error 5820
|
||||
select * from t1 where a regexp '{1}';
|
||||
--error 5818
|
||||
select * from t1 where a regexp 'a{1';
|
||||
--error 5819
|
||||
select * from t1 where a regexp 'a{1a';
|
||||
--error 5819
|
||||
select * from t1 where a regexp 'a{1a}';
|
||||
--error 5819
|
||||
select * from t1 where a regexp 'a{1,x}';
|
||||
--error 5819
|
||||
select * from t1 where a regexp 'a{1,x';
|
||||
--error 5819
|
||||
select * from t1 where a regexp 'a{300}';
|
||||
--error 5819
|
||||
select * from t1 where a regexp 'a{1,0}';
|
||||
--error 5820
|
||||
select * from t1 where a regexp 'a++';
|
||||
--error 5820
|
||||
select * from t1 where a regexp 'a*+';
|
||||
--error 5820
|
||||
select * from t1 where a regexp 'a+*';
|
||||
--error 5820
|
||||
select * from t1 where a regexp 'a?*';
|
||||
--error 5820
|
||||
select * from t1 where a regexp 'a?+';
|
||||
--error 5820
|
||||
select * from t1 where a regexp 'a{1}{1}';
|
||||
--error 5820
|
||||
select * from t1 where a regexp 'a*{1}';
|
||||
--error 5820
|
||||
select * from t1 where a regexp 'a+{1}';
|
||||
--error 5820
|
||||
select * from t1 where a regexp 'a?{1}';
|
||||
--error 5820
|
||||
select * from t1 where a regexp 'a{1}*';
|
||||
--error 5820
|
||||
select * from t1 where a regexp 'a{1}+';
|
||||
|
||||
drop table t1;
|
||||
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
#--real_sleep 10
|
||||
create table t1 (a datetime primary key);
|
||||
#--real_sleep 10
|
||||
insert into t1 values ('2004-03-11 12:00:21');
|
||||
select * from t1 where a regexp '2004-03-11 12:00:21';
|
||||
select * from t1 where a regexp '2004-03-11 ';
|
||||
drop table t1;
|
||||
|
||||
# A case
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1(id int primary key, name varchar(100));
|
||||
insert into t1 values(1, 'hello');
|
||||
insert into t1 values(2, 'hell');
|
||||
insert into t1 values(3, 'hel');
|
||||
insert into t1 values(4, 'hello1');
|
||||
insert into t1 values(5, 'hell1');
|
||||
insert into t1 values(6, 'hel1');
|
||||
insert into t1 values(7, 'hel\n1');
|
||||
insert into t1 values(8, 'he\bl1');
|
||||
insert into t1 values(9, 'hel\t1');
|
||||
insert into t1 values(10, 'hel\r\n1o');
|
||||
insert into t1 values(11, '111 <title>Hello World</title> 222');
|
||||
|
||||
insert into t1 values (138, 'abc');
|
||||
insert into t1 values (139, 'abc');
|
||||
insert into t1 values (142, 'abc');
|
||||
insert into t1 values (146, 'a(');
|
||||
insert into t1 values (152, 'a)');
|
||||
insert into t1 values (153, ')');
|
||||
insert into t1 values (158, 'ab');
|
||||
insert into t1 values (163, 'a^b');
|
||||
insert into t1 values (165, 'a$b');
|
||||
insert into t1 values (170, '""');
|
||||
insert into t1 values (173, '""');
|
||||
insert into t1 values (174, '""');
|
||||
insert into t1 values (192, 'b');
|
||||
insert into t1 values (203, 'abc');
|
||||
insert into t1 values (272, 'abc');
|
||||
insert into t1 values (273, 'abc');
|
||||
insert into t1 values (287, 'ab');
|
||||
insert into t1 values (289, 'ab');
|
||||
insert into t1 values (291, 'aab');
|
||||
insert into t1 values (299, 'a{,2}');
|
||||
insert into t1 values (301, 'a{,}');
|
||||
insert into t1 values (311, 'abcac');
|
||||
insert into t1 values (313, 'abcac');
|
||||
insert into t1 values (315, 'abbcac');
|
||||
insert into t1 values (317, 'acabc');
|
||||
insert into t1 values (319, 'acabc');
|
||||
insert into t1 values (321, 'abcabbc');
|
||||
insert into t1 values (323, 'abcabbc');
|
||||
insert into t1 values (325, 'a');
|
||||
insert into t1 values (344, 'a{b}');
|
||||
insert into t1 values (384, '-%@a?X-');
|
||||
insert into t1 values (385, '-%@aX0-');
|
||||
insert into t1 values (386, 'aSSTb');
|
||||
insert into t1 values (387, 'aNTb');
|
||||
insert into t1 values (388, 'a019b');
|
||||
insert into t1 values (389, 'Sa%bS');
|
||||
insert into t1 values (390, 'AabC');
|
||||
insert into t1 values (391, 'NaSbN');
|
||||
insert into t1 values (392, 'S%-&T');
|
||||
insert into t1 values (393, 'aSNTb');
|
||||
insert into t1 values (394, 'aBCd');
|
||||
insert into t1 values (395, 'p0f3Cq');
|
||||
insert into t1 values (405, 'abc');
|
||||
insert into t1 values (406, 'abd');
|
||||
insert into t1 values (407, 'abbd');
|
||||
insert into t1 values (409, 'aaaaabaaaabaaaabaaaab');
|
||||
insert into t1 values (411, 'aaaaabaaaabaaaabaaaab');
|
||||
insert into t1 values (413, 'aaaaabaaaabaaaabaaaabweeknights');
|
||||
insert into t1 values (415, 'a12345678901234567890123456789b');
|
||||
insert into t1 values (416, 'a123456789012345678901234567890b');
|
||||
insert into t1 values (417, 'a1234567890123456789012345678901b');
|
||||
insert into t1 values (418, 'a12345678901234567890123456789012b');
|
||||
insert into t1 values (419, 'a123456789012345678901234567890123b');
|
||||
insert into t1 values (421, 'a1234567890123456789012345678901234567890123456789012345678901234567890b');
|
||||
insert into t1 values (423, 'xacegikmoq');
|
||||
insert into t1 values (424, 'xacegikmoq');
|
||||
insert into t1 values (425, 'xacegikmoqy');
|
||||
insert into t1 values (426, 'xacegikmoqy');
|
||||
insert into t1 values (438, 'abc');
|
||||
insert into t1 values (439, 'aba');
|
||||
insert into t1 values (440, 'abc');
|
||||
insert into t1 values (441, 'abd');
|
||||
insert into t1 values (442, 'accd');
|
||||
insert into t1 values (443, 'weeknights');
|
||||
insert into t1 values (444, 'weeknights');
|
||||
insert into t1 values (445, 'xyzaaabcaababdacd');
|
||||
insert into t1 values (446, 'aaabc');
|
||||
insert into t1 values (452, '/*x*/');
|
||||
insert into t1 values (454, '/*x*/y/*z*/');
|
||||
insert into t1 values (456, '/*x*/');
|
||||
insert into t1 values (457, '/*x*/y/*z*/');
|
||||
insert into t1 values (459, '/*x**/y/*z*/');
|
||||
insert into t1 values (461, '/*x*/');
|
||||
insert into t1 values (462, '/*x*/y/*z*/');
|
||||
insert into t1 values (463, '/*x**/y/*z*/');
|
||||
insert into t1 values (464, '/*x****/y/*z*/');
|
||||
insert into t1 values (465, '/*x**x*/y/*z*/');
|
||||
insert into t1 values (466, '/*x***x/y/*z*/');
|
||||
insert into t1 values (469, 'abcd');
|
||||
insert into t1 values (470, 'abc');
|
||||
insert into t1 values (471, 'abd');
|
||||
insert into t1 values (472, 'abbd');
|
||||
insert into t1 values (473, 'acd');
|
||||
insert into t1 values (474, 'ad');
|
||||
insert into t1 values (475, 'abc');
|
||||
insert into t1 values (476, 'ac');
|
||||
insert into t1 values (477, 'abc');
|
||||
insert into t1 values (478, 'abbbc');
|
||||
insert into t1 values (479, 'ac');
|
||||
insert into t1 values (480, 'abcdef');
|
||||
insert into t1 values (482, 'abcdefghijk');
|
||||
insert into t1 values (483, 'abcdefghijkl');
|
||||
insert into t1 values (484, 'abc');
|
||||
insert into t1 values (485, 'ac');
|
||||
insert into t1 values (486, 'abc');
|
||||
insert into t1 values (487, 'abcc');
|
||||
insert into t1 values (488, 'abcbc');
|
||||
insert into t1 values (489, 'abb');
|
||||
insert into t1 values (490, 'abb');
|
||||
insert into t1 values (491, 'abbb');
|
||||
insert into t1 values (492, 'abbb');
|
||||
insert into t1 values (493, 'abcdef');
|
||||
insert into t1 values (494, 'bc');
|
||||
insert into t1 values (497, 'ad');
|
||||
insert into t1 values (498, 'abcd');
|
||||
insert into t1 values (499, 'abd');
|
||||
insert into t1 values (500, 'abcd');
|
||||
insert into t1 values (501, 'ad');
|
||||
insert into t1 values (502, 'abcd');
|
||||
insert into t1 values (503, 'ad');
|
||||
insert into t1 values (504, 'ad');
|
||||
insert into t1 values (505, 'abd');
|
||||
insert into t1 values (506, 'ad');
|
||||
insert into t1 values (507, 'abcd');
|
||||
insert into t1 values (508, 'ad');
|
||||
insert into t1 values (509, 'abcd');
|
||||
insert into t1 values (510, 'abd');
|
||||
insert into t1 values (511, 'acd');
|
||||
insert into t1 values (512, 'abd');
|
||||
insert into t1 values (513, 'abcd');
|
||||
insert into t1 values (514, 'abd');
|
||||
insert into t1 values (515, 'abcd');
|
||||
insert into t1 values (516, 'acbd');
|
||||
insert into t1 values (517, 'abcd');
|
||||
insert into t1 values (518, 'abcd');
|
||||
insert into t1 values (519, 'abcbd');
|
||||
insert into t1 values (520, 'abcbcd');
|
||||
insert into t1 values (521, 'abcd');
|
||||
insert into t1 values (522, 'abcbd');
|
||||
insert into t1 values (523, 'abd');
|
||||
insert into t1 values (524, 'abcd');
|
||||
insert into t1 values (567, 'A1');
|
||||
insert into t1 values (571, 'CC11');
|
||||
insert into t1 values (573, 'ab');
|
||||
select * from t1 where name rlike '.*h.*';
|
||||
select * from t1 where name rlike '.*hel.*';
|
||||
select * from t1 where name rlike '.*hell.*';
|
||||
select * from t1 where name regexp '.*hello.*';
|
||||
select * from t1 where name regexp '^h.*';
|
||||
|
||||
select * from t1 where name rlike null;
|
||||
|
||||
select * from t1 where name regexp 'abc|de';
|
||||
select * from t1 where name regexp 'a|b|c';
|
||||
select * from t1 where name regexp 'a(b)c';
|
||||
select * from t1 where name regexp 'a\\(';
|
||||
select * from t1 where name regexp 'a()b';
|
||||
select * from t1 where name regexp 'a^b';
|
||||
select * from t1 where name regexp 'a$b';
|
||||
select * from t1 where name regexp '$^';
|
||||
select * from t1 where name regexp '^^';
|
||||
select * from t1 where name regexp '$$';
|
||||
select * from t1 where name regexp 'a*(^b$)c*';
|
||||
select * from t1 where name regexp '()';
|
||||
select * from t1 where name regexp 'ab+c';
|
||||
select * from t1 where name regexp 'ab?c';
|
||||
select * from t1 where name regexp 'a{1}b';
|
||||
select * from t1 where name regexp 'a{1,}b';
|
||||
select * from t1 where name regexp 'a{1,2}b';
|
||||
select * from t1 where name regexp 'a{,2}';
|
||||
select * from t1 where name regexp 'a{,}';
|
||||
select * from t1 where name regexp 'ab{0,0}c';
|
||||
select * from t1 where name regexp 'ab{0,1}c';
|
||||
select * from t1 where name regexp 'ab{0,3}c';
|
||||
select * from t1 where name regexp 'ab{1,1}c';
|
||||
select * from t1 where name regexp 'ab{1,3}c';
|
||||
select * from t1 where name regexp 'ab{2,2}c';
|
||||
select * from t1 where name regexp 'ab{2,4}c';
|
||||
select * from t1 where name regexp '((a{1,10}){1,10}){1,10}';
|
||||
select * from t1 where name regexp 'a*{b}';
|
||||
select * from t1 where name regexp '[[:alnum:]]+';
|
||||
select * from t1 where name regexp '[[:alpha:]]+';
|
||||
select * from t1 where name regexp '[[:blank:]]+';
|
||||
select * from t1 where name regexp '[[:cntrl:]]+';
|
||||
select * from t1 where name regexp '[[:digit:]]+';
|
||||
select * from t1 where name regexp '[[:graph:]]+';
|
||||
select * from t1 where name regexp '[[:lower:]]+';
|
||||
select * from t1 where name regexp '[[:print:]]+';
|
||||
select * from t1 where name regexp '[[:punct:]]+';
|
||||
select * from t1 where name regexp '[[:space:]]+';
|
||||
select * from t1 where name regexp '[[:upper:]]+';
|
||||
select * from t1 where name regexp '[[:xdigit:]]+';
|
||||
select * from t1 where name regexp 'a(((b)))c';
|
||||
select * from t1 where name regexp 'a(b|(c))d';
|
||||
select * from t1 where name regexp 'a(b*|c)d';
|
||||
select * from t1 where name regexp 'a[ab]{20}';
|
||||
select * from t1 where name regexp 'a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab]';
|
||||
select * from t1 where name regexp 'a[ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab][ab](wee|week)(knights|night)';
|
||||
select * from t1 where name regexp '12345678901234567890123456789';
|
||||
select * from t1 where name regexp '123456789012345678901234567890';
|
||||
select * from t1 where name regexp '1234567890123456789012345678901';
|
||||
select * from t1 where name regexp '12345678901234567890123456789012';
|
||||
select * from t1 where name regexp '123456789012345678901234567890123';
|
||||
select * from t1 where name regexp '1234567890123456789012345678901234567890123456789012345678901234567890';
|
||||
select * from t1 where name regexp '[ab][cd][ef][gh][ij][kl][mn]';
|
||||
select * from t1 where name regexp '[ab][cd][ef][gh][ij][kl][mn][op]';
|
||||
select * from t1 where name regexp '[ab][cd][ef][gh][ij][kl][mn][op][qr]';
|
||||
select * from t1 where name regexp '[ab][cd][ef][gh][ij][kl][mn][op][q]';
|
||||
select * from t1 where name regexp '[a]b[c]';
|
||||
select * from t1 where name regexp '[a]b[a]';
|
||||
select * from t1 where name regexp '[abc]b[abc]';
|
||||
select * from t1 where name regexp '[abc]b[abd]';
|
||||
select * from t1 where name regexp 'a(b?c)+d';
|
||||
select * from t1 where name regexp '(wee|week)(knights|night)';
|
||||
select * from t1 where name regexp '(we|wee|week|frob)(knights|night|day)';
|
||||
select * from t1 where name regexp 'a[bc]d';
|
||||
select * from t1 where name regexp 'a[ab]c';
|
||||
|
||||
select * from t1 where name regexp null;
|
||||
|
||||
select * from t1 where name regexp '/\\*.*\\*/';
|
||||
select * from t1 where name regexp '/\\*.*\\*/';
|
||||
select * from t1 where name regexp '/\\*([^*]|\\*[^/])*\\*/';
|
||||
select * from t1 where name regexp '/\\*([^*]|\\*[^/])*\\*/';
|
||||
select * from t1 where name regexp '/\\*([^*]|\\*[^/])*\\*/';
|
||||
select * from t1 where name regexp '/\\*([^*]|\\*+[^*/])*\\*+/';
|
||||
select * from t1 where name regexp '/\\*([^*]|\\*+[^*/])*\\*+/';
|
||||
select * from t1 where name regexp '/\\*([^*]|\\*+[^*/])*\\*+/';
|
||||
select * from t1 where name regexp '/\\*([^*]|\\*+[^*/])*\\*+/';
|
||||
select * from t1 where name regexp '/\\*([^*]|\\*+[^*/])*\\*+/';
|
||||
select * from t1 where name regexp '/\\*([^*]|\\*+[^*/])*\\*+/';
|
||||
select * from t1 where name regexp 'a(b)(c)d';
|
||||
select * from t1 where name regexp 'a(((b)))c';
|
||||
select * from t1 where name regexp 'a(b|(c))d';
|
||||
select * from t1 where name regexp 'a(b*|c|e)d';
|
||||
select * from t1 where name regexp 'a(b*|c|e)d';
|
||||
select * from t1 where name regexp 'a(b*|c|e)d';
|
||||
select * from t1 where name regexp 'a(b?)c';
|
||||
select * from t1 where name regexp 'a(b?)c';
|
||||
select * from t1 where name regexp 'a(b+)c';
|
||||
select * from t1 where name regexp 'a(b+)c';
|
||||
select * from t1 where name regexp 'a(b*)c';
|
||||
select * from t1 where name regexp '(a|ab)(bc([de]+)f|cde)';
|
||||
select * from t1 where name regexp 'a(b)(c)(d)(e)(f)(g)(h)(i)(j)k';
|
||||
select * from t1 where name regexp 'a(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)l';
|
||||
select * from t1 where name regexp 'a([bc]?)c';
|
||||
select * from t1 where name regexp 'a([bc]?)c';
|
||||
select * from t1 where name regexp 'a([bc]+)c';
|
||||
select * from t1 where name regexp 'a([bc]+)c';
|
||||
select * from t1 where name regexp 'a([bc]+)bc';
|
||||
select * from t1 where name regexp 'a(bb+|b)b';
|
||||
select * from t1 where name regexp 'a(bbb+|bb+|b)b';
|
||||
select * from t1 where name regexp 'a(bbb+|bb+|b)b';
|
||||
select * from t1 where name regexp 'a(bbb+|bb+|b)bb';
|
||||
select * from t1 where name regexp '(.*).*';
|
||||
select * from t1 where name regexp '(a*)*';
|
||||
select * from t1 where name regexp 'a(b|c)*d';
|
||||
select * from t1 where name regexp 'a(b|c)*d';
|
||||
select * from t1 where name regexp 'a(b|c)+d';
|
||||
select * from t1 where name regexp 'a(b|c)+d';
|
||||
select * from t1 where name regexp 'a(b|c?)+d';
|
||||
select * from t1 where name regexp 'a(b|c?)+d';
|
||||
select * from t1 where name regexp 'a(b|c){0,0}d';
|
||||
select * from t1 where name regexp 'a(b|c){0,1}d';
|
||||
select * from t1 where name regexp 'a(b|c){0,1}d';
|
||||
select * from t1 where name regexp 'a(b|c){0,2}d';
|
||||
select * from t1 where name regexp 'a(b|c){0,2}d';
|
||||
select * from t1 where name regexp 'a(b|c){0,}d';
|
||||
select * from t1 where name regexp 'a(b|c){0,}d';
|
||||
select * from t1 where name regexp 'a(b|c){1,1}d';
|
||||
select * from t1 where name regexp 'a(b|c){1,1}d';
|
||||
select * from t1 where name regexp 'a(b|c){1,2}d';
|
||||
select * from t1 where name regexp 'a(b|c){1,2}d';
|
||||
select * from t1 where name regexp 'a(b|c){1,}d';
|
||||
select * from t1 where name regexp 'a(b|c){1,}d';
|
||||
select * from t1 where name regexp 'a(b|c){2,2}d';
|
||||
select * from t1 where name regexp 'a(b|c){2,2}d';
|
||||
select * from t1 where name regexp 'a(b|c){2,4}d';
|
||||
select * from t1 where name regexp 'a(b|c){2,4}d';
|
||||
select * from t1 where name regexp 'a(b|c){2,4}d';
|
||||
select * from t1 where name regexp 'a(b|c){2,}d';
|
||||
select * from t1 where name regexp 'a(b|c){2,}d';
|
||||
select * from t1 where name regexp 'a(b+|((c)*))+d';
|
||||
select * from t1 where name regexp 'a(b+|((c)*))+d';
|
||||
select * from t1 where name regexp '(A[1])|(A[2])|(A[3])|(A[4])|(A[5])|(A[6])|(A[7])|(A[8])|(A[9])|(A[A])';
|
||||
select * from t1 where name regexp 'CC[13]1|a{21}[23][EO][123][Es][12]a{15}aa[34][EW]aaaaaaa[X]a';
|
||||
select * from t1 where name regexp 'a?b';
|
||||
|
||||
##bug:https://aone.alibaba-inc.com/req/34761589
|
||||
select * from t1 where name regexp 'a' "bc" '|de';
|
||||
select * from t1 where name regexp "a" '|' "b" '|' "c";
|
||||
select * from t1 where name regexp "a"'()'"b";
|
||||
select * from t1 where name regexp "$" "$";
|
||||
select * from t1 where name regexp 'a' "*" '(' "^" 'b' "$" ')' "c" '*';
|
||||
select * from t1 where name regexp 'a' "b" "{" "0" ',' "0" '}' "c";
|
||||
select * from t1 where name regexp '[' "[" ':' "a" "lnum" ':' "]" ']' "+";
|
||||
select * from t1 where name regexp 'a' "(" "(" '(' "b" ')' ")" ')' 'c';
|
||||
select * from t1 where name regexp 'a'"("'b'"|"'('"c"')'")"'d';
|
||||
select * from t1 where name regexp 'a'""'('"b"'*'"|"'c'")"'d';
|
||||
select * from t1 where name regexp '[ab]'"[cd]"'[ef]'"[gh]"'[ij]'"[kl]"'[mn]';
|
||||
select * from t1 where name regexp '[a]'"b"'[c]';
|
||||
select * from t1 where name regexp '[abc]'"b"'[abc]';
|
||||
select * from t1 where name regexp 'a'"(b?c)"'+'"d";
|
||||
select * from t1 where name regexp '(wee|week)'"(knights"'|'"night)";
|
||||
select * from t1 where name regexp 'a'"[ab]"'c';
|
||||
select * from t1 where name regexp '(a|ab)'"(bc([de]+)"'f|cde)';
|
||||
select * from t1 where name regexp 'a(bbb'"+"'|bb'"+"'|b'")b";
|
||||
select * from t1 where name regexp 'a'"("'b'"|"'c'")"'{'"1"','"}"'d';
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1 (a varchar(50) primary key) ;
|
||||
insert into t1 values('abcdef');
|
||||
insert into t1 values('_bcdef');
|
||||
insert into t1 values('a_cdef');
|
||||
insert into t1 values('ab_def');
|
||||
insert into t1 values('abc_ef');
|
||||
insert into t1 values('abcd_f');
|
||||
insert into t1 values('abcde_');
|
||||
# should return ab_def
|
||||
select a as c1u from t1 where a rlike 'ab\_def';
|
||||
drop table t1;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t;
|
||||
--enable_warnings
|
||||
|
||||
create table t (c1 char(20));
|
||||
insert into t values ('');
|
||||
select c1 regexp 'ddd' from t;
|
||||
@ -0,0 +1,786 @@
|
||||
result_format: 4
|
||||
##--explain_protocol 2
|
||||
##test query on one table having global index
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 int, c2 int, c3 int, c4 int, primary key (c1, c2)) partition by hash(c1) partitions 4;
|
||||
create index gkey1 on t1(c2,c3) global;
|
||||
create index gkey2 on t1(c2,c3) global partition by hash(c3) partitions 2;
|
||||
## test full scan
|
||||
select /*+index(t1 primary)*/ c2, c3 from t1 order by c2;
|
||||
+----+------+
|
||||
| c2 | c3 |
|
||||
+----+------+
|
||||
| 2 | 3 |
|
||||
| 3 | 4 |
|
||||
| 4 | 5 |
|
||||
| 5 | 6 |
|
||||
| 6 | 7 |
|
||||
| 7 | 8 |
|
||||
| 8 | 9 |
|
||||
| 9 | 10 |
|
||||
| 10 | 11 |
|
||||
| 11 | 12 |
|
||||
+----+------+
|
||||
select /*+index(t1 gkey1)*/ c2, c3 from t1 order by c2;
|
||||
+----+------+
|
||||
| c2 | c3 |
|
||||
+----+------+
|
||||
| 2 | 3 |
|
||||
| 3 | 4 |
|
||||
| 4 | 5 |
|
||||
| 5 | 6 |
|
||||
| 6 | 7 |
|
||||
| 7 | 8 |
|
||||
| 8 | 9 |
|
||||
| 9 | 10 |
|
||||
| 10 | 11 |
|
||||
| 11 | 12 |
|
||||
+----+------+
|
||||
select /*+index(t1 gkey2)*/ c2, c3 from t1 order by c2;
|
||||
+----+------+
|
||||
| c2 | c3 |
|
||||
+----+------+
|
||||
| 2 | 3 |
|
||||
| 3 | 4 |
|
||||
| 4 | 5 |
|
||||
| 5 | 6 |
|
||||
| 6 | 7 |
|
||||
| 7 | 8 |
|
||||
| 8 | 9 |
|
||||
| 9 | 10 |
|
||||
| 10 | 11 |
|
||||
| 11 | 12 |
|
||||
+----+------+
|
||||
|
||||
select /*+index(t1 primary)*/ * from t1 order by c1;
|
||||
+----+----+------+------+
|
||||
| c1 | c2 | c3 | c4 |
|
||||
+----+----+------+------+
|
||||
| 1 | 2 | 3 | 4 |
|
||||
| 2 | 3 | 4 | 5 |
|
||||
| 3 | 4 | 5 | 6 |
|
||||
| 4 | 5 | 6 | 7 |
|
||||
| 5 | 6 | 7 | 8 |
|
||||
| 6 | 7 | 8 | 9 |
|
||||
| 7 | 8 | 9 | 10 |
|
||||
| 8 | 9 | 10 | 11 |
|
||||
| 9 | 10 | 11 | 12 |
|
||||
| 10 | 11 | 12 | 13 |
|
||||
+----+----+------+------+
|
||||
select /*+index(t1 gkey1)*/ * from t1 order by c1;
|
||||
+----+----+------+------+
|
||||
| c1 | c2 | c3 | c4 |
|
||||
+----+----+------+------+
|
||||
| 1 | 2 | 3 | 4 |
|
||||
| 2 | 3 | 4 | 5 |
|
||||
| 3 | 4 | 5 | 6 |
|
||||
| 4 | 5 | 6 | 7 |
|
||||
| 5 | 6 | 7 | 8 |
|
||||
| 6 | 7 | 8 | 9 |
|
||||
| 7 | 8 | 9 | 10 |
|
||||
| 8 | 9 | 10 | 11 |
|
||||
| 9 | 10 | 11 | 12 |
|
||||
| 10 | 11 | 12 | 13 |
|
||||
+----+----+------+------+
|
||||
select /*+index(t1 gkey2)*/ * from t1 order by c1;
|
||||
+----+----+------+------+
|
||||
| c1 | c2 | c3 | c4 |
|
||||
+----+----+------+------+
|
||||
| 1 | 2 | 3 | 4 |
|
||||
| 2 | 3 | 4 | 5 |
|
||||
| 3 | 4 | 5 | 6 |
|
||||
| 4 | 5 | 6 | 7 |
|
||||
| 5 | 6 | 7 | 8 |
|
||||
| 6 | 7 | 8 | 9 |
|
||||
| 7 | 8 | 9 | 10 |
|
||||
| 8 | 9 | 10 | 11 |
|
||||
| 9 | 10 | 11 | 12 |
|
||||
| 10 | 11 | 12 | 13 |
|
||||
+----+----+------+------+
|
||||
## test where statement
|
||||
select /*+index(t1 primary)*/ c2, c3 from t1 where c2 < 10 order by c2;
|
||||
+----+------+
|
||||
| c2 | c3 |
|
||||
+----+------+
|
||||
| 2 | 3 |
|
||||
| 3 | 4 |
|
||||
| 4 | 5 |
|
||||
| 5 | 6 |
|
||||
| 6 | 7 |
|
||||
| 7 | 8 |
|
||||
| 8 | 9 |
|
||||
| 9 | 10 |
|
||||
+----+------+
|
||||
select /*+index(t1 gkey1)*/ c2, c3 from t1 where c2 < 10 order by c2;
|
||||
+----+------+
|
||||
| c2 | c3 |
|
||||
+----+------+
|
||||
| 2 | 3 |
|
||||
| 3 | 4 |
|
||||
| 4 | 5 |
|
||||
| 5 | 6 |
|
||||
| 6 | 7 |
|
||||
| 7 | 8 |
|
||||
| 8 | 9 |
|
||||
| 9 | 10 |
|
||||
+----+------+
|
||||
select /*+index(t1 gkey2)*/ c2, c3 from t1 where c2 < 10 order by c2;
|
||||
+----+------+
|
||||
| c2 | c3 |
|
||||
+----+------+
|
||||
| 2 | 3 |
|
||||
| 3 | 4 |
|
||||
| 4 | 5 |
|
||||
| 5 | 6 |
|
||||
| 6 | 7 |
|
||||
| 7 | 8 |
|
||||
| 8 | 9 |
|
||||
| 9 | 10 |
|
||||
+----+------+
|
||||
|
||||
select /*+index(t1 primary)*/ * from t1 where c2 < 10 order by c1;
|
||||
+----+----+------+------+
|
||||
| c1 | c2 | c3 | c4 |
|
||||
+----+----+------+------+
|
||||
| 1 | 2 | 3 | 4 |
|
||||
| 2 | 3 | 4 | 5 |
|
||||
| 3 | 4 | 5 | 6 |
|
||||
| 4 | 5 | 6 | 7 |
|
||||
| 5 | 6 | 7 | 8 |
|
||||
| 6 | 7 | 8 | 9 |
|
||||
| 7 | 8 | 9 | 10 |
|
||||
| 8 | 9 | 10 | 11 |
|
||||
+----+----+------+------+
|
||||
select /*+index(t1 gkey1)*/ * from t1 where c2 < 10 order by c1;
|
||||
+----+----+------+------+
|
||||
| c1 | c2 | c3 | c4 |
|
||||
+----+----+------+------+
|
||||
| 1 | 2 | 3 | 4 |
|
||||
| 2 | 3 | 4 | 5 |
|
||||
| 3 | 4 | 5 | 6 |
|
||||
| 4 | 5 | 6 | 7 |
|
||||
| 5 | 6 | 7 | 8 |
|
||||
| 6 | 7 | 8 | 9 |
|
||||
| 7 | 8 | 9 | 10 |
|
||||
| 8 | 9 | 10 | 11 |
|
||||
+----+----+------+------+
|
||||
select /*+index(t1 gkey2)*/ * from t1 where c2 < 10 order by c1;
|
||||
+----+----+------+------+
|
||||
| c1 | c2 | c3 | c4 |
|
||||
+----+----+------+------+
|
||||
| 1 | 2 | 3 | 4 |
|
||||
| 2 | 3 | 4 | 5 |
|
||||
| 3 | 4 | 5 | 6 |
|
||||
| 4 | 5 | 6 | 7 |
|
||||
| 5 | 6 | 7 | 8 |
|
||||
| 6 | 7 | 8 | 9 |
|
||||
| 7 | 8 | 9 | 10 |
|
||||
| 8 | 9 | 10 | 11 |
|
||||
+----+----+------+------+
|
||||
|
||||
select /*+index(t1 primary)*/ * from t1 where c4 < 6 order by c1;
|
||||
+----+----+------+------+
|
||||
| c1 | c2 | c3 | c4 |
|
||||
+----+----+------+------+
|
||||
| 1 | 2 | 3 | 4 |
|
||||
| 2 | 3 | 4 | 5 |
|
||||
+----+----+------+------+
|
||||
select /*+index(t1 gkey1)*/ * from t1 where c4 < 6 order by c1;
|
||||
+----+----+------+------+
|
||||
| c1 | c2 | c3 | c4 |
|
||||
+----+----+------+------+
|
||||
| 1 | 2 | 3 | 4 |
|
||||
| 2 | 3 | 4 | 5 |
|
||||
+----+----+------+------+
|
||||
select /*+index(t1 gkey2)*/ * from t1 where c4 < 6 order by c1;
|
||||
+----+----+------+------+
|
||||
| c1 | c2 | c3 | c4 |
|
||||
+----+----+------+------+
|
||||
| 1 | 2 | 3 | 4 |
|
||||
| 2 | 3 | 4 | 5 |
|
||||
+----+----+------+------+
|
||||
|
||||
select /*+index(t1 primary)*/ * from t1 where c2 < 10 and c4 < 6 order by c1;
|
||||
+----+----+------+------+
|
||||
| c1 | c2 | c3 | c4 |
|
||||
+----+----+------+------+
|
||||
| 1 | 2 | 3 | 4 |
|
||||
| 2 | 3 | 4 | 5 |
|
||||
+----+----+------+------+
|
||||
select /*+index(t1 gkey1)*/ * from t1 where c2 < 10 and c4 < 6 order by c1;
|
||||
+----+----+------+------+
|
||||
| c1 | c2 | c3 | c4 |
|
||||
+----+----+------+------+
|
||||
| 1 | 2 | 3 | 4 |
|
||||
| 2 | 3 | 4 | 5 |
|
||||
+----+----+------+------+
|
||||
select /*+index(t1 gkey2)*/ * from t1 where c2 < 10 and c4 < 6 order by c1;
|
||||
+----+----+------+------+
|
||||
| c1 | c2 | c3 | c4 |
|
||||
+----+----+------+------+
|
||||
| 1 | 2 | 3 | 4 |
|
||||
| 2 | 3 | 4 | 5 |
|
||||
+----+----+------+------+
|
||||
|
||||
select /*+index(t1 primary)*/ * from t1 where c2 < 10 and c4 < 6 and c3 + c4 < 10 order by c1;
|
||||
+----+----+------+------+
|
||||
| c1 | c2 | c3 | c4 |
|
||||
+----+----+------+------+
|
||||
| 1 | 2 | 3 | 4 |
|
||||
| 2 | 3 | 4 | 5 |
|
||||
+----+----+------+------+
|
||||
select /*+index(t1 gkey1)*/ * from t1 where c2 < 10 and c4 < 6 and c3 + c4 < 10 order by c1;
|
||||
+----+----+------+------+
|
||||
| c1 | c2 | c3 | c4 |
|
||||
+----+----+------+------+
|
||||
| 1 | 2 | 3 | 4 |
|
||||
| 2 | 3 | 4 | 5 |
|
||||
+----+----+------+------+
|
||||
select /*+index(t1 gkey2)*/ * from t1 where c2 < 10 and c4 < 6 and c3 + c4 < 10 order by c1;
|
||||
+----+----+------+------+
|
||||
| c1 | c2 | c3 | c4 |
|
||||
+----+----+------+------+
|
||||
| 1 | 2 | 3 | 4 |
|
||||
| 2 | 3 | 4 | 5 |
|
||||
+----+----+------+------+
|
||||
|
||||
## test group by statement
|
||||
select /*+index(t1 primary)*/ c2, sum(c3) from t1 where c2 < 10 group by c1;
|
||||
+----+---------+
|
||||
| c2 | sum(c3) |
|
||||
+----+---------+
|
||||
| 5 | 6 |
|
||||
| 9 | 10 |
|
||||
| 2 | 3 |
|
||||
| 6 | 7 |
|
||||
| 3 | 4 |
|
||||
| 7 | 8 |
|
||||
| 4 | 5 |
|
||||
| 8 | 9 |
|
||||
+----+---------+
|
||||
select /*+index(t1 gkey1)*/ c2, sum(c3) from t1 where c2 < 10 group by c1;
|
||||
+----+---------+
|
||||
| c2 | sum(c3) |
|
||||
+----+---------+
|
||||
| 2 | 3 |
|
||||
| 3 | 4 |
|
||||
| 4 | 5 |
|
||||
| 5 | 6 |
|
||||
| 6 | 7 |
|
||||
| 7 | 8 |
|
||||
| 8 | 9 |
|
||||
| 9 | 10 |
|
||||
+----+---------+
|
||||
select /*+index(t1 gkey2)*/ c2, sum(c3) from t1 where c2 < 10 group by c1;
|
||||
+----+---------+
|
||||
| c2 | sum(c3) |
|
||||
+----+---------+
|
||||
| 3 | 4 |
|
||||
| 5 | 6 |
|
||||
| 7 | 8 |
|
||||
| 9 | 10 |
|
||||
| 2 | 3 |
|
||||
| 4 | 5 |
|
||||
| 6 | 7 |
|
||||
| 8 | 9 |
|
||||
+----+---------+
|
||||
|
||||
select /*+index(t1 primary)*/ c2, sum(c3) from t1 where c2 < 10 group by c2 having sum(c3) > 5 order by c2;
|
||||
+----+---------+
|
||||
| c2 | sum(c3) |
|
||||
+----+---------+
|
||||
| 5 | 6 |
|
||||
| 6 | 7 |
|
||||
| 7 | 8 |
|
||||
| 8 | 9 |
|
||||
| 9 | 10 |
|
||||
+----+---------+
|
||||
select /*+index(t1 gkey1)*/ c2, sum(c3) from t1 where c2 < 10 group by c2 having sum(c3) > 5 order by c2;
|
||||
+----+---------+
|
||||
| c2 | sum(c3) |
|
||||
+----+---------+
|
||||
| 5 | 6 |
|
||||
| 6 | 7 |
|
||||
| 7 | 8 |
|
||||
| 8 | 9 |
|
||||
| 9 | 10 |
|
||||
+----+---------+
|
||||
select /*+index(t1 gkey2)*/ c2, sum(c3) from t1 where c2 < 10 group by c2 having sum(c3) > 5 order by c2;
|
||||
+----+---------+
|
||||
| c2 | sum(c3) |
|
||||
+----+---------+
|
||||
| 5 | 6 |
|
||||
| 6 | 7 |
|
||||
| 7 | 8 |
|
||||
| 8 | 9 |
|
||||
| 9 | 10 |
|
||||
+----+---------+
|
||||
|
||||
select /*+index(t1 primary)*/ c2, sum(c3) from t1 where c2 < 10 group by c4 having sum(c4) > 6 order by c4;
|
||||
+----+---------+
|
||||
| c2 | sum(c3) |
|
||||
+----+---------+
|
||||
| 5 | 6 |
|
||||
| 6 | 7 |
|
||||
| 7 | 8 |
|
||||
| 8 | 9 |
|
||||
| 9 | 10 |
|
||||
+----+---------+
|
||||
select /*+index(t1 gkey1)*/ c2, sum(c3) from t1 where c2 < 10 group by c4 having sum(c4) > 6 order by c4;
|
||||
+----+---------+
|
||||
| c2 | sum(c3) |
|
||||
+----+---------+
|
||||
| 5 | 6 |
|
||||
| 6 | 7 |
|
||||
| 7 | 8 |
|
||||
| 8 | 9 |
|
||||
| 9 | 10 |
|
||||
+----+---------+
|
||||
select /*+index(t1 gkey2)*/ c2, sum(c3) from t1 where c2 < 10 group by c4 having sum(c4) > 6 order by c4;
|
||||
+----+---------+
|
||||
| c2 | sum(c3) |
|
||||
+----+---------+
|
||||
| 5 | 6 |
|
||||
| 6 | 7 |
|
||||
| 7 | 8 |
|
||||
| 8 | 9 |
|
||||
| 9 | 10 |
|
||||
+----+---------+
|
||||
|
||||
##test distinct statement
|
||||
select /*+index(t1 primary)*/ distinct c2, c3 from t1 where c2 < 10 order by c2;
|
||||
+----+------+
|
||||
| c2 | c3 |
|
||||
+----+------+
|
||||
| 2 | 3 |
|
||||
| 3 | 4 |
|
||||
| 4 | 5 |
|
||||
| 5 | 6 |
|
||||
| 6 | 7 |
|
||||
| 7 | 8 |
|
||||
| 8 | 9 |
|
||||
| 9 | 10 |
|
||||
+----+------+
|
||||
select /*+index(t1 gkey1)*/ distinct c2, c3 from t1 where c2 < 10 order by c2;
|
||||
+----+------+
|
||||
| c2 | c3 |
|
||||
+----+------+
|
||||
| 2 | 3 |
|
||||
| 3 | 4 |
|
||||
| 4 | 5 |
|
||||
| 5 | 6 |
|
||||
| 6 | 7 |
|
||||
| 7 | 8 |
|
||||
| 8 | 9 |
|
||||
| 9 | 10 |
|
||||
+----+------+
|
||||
select /*+index(t1 gkey2)*/ distinct c2, c3 from t1 where c2 < 10 order by c2;
|
||||
+----+------+
|
||||
| c2 | c3 |
|
||||
+----+------+
|
||||
| 2 | 3 |
|
||||
| 3 | 4 |
|
||||
| 4 | 5 |
|
||||
| 5 | 6 |
|
||||
| 6 | 7 |
|
||||
| 7 | 8 |
|
||||
| 8 | 9 |
|
||||
| 9 | 10 |
|
||||
+----+------+
|
||||
|
||||
select /*+index(t1 primary)*/ distinct c2, c3 from t1 where c2 < 10 order by c1;
|
||||
+----+------+
|
||||
| c2 | c3 |
|
||||
+----+------+
|
||||
| 2 | 3 |
|
||||
| 3 | 4 |
|
||||
| 4 | 5 |
|
||||
| 5 | 6 |
|
||||
| 6 | 7 |
|
||||
| 7 | 8 |
|
||||
| 8 | 9 |
|
||||
| 9 | 10 |
|
||||
+----+------+
|
||||
select /*+index(t1 gkey1)*/ distinct c2, c3 from t1 where c2 < 10 order by c1;
|
||||
+----+------+
|
||||
| c2 | c3 |
|
||||
+----+------+
|
||||
| 2 | 3 |
|
||||
| 3 | 4 |
|
||||
| 4 | 5 |
|
||||
| 5 | 6 |
|
||||
| 6 | 7 |
|
||||
| 7 | 8 |
|
||||
| 8 | 9 |
|
||||
| 9 | 10 |
|
||||
+----+------+
|
||||
select /*+index(t1 gkey2)*/ distinct c2, c3 from t1 where c2 < 10 order by c1;
|
||||
+----+------+
|
||||
| c2 | c3 |
|
||||
+----+------+
|
||||
| 2 | 3 |
|
||||
| 3 | 4 |
|
||||
| 4 | 5 |
|
||||
| 5 | 6 |
|
||||
| 6 | 7 |
|
||||
| 7 | 8 |
|
||||
| 8 | 9 |
|
||||
| 9 | 10 |
|
||||
+----+------+
|
||||
|
||||
select /*+index(t1 primary)*/ distinct c2, c3, c4 from t1 where c2 < 10 order by c1;
|
||||
+----+------+------+
|
||||
| c2 | c3 | c4 |
|
||||
+----+------+------+
|
||||
| 2 | 3 | 4 |
|
||||
| 3 | 4 | 5 |
|
||||
| 4 | 5 | 6 |
|
||||
| 5 | 6 | 7 |
|
||||
| 6 | 7 | 8 |
|
||||
| 7 | 8 | 9 |
|
||||
| 8 | 9 | 10 |
|
||||
| 9 | 10 | 11 |
|
||||
+----+------+------+
|
||||
select /*+index(t1 gkey1)*/ distinct c2, c3, c4 from t1 where c2 < 10 order by c1;
|
||||
+----+------+------+
|
||||
| c2 | c3 | c4 |
|
||||
+----+------+------+
|
||||
| 2 | 3 | 4 |
|
||||
| 3 | 4 | 5 |
|
||||
| 4 | 5 | 6 |
|
||||
| 5 | 6 | 7 |
|
||||
| 6 | 7 | 8 |
|
||||
| 7 | 8 | 9 |
|
||||
| 8 | 9 | 10 |
|
||||
| 9 | 10 | 11 |
|
||||
+----+------+------+
|
||||
select /*+index(t1 gkey2)*/ distinct c2, c3, c4 from t1 where c2 < 10 order by c1;
|
||||
+----+------+------+
|
||||
| c2 | c3 | c4 |
|
||||
+----+------+------+
|
||||
| 2 | 3 | 4 |
|
||||
| 3 | 4 | 5 |
|
||||
| 4 | 5 | 6 |
|
||||
| 5 | 6 | 7 |
|
||||
| 6 | 7 | 8 |
|
||||
| 7 | 8 | 9 |
|
||||
| 8 | 9 | 10 |
|
||||
| 9 | 10 | 11 |
|
||||
+----+------+------+
|
||||
|
||||
## test order by statement
|
||||
select /*+index(t1 primary)*/ c2, c3 from t1 order by c2;
|
||||
+----+------+
|
||||
| c2 | c3 |
|
||||
+----+------+
|
||||
| 2 | 3 |
|
||||
| 3 | 4 |
|
||||
| 4 | 5 |
|
||||
| 5 | 6 |
|
||||
| 6 | 7 |
|
||||
| 7 | 8 |
|
||||
| 8 | 9 |
|
||||
| 9 | 10 |
|
||||
| 10 | 11 |
|
||||
| 11 | 12 |
|
||||
+----+------+
|
||||
select /*+index(t1 gkey1)*/ c2, c3 from t1 order by c2;
|
||||
+----+------+
|
||||
| c2 | c3 |
|
||||
+----+------+
|
||||
| 2 | 3 |
|
||||
| 3 | 4 |
|
||||
| 4 | 5 |
|
||||
| 5 | 6 |
|
||||
| 6 | 7 |
|
||||
| 7 | 8 |
|
||||
| 8 | 9 |
|
||||
| 9 | 10 |
|
||||
| 10 | 11 |
|
||||
| 11 | 12 |
|
||||
+----+------+
|
||||
select /*+index(t1 gkey2)*/ c2, c3 from t1 order by c2;
|
||||
+----+------+
|
||||
| c2 | c3 |
|
||||
+----+------+
|
||||
| 2 | 3 |
|
||||
| 3 | 4 |
|
||||
| 4 | 5 |
|
||||
| 5 | 6 |
|
||||
| 6 | 7 |
|
||||
| 7 | 8 |
|
||||
| 8 | 9 |
|
||||
| 9 | 10 |
|
||||
| 10 | 11 |
|
||||
| 11 | 12 |
|
||||
+----+------+
|
||||
|
||||
select /*+index(t1 primary)*/ * from t1 order by c2;
|
||||
+----+----+------+------+
|
||||
| c1 | c2 | c3 | c4 |
|
||||
+----+----+------+------+
|
||||
| 1 | 2 | 3 | 4 |
|
||||
| 2 | 3 | 4 | 5 |
|
||||
| 3 | 4 | 5 | 6 |
|
||||
| 4 | 5 | 6 | 7 |
|
||||
| 5 | 6 | 7 | 8 |
|
||||
| 6 | 7 | 8 | 9 |
|
||||
| 7 | 8 | 9 | 10 |
|
||||
| 8 | 9 | 10 | 11 |
|
||||
| 9 | 10 | 11 | 12 |
|
||||
| 10 | 11 | 12 | 13 |
|
||||
+----+----+------+------+
|
||||
select /*+index(t1 gkey1)*/ * from t1 order by c2;
|
||||
+----+----+------+------+
|
||||
| c1 | c2 | c3 | c4 |
|
||||
+----+----+------+------+
|
||||
| 1 | 2 | 3 | 4 |
|
||||
| 2 | 3 | 4 | 5 |
|
||||
| 3 | 4 | 5 | 6 |
|
||||
| 4 | 5 | 6 | 7 |
|
||||
| 5 | 6 | 7 | 8 |
|
||||
| 6 | 7 | 8 | 9 |
|
||||
| 7 | 8 | 9 | 10 |
|
||||
| 8 | 9 | 10 | 11 |
|
||||
| 9 | 10 | 11 | 12 |
|
||||
| 10 | 11 | 12 | 13 |
|
||||
+----+----+------+------+
|
||||
select /*+index(t1 gkey2)*/ * from t1 order by c2;
|
||||
+----+----+------+------+
|
||||
| c1 | c2 | c3 | c4 |
|
||||
+----+----+------+------+
|
||||
| 1 | 2 | 3 | 4 |
|
||||
| 2 | 3 | 4 | 5 |
|
||||
| 3 | 4 | 5 | 6 |
|
||||
| 4 | 5 | 6 | 7 |
|
||||
| 5 | 6 | 7 | 8 |
|
||||
| 6 | 7 | 8 | 9 |
|
||||
| 7 | 8 | 9 | 10 |
|
||||
| 8 | 9 | 10 | 11 |
|
||||
| 9 | 10 | 11 | 12 |
|
||||
| 10 | 11 | 12 | 13 |
|
||||
+----+----+------+------+
|
||||
|
||||
select /*+index(t1 primary)*/ * from t1 order by c2, c3;
|
||||
+----+----+------+------+
|
||||
| c1 | c2 | c3 | c4 |
|
||||
+----+----+------+------+
|
||||
| 1 | 2 | 3 | 4 |
|
||||
| 2 | 3 | 4 | 5 |
|
||||
| 3 | 4 | 5 | 6 |
|
||||
| 4 | 5 | 6 | 7 |
|
||||
| 5 | 6 | 7 | 8 |
|
||||
| 6 | 7 | 8 | 9 |
|
||||
| 7 | 8 | 9 | 10 |
|
||||
| 8 | 9 | 10 | 11 |
|
||||
| 9 | 10 | 11 | 12 |
|
||||
| 10 | 11 | 12 | 13 |
|
||||
+----+----+------+------+
|
||||
select /*+index(t1 gkey1)*/ * from t1 order by c2, c3;
|
||||
+----+----+------+------+
|
||||
| c1 | c2 | c3 | c4 |
|
||||
+----+----+------+------+
|
||||
| 1 | 2 | 3 | 4 |
|
||||
| 2 | 3 | 4 | 5 |
|
||||
| 3 | 4 | 5 | 6 |
|
||||
| 4 | 5 | 6 | 7 |
|
||||
| 5 | 6 | 7 | 8 |
|
||||
| 6 | 7 | 8 | 9 |
|
||||
| 7 | 8 | 9 | 10 |
|
||||
| 8 | 9 | 10 | 11 |
|
||||
| 9 | 10 | 11 | 12 |
|
||||
| 10 | 11 | 12 | 13 |
|
||||
+----+----+------+------+
|
||||
select /*+index(t1 gkey2)*/ * from t1 order by c2, c3;
|
||||
+----+----+------+------+
|
||||
| c1 | c2 | c3 | c4 |
|
||||
+----+----+------+------+
|
||||
| 1 | 2 | 3 | 4 |
|
||||
| 2 | 3 | 4 | 5 |
|
||||
| 3 | 4 | 5 | 6 |
|
||||
| 4 | 5 | 6 | 7 |
|
||||
| 5 | 6 | 7 | 8 |
|
||||
| 6 | 7 | 8 | 9 |
|
||||
| 7 | 8 | 9 | 10 |
|
||||
| 8 | 9 | 10 | 11 |
|
||||
| 9 | 10 | 11 | 12 |
|
||||
| 10 | 11 | 12 | 13 |
|
||||
+----+----+------+------+
|
||||
|
||||
select /*+index(t1 primary)*/ * from t1 order by c3;
|
||||
+----+----+------+------+
|
||||
| c1 | c2 | c3 | c4 |
|
||||
+----+----+------+------+
|
||||
| 1 | 2 | 3 | 4 |
|
||||
| 2 | 3 | 4 | 5 |
|
||||
| 3 | 4 | 5 | 6 |
|
||||
| 4 | 5 | 6 | 7 |
|
||||
| 5 | 6 | 7 | 8 |
|
||||
| 6 | 7 | 8 | 9 |
|
||||
| 7 | 8 | 9 | 10 |
|
||||
| 8 | 9 | 10 | 11 |
|
||||
| 9 | 10 | 11 | 12 |
|
||||
| 10 | 11 | 12 | 13 |
|
||||
+----+----+------+------+
|
||||
select /*+index(t1 gkey1)*/ * from t1 order by c3;
|
||||
+----+----+------+------+
|
||||
| c1 | c2 | c3 | c4 |
|
||||
+----+----+------+------+
|
||||
| 1 | 2 | 3 | 4 |
|
||||
| 2 | 3 | 4 | 5 |
|
||||
| 3 | 4 | 5 | 6 |
|
||||
| 4 | 5 | 6 | 7 |
|
||||
| 5 | 6 | 7 | 8 |
|
||||
| 6 | 7 | 8 | 9 |
|
||||
| 7 | 8 | 9 | 10 |
|
||||
| 8 | 9 | 10 | 11 |
|
||||
| 9 | 10 | 11 | 12 |
|
||||
| 10 | 11 | 12 | 13 |
|
||||
+----+----+------+------+
|
||||
select /*+index(t1 gkey2)*/ * from t1 order by c3;
|
||||
+----+----+------+------+
|
||||
| c1 | c2 | c3 | c4 |
|
||||
+----+----+------+------+
|
||||
| 1 | 2 | 3 | 4 |
|
||||
| 2 | 3 | 4 | 5 |
|
||||
| 3 | 4 | 5 | 6 |
|
||||
| 4 | 5 | 6 | 7 |
|
||||
| 5 | 6 | 7 | 8 |
|
||||
| 6 | 7 | 8 | 9 |
|
||||
| 7 | 8 | 9 | 10 |
|
||||
| 8 | 9 | 10 | 11 |
|
||||
| 9 | 10 | 11 | 12 |
|
||||
| 10 | 11 | 12 | 13 |
|
||||
+----+----+------+------+
|
||||
|
||||
## test limit statement
|
||||
select /*+index(t1 primary)*/ c2, c3 from t1 order by c2 limit 3;
|
||||
+----+------+
|
||||
| c2 | c3 |
|
||||
+----+------+
|
||||
| 2 | 3 |
|
||||
| 3 | 4 |
|
||||
| 4 | 5 |
|
||||
+----+------+
|
||||
select /*+index(t1 gkey1)*/ c2, c3 from t1 order by c2 limit 3;
|
||||
+----+------+
|
||||
| c2 | c3 |
|
||||
+----+------+
|
||||
| 2 | 3 |
|
||||
| 3 | 4 |
|
||||
| 4 | 5 |
|
||||
+----+------+
|
||||
select /*+index(t1 gkey2)*/ c2, c3 from t1 order by c2 limit 3;
|
||||
+----+------+
|
||||
| c2 | c3 |
|
||||
+----+------+
|
||||
| 2 | 3 |
|
||||
| 3 | 4 |
|
||||
| 4 | 5 |
|
||||
+----+------+
|
||||
|
||||
select /*+index(t1 primary)*/ * from t1 order by c2 limit 3;
|
||||
+----+----+------+------+
|
||||
| c1 | c2 | c3 | c4 |
|
||||
+----+----+------+------+
|
||||
| 1 | 2 | 3 | 4 |
|
||||
| 2 | 3 | 4 | 5 |
|
||||
| 3 | 4 | 5 | 6 |
|
||||
+----+----+------+------+
|
||||
select /*+index(t1 gkey1)*/ * from t1 order by c2 limit 3;
|
||||
+----+----+------+------+
|
||||
| c1 | c2 | c3 | c4 |
|
||||
+----+----+------+------+
|
||||
| 1 | 2 | 3 | 4 |
|
||||
| 2 | 3 | 4 | 5 |
|
||||
| 3 | 4 | 5 | 6 |
|
||||
+----+----+------+------+
|
||||
select /*+index(t1 gkey2)*/ * from t1 order by c2 limit 3;
|
||||
+----+----+------+------+
|
||||
| c1 | c2 | c3 | c4 |
|
||||
+----+----+------+------+
|
||||
| 1 | 2 | 3 | 4 |
|
||||
| 2 | 3 | 4 | 5 |
|
||||
| 3 | 4 | 5 | 6 |
|
||||
+----+----+------+------+
|
||||
|
||||
select /*+index(t1 primary)*/ * from t1 order by c2, c3 limit 3;
|
||||
+----+----+------+------+
|
||||
| c1 | c2 | c3 | c4 |
|
||||
+----+----+------+------+
|
||||
| 1 | 2 | 3 | 4 |
|
||||
| 2 | 3 | 4 | 5 |
|
||||
| 3 | 4 | 5 | 6 |
|
||||
+----+----+------+------+
|
||||
select /*+index(t1 gkey1)*/ * from t1 order by c2, c3 limit 3;
|
||||
+----+----+------+------+
|
||||
| c1 | c2 | c3 | c4 |
|
||||
+----+----+------+------+
|
||||
| 1 | 2 | 3 | 4 |
|
||||
| 2 | 3 | 4 | 5 |
|
||||
| 3 | 4 | 5 | 6 |
|
||||
+----+----+------+------+
|
||||
select /*+index(t1 gkey2)*/ * from t1 order by c2, c3 limit 3;
|
||||
+----+----+------+------+
|
||||
| c1 | c2 | c3 | c4 |
|
||||
+----+----+------+------+
|
||||
| 1 | 2 | 3 | 4 |
|
||||
| 2 | 3 | 4 | 5 |
|
||||
| 3 | 4 | 5 | 6 |
|
||||
+----+----+------+------+
|
||||
|
||||
##test scala group by
|
||||
select /*+index(t1 primary)*/ count(*) from t1;
|
||||
+----------+
|
||||
| count(*) |
|
||||
+----------+
|
||||
| 10 |
|
||||
+----------+
|
||||
select /*+index(t1 gkey1)*/ count(*) from t1;
|
||||
+----------+
|
||||
| count(*) |
|
||||
+----------+
|
||||
| 10 |
|
||||
+----------+
|
||||
select /*+index(t1 gkey2)*/ count(*) from t1;
|
||||
+----------+
|
||||
| count(*) |
|
||||
+----------+
|
||||
| 10 |
|
||||
+----------+
|
||||
drop table if exists t1;
|
||||
|
||||
drop table if exists t1;
|
||||
create table t1(a int, b int, c int, d int, primary key(a,b)) partition by hash(a) partitions 3;
|
||||
create unique index idx on t1(c) partition by hash(c) partitions 5;
|
||||
insert into t1 values (1,1,1,1),(2,2,2,2),(3,3,3,3);
|
||||
update t1 set d=d+1 where (a,b)>=(1,1) and c=1;
|
||||
drop table if exists t1;
|
||||
|
||||
drop table if exists obright_part;
|
||||
create table obright_part(grp_id bigint, row_id bigint, row_hex varchar(2048), trx_grp bigint,
|
||||
v1 varchar(65536), v1_check bigint, v2 varchar(65536), v2_check bigint, r1 int, r2 int, glike varchar(4096),
|
||||
c1 bigint, c2 bigint, c3 bigint, c4 bigint, c5 bigint, c6 tinyint, c7 bigint, c8 bigint, c9 bigint, c10 bigint, v3 varchar(1024),
|
||||
ts timestamp(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), t1 timestamp(6) null, t2 datetime(6),
|
||||
dec1 decimal(16,4), dec2 decimal(16,4), dec3 decimal(16,6),
|
||||
b1 boolean, d1 bigint default 0, ac1 bigint auto_increment, gmt_create timestamp(6) default now(6), gmt_modified timestamp(6) default now(6),
|
||||
gen_v1 varchar(10) GENERATED ALWAYS AS (substr(v1,1,10)) virtual,
|
||||
gen_v2 varchar(10) GENERATED ALWAYS AS (substr(v1,1,10)) stored,
|
||||
primary key(grp_id, row_id, row_hex),
|
||||
index obright_part2(trx_grp,row_id, ac1) LOCAL,
|
||||
index obright_part3(glike) LOCAL,
|
||||
index obright_part4(t1,ts,dec1,dec2) storing(v1,v1_check,r1,r2) LOCAL,
|
||||
index obright_part5(v1_check,v2_check) LOCAL,
|
||||
index obright_part6(row_hex,v1_check) storing(glike,t1,r1) LOCAL,
|
||||
unique index obright_part1_uniq(t1,grp_id,row_id,row_hex) LOCAL,
|
||||
unique index obright_part2_uniq(trx_grp,r1,row_hex,row_id,grp_id) LOCAL,
|
||||
unique index obright_part3_uniq(row_hex,grp_id,row_id) LOCAL)
|
||||
partition by key (grp_id) partitions 2;
|
||||
|
||||
create index obright_part1 on obright_part(row_id) global partition by HASH(row_id) partitions 2;
|
||||
select grp_id, max(row_id), max(row_hex), max(trx_grp), abs(row_id)%2 as row_id_mod from obright_part where grp_id=6447+length('a')-1 group by row_id_mod order by row_id_mod desc limit 1;
|
||||
+--------+-------------+--------------+--------------+------------+
|
||||
| grp_id | max(row_id) | max(row_hex) | max(trx_grp) | row_id_mod |
|
||||
+--------+-------------+--------------+--------------+------------+
|
||||
+--------+-------------+--------------+--------------+------------+
|
||||
drop table if exists obright_part;
|
||||
@ -0,0 +1,156 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner:guoping.wgp
|
||||
#owner group: sql1
|
||||
# tags: optimizer, global_index
|
||||
#test different select statement of global index
|
||||
|
||||
--result_format 4
|
||||
##--explain_protocol 2
|
||||
|
||||
##test query on one table having global index
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1 (c1 int, c2 int, c3 int, c4 int, primary key (c1, c2)) partition by hash(c1) partitions 4;
|
||||
create index gkey1 on t1(c2,c3) global;
|
||||
create index gkey2 on t1(c2,c3) global partition by hash(c3) partitions 2;
|
||||
--source mysql_test/include/check_all_idx_ok.inc
|
||||
--disable_query_log
|
||||
--let $count = 1
|
||||
while($count <= 10)
|
||||
{
|
||||
--let $stmt=insert into t1(c1, c2, c3, c4) values ($count, $count+1, $count+2, $count+3)
|
||||
eval $stmt;
|
||||
inc $count;
|
||||
}
|
||||
--enable_query_log
|
||||
## test full scan
|
||||
select /*+index(t1 primary)*/ c2, c3 from t1 order by c2;
|
||||
select /*+index(t1 gkey1)*/ c2, c3 from t1 order by c2;
|
||||
select /*+index(t1 gkey2)*/ c2, c3 from t1 order by c2;
|
||||
|
||||
select /*+index(t1 primary)*/ * from t1 order by c1;
|
||||
select /*+index(t1 gkey1)*/ * from t1 order by c1;
|
||||
select /*+index(t1 gkey2)*/ * from t1 order by c1;
|
||||
## test where statement
|
||||
select /*+index(t1 primary)*/ c2, c3 from t1 where c2 < 10 order by c2;
|
||||
select /*+index(t1 gkey1)*/ c2, c3 from t1 where c2 < 10 order by c2;
|
||||
select /*+index(t1 gkey2)*/ c2, c3 from t1 where c2 < 10 order by c2;
|
||||
|
||||
select /*+index(t1 primary)*/ * from t1 where c2 < 10 order by c1;
|
||||
select /*+index(t1 gkey1)*/ * from t1 where c2 < 10 order by c1;
|
||||
select /*+index(t1 gkey2)*/ * from t1 where c2 < 10 order by c1;
|
||||
|
||||
select /*+index(t1 primary)*/ * from t1 where c4 < 6 order by c1;
|
||||
select /*+index(t1 gkey1)*/ * from t1 where c4 < 6 order by c1;
|
||||
select /*+index(t1 gkey2)*/ * from t1 where c4 < 6 order by c1;
|
||||
|
||||
select /*+index(t1 primary)*/ * from t1 where c2 < 10 and c4 < 6 order by c1;
|
||||
select /*+index(t1 gkey1)*/ * from t1 where c2 < 10 and c4 < 6 order by c1;
|
||||
select /*+index(t1 gkey2)*/ * from t1 where c2 < 10 and c4 < 6 order by c1;
|
||||
|
||||
select /*+index(t1 primary)*/ * from t1 where c2 < 10 and c4 < 6 and c3 + c4 < 10 order by c1;
|
||||
select /*+index(t1 gkey1)*/ * from t1 where c2 < 10 and c4 < 6 and c3 + c4 < 10 order by c1;
|
||||
select /*+index(t1 gkey2)*/ * from t1 where c2 < 10 and c4 < 6 and c3 + c4 < 10 order by c1;
|
||||
|
||||
## test group by statement
|
||||
select /*+index(t1 primary)*/ c2, sum(c3) from t1 where c2 < 10 group by c1;
|
||||
select /*+index(t1 gkey1)*/ c2, sum(c3) from t1 where c2 < 10 group by c1;
|
||||
select /*+index(t1 gkey2)*/ c2, sum(c3) from t1 where c2 < 10 group by c1;
|
||||
|
||||
select /*+index(t1 primary)*/ c2, sum(c3) from t1 where c2 < 10 group by c2 having sum(c3) > 5 order by c2;
|
||||
select /*+index(t1 gkey1)*/ c2, sum(c3) from t1 where c2 < 10 group by c2 having sum(c3) > 5 order by c2;
|
||||
select /*+index(t1 gkey2)*/ c2, sum(c3) from t1 where c2 < 10 group by c2 having sum(c3) > 5 order by c2;
|
||||
|
||||
select /*+index(t1 primary)*/ c2, sum(c3) from t1 where c2 < 10 group by c4 having sum(c4) > 6 order by c4;
|
||||
select /*+index(t1 gkey1)*/ c2, sum(c3) from t1 where c2 < 10 group by c4 having sum(c4) > 6 order by c4;
|
||||
select /*+index(t1 gkey2)*/ c2, sum(c3) from t1 where c2 < 10 group by c4 having sum(c4) > 6 order by c4;
|
||||
|
||||
##test distinct statement
|
||||
select /*+index(t1 primary)*/ distinct c2, c3 from t1 where c2 < 10 order by c2;
|
||||
select /*+index(t1 gkey1)*/ distinct c2, c3 from t1 where c2 < 10 order by c2;
|
||||
select /*+index(t1 gkey2)*/ distinct c2, c3 from t1 where c2 < 10 order by c2;
|
||||
|
||||
select /*+index(t1 primary)*/ distinct c2, c3 from t1 where c2 < 10 order by c1;
|
||||
select /*+index(t1 gkey1)*/ distinct c2, c3 from t1 where c2 < 10 order by c1;
|
||||
select /*+index(t1 gkey2)*/ distinct c2, c3 from t1 where c2 < 10 order by c1;
|
||||
|
||||
select /*+index(t1 primary)*/ distinct c2, c3, c4 from t1 where c2 < 10 order by c1;
|
||||
select /*+index(t1 gkey1)*/ distinct c2, c3, c4 from t1 where c2 < 10 order by c1;
|
||||
select /*+index(t1 gkey2)*/ distinct c2, c3, c4 from t1 where c2 < 10 order by c1;
|
||||
|
||||
## test order by statement
|
||||
select /*+index(t1 primary)*/ c2, c3 from t1 order by c2;
|
||||
select /*+index(t1 gkey1)*/ c2, c3 from t1 order by c2;
|
||||
select /*+index(t1 gkey2)*/ c2, c3 from t1 order by c2;
|
||||
|
||||
select /*+index(t1 primary)*/ * from t1 order by c2;
|
||||
select /*+index(t1 gkey1)*/ * from t1 order by c2;
|
||||
select /*+index(t1 gkey2)*/ * from t1 order by c2;
|
||||
|
||||
select /*+index(t1 primary)*/ * from t1 order by c2, c3;
|
||||
select /*+index(t1 gkey1)*/ * from t1 order by c2, c3;
|
||||
select /*+index(t1 gkey2)*/ * from t1 order by c2, c3;
|
||||
|
||||
select /*+index(t1 primary)*/ * from t1 order by c3;
|
||||
select /*+index(t1 gkey1)*/ * from t1 order by c3;
|
||||
select /*+index(t1 gkey2)*/ * from t1 order by c3;
|
||||
|
||||
## test limit statement
|
||||
select /*+index(t1 primary)*/ c2, c3 from t1 order by c2 limit 3;
|
||||
select /*+index(t1 gkey1)*/ c2, c3 from t1 order by c2 limit 3;
|
||||
select /*+index(t1 gkey2)*/ c2, c3 from t1 order by c2 limit 3;
|
||||
|
||||
select /*+index(t1 primary)*/ * from t1 order by c2 limit 3;
|
||||
select /*+index(t1 gkey1)*/ * from t1 order by c2 limit 3;
|
||||
select /*+index(t1 gkey2)*/ * from t1 order by c2 limit 3;
|
||||
|
||||
select /*+index(t1 primary)*/ * from t1 order by c2, c3 limit 3;
|
||||
select /*+index(t1 gkey1)*/ * from t1 order by c2, c3 limit 3;
|
||||
select /*+index(t1 gkey2)*/ * from t1 order by c2, c3 limit 3;
|
||||
|
||||
##test scala group by
|
||||
select /*+index(t1 primary)*/ count(*) from t1;
|
||||
select /*+index(t1 gkey1)*/ count(*) from t1;
|
||||
select /*+index(t1 gkey2)*/ count(*) from t1;
|
||||
drop table if exists t1;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1(a int, b int, c int, d int, primary key(a,b)) partition by hash(a) partitions 3;
|
||||
create unique index idx on t1(c) partition by hash(c) partitions 5;
|
||||
--source mysql_test/include/check_all_idx_ok.inc
|
||||
insert into t1 values (1,1,1,1),(2,2,2,2),(3,3,3,3);
|
||||
--sleep 1
|
||||
update t1 set d=d+1 where (a,b)>=(1,1) and c=1;
|
||||
drop table if exists t1;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists obright_part;
|
||||
--enable_warnings
|
||||
create table obright_part(grp_id bigint, row_id bigint, row_hex varchar(2048), trx_grp bigint,
|
||||
v1 varchar(65536), v1_check bigint, v2 varchar(65536), v2_check bigint, r1 int, r2 int, glike varchar(4096),
|
||||
c1 bigint, c2 bigint, c3 bigint, c4 bigint, c5 bigint, c6 tinyint, c7 bigint, c8 bigint, c9 bigint, c10 bigint, v3 varchar(1024),
|
||||
ts timestamp(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), t1 timestamp(6) null, t2 datetime(6),
|
||||
dec1 decimal(16,4), dec2 decimal(16,4), dec3 decimal(16,6),
|
||||
b1 boolean, d1 bigint default 0, ac1 bigint auto_increment, gmt_create timestamp(6) default now(6), gmt_modified timestamp(6) default now(6),
|
||||
gen_v1 varchar(10) GENERATED ALWAYS AS (substr(v1,1,10)) virtual,
|
||||
gen_v2 varchar(10) GENERATED ALWAYS AS (substr(v1,1,10)) stored,
|
||||
primary key(grp_id, row_id, row_hex),
|
||||
index obright_part2(trx_grp,row_id, ac1) LOCAL,
|
||||
index obright_part3(glike) LOCAL,
|
||||
index obright_part4(t1,ts,dec1,dec2) storing(v1,v1_check,r1,r2) LOCAL,
|
||||
index obright_part5(v1_check,v2_check) LOCAL,
|
||||
index obright_part6(row_hex,v1_check) storing(glike,t1,r1) LOCAL,
|
||||
unique index obright_part1_uniq(t1,grp_id,row_id,row_hex) LOCAL,
|
||||
unique index obright_part2_uniq(trx_grp,r1,row_hex,row_id,grp_id) LOCAL,
|
||||
unique index obright_part3_uniq(row_hex,grp_id,row_id) LOCAL)
|
||||
partition by key (grp_id) partitions 2;
|
||||
|
||||
create index obright_part1 on obright_part(row_id) global partition by HASH(row_id) partitions 2;
|
||||
--source mysql_test/include/check_all_idx_ok.inc
|
||||
select grp_id, max(row_id), max(row_hex), max(trx_grp), abs(row_id)%2 as row_id_mod from obright_part where grp_id=6447+length('a')-1 group by row_id_mod order by row_id_mod desc limit 1;
|
||||
drop table if exists obright_part;
|
||||
@ -0,0 +1,411 @@
|
||||
drop table if exists t1, t2, t3, t4, t5;
|
||||
create table t1(c1 int primary key, c2 int, c3 varchar(10));
|
||||
create table t2(c1 int primary key,
|
||||
c2 int,
|
||||
c3 varchar(10))
|
||||
partition by key(c1) partitions 5;
|
||||
create table t3(c1 int primary key, c2 datetime default now());
|
||||
insert into t1 values(1, 1, 'abc');
|
||||
insert into t1 values(2, 1, 'def');
|
||||
insert into t1 values(3, 2, 'ghi');
|
||||
insert into t1 values(4, 3, 'jkl');
|
||||
insert into t1 values(5, 4, 'mno');
|
||||
insert into t2 values(0, 1, 'beijing');
|
||||
insert into t2 values(10, 2, 'beijing');
|
||||
insert into t2 values(11, 3, 'beijing');
|
||||
insert into t2 values(1, 1, 'hangzhou');
|
||||
insert into t2 values(2, 1, 'hangzhou');
|
||||
insert into t2 values(3, 1, 'shanghai');
|
||||
insert into t2 values(5, 1, 'tianjin');
|
||||
select c1, sum(c2), count(c2), avg(c2), max(c2), min(c2) from t1 group by c1;
|
||||
c1 sum(c2) count(c2) avg(c2) max(c2) min(c2)
|
||||
1 1 1 1.0000 1 1
|
||||
2 1 1 1.0000 1 1
|
||||
3 2 1 2.0000 2 2
|
||||
4 3 1 3.0000 3 3
|
||||
5 4 1 4.0000 4 4
|
||||
select c2, sum(c1), count(c1), avg(c1), max(c1), min(c1) from t1 group by c2;
|
||||
c2 sum(c1) count(c1) avg(c1) max(c1) min(c1)
|
||||
1 3 2 1.5000 2 1
|
||||
2 3 1 3.0000 3 3
|
||||
3 4 1 4.0000 4 4
|
||||
4 5 1 5.0000 5 5
|
||||
select c2, sum(c1), count(c2), avg(c2), max(c1), min(c1) from t1 group by c3;
|
||||
c2 sum(c1) count(c2) avg(c2) max(c1) min(c1)
|
||||
1 1 1 1.0000 1 1
|
||||
1 2 1 1.0000 2 2
|
||||
2 3 1 2.0000 3 3
|
||||
3 4 1 3.0000 4 4
|
||||
4 5 1 4.0000 5 5
|
||||
select c1, sum(c2), count(c2), avg(c2), max(c2), min(c2) from t2 group by c1;
|
||||
c1 sum(c2) count(c2) avg(c2) max(c2) min(c2)
|
||||
0 1 1 1.0000 1 1
|
||||
1 1 1 1.0000 1 1
|
||||
10 2 1 2.0000 2 2
|
||||
11 3 1 3.0000 3 3
|
||||
2 1 1 1.0000 1 1
|
||||
3 1 1 1.0000 1 1
|
||||
5 1 1 1.0000 1 1
|
||||
select c2, sum(c1), count(c1), avg(c1), max(c1), min(c1) from t2 group by c2;
|
||||
c2 sum(c1) count(c1) avg(c1) max(c1) min(c1)
|
||||
1 11 5 2.2000 5 0
|
||||
2 10 1 10.0000 10 10
|
||||
3 11 1 11.0000 11 11
|
||||
select c3, sum(c1), count(c1), avg(c1), max(c2), min(c1) from t2 group by c3;
|
||||
c3 sum(c1) count(c1) avg(c1) max(c2) min(c1)
|
||||
beijing 21 3 7.0000 3 0
|
||||
hangzhou 3 2 1.5000 1 1
|
||||
shanghai 3 1 3.0000 1 3
|
||||
tianjin 5 1 5.0000 1 5
|
||||
select max(c1), count(*) from t1;
|
||||
max(c1) count(*)
|
||||
5 5
|
||||
select min(c2), count(*) from t2;
|
||||
min(c2) count(*)
|
||||
1 7
|
||||
select c1, c2, count(c2) from t1 group by c1, c2, c3;
|
||||
c1 c2 count(c2)
|
||||
1 1 1
|
||||
2 1 1
|
||||
3 2 1
|
||||
4 3 1
|
||||
5 4 1
|
||||
select c1, c2, count(c2) from t1 group by 1, 2;
|
||||
c1 c2 count(c2)
|
||||
1 1 1
|
||||
2 1 1
|
||||
3 2 1
|
||||
4 3 1
|
||||
5 4 1
|
||||
select c1 as id, max(c2) from t1 group by id;
|
||||
id max(c2)
|
||||
1 1
|
||||
2 1
|
||||
3 2
|
||||
4 3
|
||||
5 4
|
||||
select sum(c1) + sum(c2) from t1 group by c3;
|
||||
sum(c1) + sum(c2)
|
||||
2
|
||||
3
|
||||
5
|
||||
7
|
||||
9
|
||||
select sum(c1 + c2) from t1 group by c3;
|
||||
sum(c1 + c2)
|
||||
2
|
||||
3
|
||||
5
|
||||
7
|
||||
9
|
||||
select c1, c2, c3, count(*) from t1 group by c1, c2, c3;
|
||||
c1 c2 c3 count(*)
|
||||
1 1 abc 1
|
||||
2 1 def 1
|
||||
3 2 ghi 1
|
||||
4 3 jkl 1
|
||||
5 4 mno 1
|
||||
select * from t1 group by -1;
|
||||
c1 c2 c3
|
||||
1 1 abc
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 int primary key, c2 varchar(100), c3 varchar(100), c4 int, c5 varchar(100));
|
||||
insert into t1 values (1, 'a', 'bc', 21, 'g1'), (2, 'ab', 'c', 22, 'g1'), (3, 'a2', 'b3', 24, 'g2'), (4, 'a1', 'b3', 24, 'g2'), (5, 'a3', 'b2', 25, 'g2');
|
||||
select group_concat(c2, c3) from t1;
|
||||
group_concat(c2, c3)
|
||||
abc,abc,a2b3,a1b3,a3b2
|
||||
select group_concat(distinct c2, c3) from t1;
|
||||
group_concat(distinct c2, c3)
|
||||
abc,a1b3,a2b3,a3b2,abc
|
||||
select group_concat(c2, c3 order by c2) from t1;
|
||||
group_concat(c2, c3 order by c2)
|
||||
abc,a1b3,a2b3,a3b2,abc
|
||||
select group_concat(c2, c3 order by c3) from t1;
|
||||
group_concat(c2, c3 order by c3)
|
||||
a3b2,a2b3,a1b3,abc,abc
|
||||
select group_concat(c2, c3 order by c3 desc, c2 asc) from t1;
|
||||
group_concat(c2, c3 order by c3 desc, c2 asc)
|
||||
abc,abc,a1b3,a2b3,a3b2
|
||||
select group_concat(distinct c2, c3 order by c3 desc, c2 asc) from t1;
|
||||
group_concat(distinct c2, c3 order by c3 desc, c2 asc)
|
||||
abc,abc,a1b3,a2b3,a3b2
|
||||
select group_concat(distinct c2, c3 order by 2 desc, 1 asc) from t1;
|
||||
group_concat(distinct c2, c3 order by 2 desc, 1 asc)
|
||||
abc,abc,a1b3,a2b3,a3b2
|
||||
select group_concat(c2, c3) from t1 group by c5;
|
||||
group_concat(c2, c3)
|
||||
a2b3,a1b3,a3b2
|
||||
abc,abc
|
||||
select group_concat(distinct c2, c3) from t1 group by c5;
|
||||
group_concat(distinct c2, c3)
|
||||
abc,abc
|
||||
a1b3,a2b3,a3b2
|
||||
select group_concat(c2, c3 order by c1) from t1 group by c5;
|
||||
group_concat(c2, c3 order by c1)
|
||||
a2b3,a1b3,a3b2
|
||||
abc,abc
|
||||
select group_concat(c2, c3 order by c2) from t1 group by c5;
|
||||
group_concat(c2, c3 order by c2)
|
||||
a1b3,a2b3,a3b2
|
||||
abc,abc
|
||||
select group_concat(c2, c3 order by c3) from t1 group by c5;
|
||||
group_concat(c2, c3 order by c3)
|
||||
a3b2,a2b3,a1b3
|
||||
abc,abc
|
||||
select group_concat(c2, c3 order by c4 desc) from t1 group by c5;
|
||||
group_concat(c2, c3 order by c4 desc)
|
||||
a3b2,a2b3,a1b3
|
||||
abc,abc
|
||||
select group_concat(c2, c3 order by c3 desc, c2 asc) from t1 group by c5;
|
||||
group_concat(c2, c3 order by c3 desc, c2 asc)
|
||||
a1b3,a2b3,a3b2
|
||||
abc,abc
|
||||
select group_concat(distinct c2, c3 order by c3 desc, c2 asc) from t1 group by c5;
|
||||
group_concat(distinct c2, c3 order by c3 desc, c2 asc)
|
||||
a1b3,a2b3,a3b2
|
||||
abc,abc
|
||||
select group_concat(distinct c2, c3 order by 2 desc, 1 asc) from t1 group by c5;
|
||||
group_concat(distinct c2, c3 order by 2 desc, 1 asc)
|
||||
a1b3,a2b3,a3b2
|
||||
abc,abc
|
||||
select min(c2), max(c3), count(*), count(c1), avg(c4), group_concat(distinct c2, c3 order by 2 desc, 1 asc) from t1 group by c5;
|
||||
min(c2) max(c3) count(*) count(c1) avg(c4) group_concat(distinct c2, c3 order by 2 desc, 1 asc)
|
||||
a c 2 2 21.5000 abc,abc
|
||||
a1 b3 3 3 24.3333 a1b3,a2b3,a3b2
|
||||
select group_concat(c3, c4 order by c4 desc) from t1 group by c5;
|
||||
group_concat(c3, c4 order by c4 desc)
|
||||
b225,b324,b324
|
||||
c22,bc21
|
||||
select group_concat(distinct c3, c4 order by c4 desc) from t1 group by c5;
|
||||
group_concat(distinct c3, c4 order by c4 desc)
|
||||
c22,bc21
|
||||
b225,b324
|
||||
select group_concat(c4 order by 1 desc) from t1 group by c5;
|
||||
group_concat(c4 order by 1 desc)
|
||||
22,21
|
||||
25,24,24
|
||||
select group_concat(distinct c4 order by 1 desc) from t1 group by c5;
|
||||
group_concat(distinct c4 order by 1 desc)
|
||||
22,21
|
||||
25,24
|
||||
select group_concat(distinct c4 order by c4 desc separator 'AAA') from t1 group by c5;
|
||||
group_concat(distinct c4 order by c4 desc separator 'AAA')
|
||||
22AAA21
|
||||
25AAA24
|
||||
select group_concat(distinct c4 order by 1 desc separator '#') from t1 group by c5;
|
||||
group_concat(distinct c4 order by 1 desc separator '#')
|
||||
22#21
|
||||
25#24
|
||||
select group_concat(distinct c2, c3 order by c3 asc, c2 desc separator '%%') from t1 group by c5;
|
||||
group_concat(distinct c2, c3 order by c3 asc, c2 desc separator '%%')
|
||||
abc%%abc
|
||||
a3b2%%a2b3%%a1b3
|
||||
select group_concat(c2, c3 order by c4 desc separator '*') from t1 group by c5;
|
||||
group_concat(c2, c3 order by c4 desc separator '*')
|
||||
abc*abc
|
||||
a3b2*a2b3*a1b3
|
||||
select group_concat(c2 separator '\\') from t1;
|
||||
group_concat(c2 separator '\\')
|
||||
a\ab\a2\a1\a3
|
||||
select group_concat(c2, c3 separator '\\') from t1;
|
||||
group_concat(c2, c3 separator '\\')
|
||||
abc\abc\a2b3\a1b3\a3b2
|
||||
drop table if exists t2;
|
||||
create table t2 (c1 int primary key, c2 varchar(100), c3 varchar(100), c4 varchar(100));
|
||||
insert into t2 values (1, 'd1', 's1', 'g1'), (2, 'd2', NULL, 'g1'), (3, NULL, 's3', 'g1'), (4, 'd4', 's4', 'g1'), (5, 'd5', NULL, 'g2'), (6, NULL, 's6', 'g2'), (7, NULL, NULL, 'g3'), (8, '', '', 'g4');
|
||||
select group_concat(c2, c3) from t2;
|
||||
group_concat(c2, c3)
|
||||
d1s1,d4s4,
|
||||
select group_concat(c2, c3) from t2 group by c4;
|
||||
group_concat(c2, c3)
|
||||
|
||||
NULL
|
||||
NULL
|
||||
d1s1,d4s4
|
||||
select group_concat(c2) from t2 group by c4;
|
||||
group_concat(c2)
|
||||
|
||||
NULL
|
||||
d1,d2,d4
|
||||
d5
|
||||
select @@group_concat_max_len;
|
||||
@@group_concat_max_len
|
||||
1024
|
||||
set group_concat_max_len = 7;
|
||||
select @@group_concat_max_len;
|
||||
@@group_concat_max_len
|
||||
7
|
||||
select group_concat(c2, c3) from t2;
|
||||
group_concat(c2, c3)
|
||||
d1s1,d4
|
||||
Warnings:
|
||||
Warning 1260 Row 2 was cut by GROUP_CONCAT()
|
||||
select group_concat(c2) from t2 group by c4;
|
||||
group_concat(c2)
|
||||
|
||||
NULL
|
||||
d1,d2,d
|
||||
d5
|
||||
Warnings:
|
||||
Warning 1260 Row 3 was cut by GROUP_CONCAT()
|
||||
select group_concat(c2, c3) from t2 group by c4;
|
||||
group_concat(c2, c3)
|
||||
|
||||
NULL
|
||||
NULL
|
||||
d1s1,d4
|
||||
Warnings:
|
||||
Warning 1260 Row 2 was cut by GROUP_CONCAT()
|
||||
set group_concat_max_len = 10;
|
||||
select @@group_concat_max_len;
|
||||
@@group_concat_max_len
|
||||
10
|
||||
select group_concat(c2, c3) from t2;
|
||||
group_concat(c2, c3)
|
||||
d1s1,d4s4,
|
||||
set group_concat_max_len = 9;
|
||||
select group_concat(c2, c3) from t2 group by c4;
|
||||
group_concat(c2, c3)
|
||||
|
||||
NULL
|
||||
NULL
|
||||
d1s1,d4s4
|
||||
select @@group_concat_max_len;
|
||||
@@group_concat_max_len
|
||||
9
|
||||
set group_concat_max_len = default;
|
||||
select @@group_concat_max_len;
|
||||
@@group_concat_max_len
|
||||
1024
|
||||
select group_concat(c2, c3) from t2;
|
||||
group_concat(c2, c3)
|
||||
d1s1,d4s4,
|
||||
select group_concat(c2) from t2 group by c4;
|
||||
group_concat(c2)
|
||||
|
||||
NULL
|
||||
d1,d2,d4
|
||||
d5
|
||||
select group_concat(c2, c3) from t2 group by c4;
|
||||
group_concat(c2, c3)
|
||||
|
||||
NULL
|
||||
NULL
|
||||
d1s1,d4s4
|
||||
drop table if exists t3;
|
||||
create table t3(c1 int, c2 timestamp(4));
|
||||
insert into t3 values(1,'2015-01-01 12:12:12'), (2, '2015-01-02 12:12:33.333333');
|
||||
select * from t3;
|
||||
c1 c2
|
||||
1 2015-01-01 12:12:12.0000
|
||||
2 2015-01-02 12:12:33.3333
|
||||
select group_concat(c1,c2) from t3;
|
||||
group_concat(c1,c2)
|
||||
12015-01-01 12:12:12.0000,22015-01-02 12:12:33.3333
|
||||
drop table if exists t4;
|
||||
create table t4 (c1 int primary key, c2 varchar(100) charset utf8mb4 collate utf8mb4_bin, c3 varchar(50) charset utf8mb4 collate utf8mb4_general_ci);
|
||||
insert into t4 values (1, 'a', 'a'), (2, 'A', 'A'), (3, 'B', 'B'), (4, 'b', 'b');
|
||||
select group_concat(c2 order by c2) from t4;
|
||||
group_concat(c2 order by c2)
|
||||
A,B,a,b
|
||||
select group_concat(c3 order by c3) from t4;
|
||||
group_concat(c3 order by c3)
|
||||
a,A,B,b
|
||||
select group_concat(distinct c2) from t4;
|
||||
group_concat(distinct c2)
|
||||
A,B,a,b
|
||||
select group_concat(distinct c3) from t4;
|
||||
group_concat(distinct c3)
|
||||
a,B
|
||||
select collation(group_concat(c1)), collation(group_concat(c2)), collation(group_concat(c3)) from t4;
|
||||
collation(group_concat(c1)) collation(group_concat(c2)) collation(group_concat(c3))
|
||||
utf8mb4_general_ci utf8mb4_bin utf8mb4_general_ci
|
||||
create table t5(c1 int primary key, c2 int, c3 varchar(100), c4 int) partition by hash(c1) partitions 2;
|
||||
insert into t5 values (1, 21, 'a', 1);
|
||||
insert into t5 values (2, 22, 'b', 2);
|
||||
insert into t5 values (3, 23, 'c', 1);
|
||||
insert into t5 values (4, 24, 'd', 1);
|
||||
insert into t5 values (5, 25, 'e', 1);
|
||||
select count(c2), group_concat(c3 order by c3 desc), max(c1) from t5 group by c4;
|
||||
count(c2) group_concat(c3 order by c3 desc) max(c1)
|
||||
1 b 2
|
||||
4 e,d,c,a 5
|
||||
set @bug7726379 = 1;
|
||||
select group_concat(@bug7726379 order by 1);
|
||||
group_concat(@bug7726379 order by 1)
|
||||
1
|
||||
select group_concat(@bug7726379 order by @bug7726379);
|
||||
group_concat(@bug7726379 order by @bug7726379)
|
||||
1
|
||||
select group_concat(3 order by 1);
|
||||
group_concat(3 order by 1)
|
||||
3
|
||||
select group_concat(3 + 2 order by 1);
|
||||
group_concat(3 + 2 order by 1)
|
||||
5
|
||||
drop table t1, t2;
|
||||
create table t1(c1 int, c2 int);
|
||||
create table t2(a int, b int);
|
||||
select distinct (select max(a) from t1 where alias.b = a) as field1 from t2 as alias group by field1;
|
||||
ERROR 42000: Can't group on 'field1'
|
||||
drop table t1;
|
||||
create table t1 (c1 int, c2 int, c3 int);
|
||||
insert into t1 (c1, c2, c3) values (1, 1, 1);
|
||||
insert into t1 (c1, c2, c3) values (1, 2, 2);
|
||||
insert into t1 (c1, c2, c3) values (1, 2, 2);
|
||||
insert into t1 (c1, c2, c3) values (1, 2, 3);
|
||||
insert into t1 (c1, c2, c3) values (2, 1, 2);
|
||||
insert into t1 (c1, c2, c3) values (2, 3, 2);
|
||||
insert into t1 (c1, c2, c3) values (2, 3, 2);
|
||||
insert into t1 (c1, c2, c3) values (2, 3, 3);
|
||||
select c2, avg(distinct c3) from t1 group by c2;
|
||||
c2 avg(distinct c3)
|
||||
1 1.5000
|
||||
2 2.5000
|
||||
3 2.5000
|
||||
select c1,c2, group_concat(distinct c3 order by c3 desc) from t1 group by c1,c2;
|
||||
c1 c2 group_concat(distinct c3 order by c3 desc)
|
||||
1 1 1
|
||||
1 2 3,2
|
||||
2 1 2
|
||||
2 3 3,2
|
||||
select c1,c2, group_concat(distinct c3 order by c3 desc) from t1 group by c1,c2 with rollup;
|
||||
c1 c2 group_concat(distinct c3 order by c3 desc)
|
||||
1 1 1
|
||||
1 2 3,2
|
||||
1 NULL 3,2,1
|
||||
2 1 2
|
||||
2 3 3,2
|
||||
2 NULL 3,2
|
||||
NULL NULL 3,2,1
|
||||
drop table t1, t2, t3, t4, t5;
|
||||
drop table if exists t1, t2;
|
||||
drop table if exists `rpup_list_mcs_asoc_b`, `bidprcu_mcs_regcert_b`, `rpup_mcs_list_info_b`;
|
||||
create table t1(c1 int, c2 int);
|
||||
create table t2(c1 int, c2 int);
|
||||
insert into t1 values (1, 1);
|
||||
insert into t2 values (2, 2);
|
||||
CREATE TABLE `rpup_list_mcs_asoc_b` ( `LIST_MCS_ASOC_ID` varchar(40) NOT NULL COMMENT '目录耗材关联ID', `RPUP_CNT_ITEM_ID` varchar(40) DEFAULT NULL COMMENT '报量项目ID', `MCS_LIST_ID` varchar(40) DEFAULT NULL COMMENT '耗材目录ID', `MCS_REGNO` varchar(100) DEFAULT NULL COMMENT '耗材注册证编号', `MCS_CODE` varchar(100) DEFAULT NULL COMMENT '耗材代码', `MCS_NAME` varchar(500) DEFAULT NULL COMMENT '耗材名称', `MCS_MOL` varchar(500) DEFAULT NULL COMMENT '耗材型号', `RID` varchar(40) NOT NULL DEFAULT '' COMMENT '数据唯一记录号', `CRTER_ID` varchar(20) DEFAULT NULL COMMENT '创建人ID', `CRTER_NAME` varchar(50) DEFAULT NULL COMMENT '创建人姓名', `CRTE_OPTINS_NO` varchar(20) DEFAULT NULL COMMENT '创建机构编号', `CRTE_TIME` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '数据创建时间', `OPTER_ID` varchar(20) DEFAULT NULL COMMENT '经办人ID', `OPTER_NAME` varchar(50) DEFAULT NULL COMMENT '经办人姓名', `OPTINS_NO` varchar(20) DEFAULT NULL COMMENT '经办机构编号', `UPDT_TIME` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '数据更新时间', `INVD_FLAG` varchar(3) NOT NULL DEFAULT '0' COMMENT '无效标志', PRIMARY KEY (`LIST_MCS_ASOC_ID`) USING BTREE, KEY `IDX_RPUP_LIST_MCS_ASOC_B_1` (`RPUP_CNT_ITEM_ID`) USING BTREE, KEY `IDX_RPUP_LIST_MCS_ASOC_B_2` (`MCS_LIST_ID`) USING BTREE, KEY `IDX_RPUP_LIST_MCS_ASOC_B_3` (`MCS_CODE`) USING BTREE, KEY `IDX_RPUP_LIST_MCS_ASOC_B_4` (`MCS_REGNO`) USING BTREE );
|
||||
CREATE TABLE `bidprcu_mcs_regcert_b` ( `MCS_REGCERT_ID` varchar(40) NOT NULL COMMENT '耗材注册证ID', `MCS_REGNO` varchar(100) NOT NULL DEFAULT '' COMMENT '耗材注册证编号', `MCS_REGCERT_NAME` varchar(200) NOT NULL DEFAULT '' COMMENT '耗材注册证名称', `REGCERT_EXPY_BEGNTIME` datetime NOT NULL DEFAULT '1970-01-01 08:00:00' COMMENT '注册证有效期开始时间', `REGCERT_EXPY_ENDTIME` datetime NOT NULL DEFAULT '1970-01-01 08:00:00' COMMENT '注册证有效期结束时间', `PRODENTP_CODE` varchar(50) NOT NULL DEFAULT '' COMMENT '生产企业代码', `PRODENTP_NAME` varchar(200) NOT NULL DEFAULT '' COMMENT '生产企业名称', `PRXY_ENTP_CODE` varchar(50) NOT NULL DEFAULT '' COMMENT '代理企业代码', `PRXY_ENTP_NAME` varchar(200) NOT NULL DEFAULT '' COMMENT '代理企业名称', `MGT_TYPE_CODE` varchar(10) NOT NULL DEFAULT '' COMMENT '管理类别代码', `REGCERT_FILE_ID` varchar(500) NOT NULL DEFAULT '' COMMENT '注册证文件ID', `MANL_FILE_ID` varchar(500) DEFAULT NULL COMMENT '说明书文件ID', `OTH_FILE_ID` varchar(500) NOT NULL DEFAULT '' COMMENT '其他文件ID', `RID` varchar(40) NOT NULL DEFAULT '' COMMENT '数据唯一记录号', `CRTER_ID` varchar(20) DEFAULT NULL COMMENT '创建人ID', `CRTER_NAME` varchar(50) DEFAULT NULL COMMENT '创建人姓名', `CRTE_OPTINS_NO` varchar(20) DEFAULT NULL COMMENT '创建机构编号', `CRTE_TIME` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '数据创建时间', `OPT_TIME` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '经办时间', `OPTER_ID` varchar(20) DEFAULT NULL COMMENT '经办人ID', `OPTER_NAME` varchar(50) DEFAULT NULL COMMENT '经办人姓名', `OPTINS_NO` varchar(20) DEFAULT NULL COMMENT '经办机构编号', `UPDT_TIME` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '数据更新时间', `INVD_FLAG` varchar(3) NOT NULL DEFAULT '0' COMMENT '无效标志', `MANU_ADDR` varchar(2048) DEFAULT NULL COMMENT '生产地址', `APB_SCP` longtext COMMENT '适用范围', `STRU_COMP` longtext COMMENT '结构及组成', `PROD_SOUC` varchar(3) DEFAULT NULL COMMENT '耗材来源', `PROD_SOUC_CODE` varchar(3) DEFAULT NULL COMMENT '耗材来源', `SPEC_MOL` longtext COMMENT '规格型号', `MEMO` longtext COMMENT '备注', PRIMARY KEY (`MCS_REGCERT_ID`) USING BTREE, KEY `IDX_BIDPRCU_MCS_REGCERT_B_1` (`MCS_REGNO`) USING BTREE );
|
||||
CREATE TABLE `rpup_mcs_list_info_b` ( `MCS_LIST_ID` varchar(40) NOT NULL COMMENT '耗材目录ID', `RPUP_CNT_ITEM_ID` varchar(40) DEFAULT NULL COMMENT '报量项目ID', `MCS_LIST_CODE` varchar(40) DEFAULT NULL COMMENT '耗材目录代码', `LV1_LIST_NAME` varchar(100) DEFAULT NULL COMMENT '一级目录名称', `LV2_LIST_NAME` varchar(100) DEFAULT NULL COMMENT '二级目录名称', `LV3_LIST_NAME` varchar(100) DEFAULT NULL COMMENT '三级目录名称', `GENNAME` varchar(100) DEFAULT NULL COMMENT '通用名', `MATL` varchar(100) DEFAULT NULL COMMENT '材质', `SPEC` varchar(200) DEFAULT NULL COMMENT '规格', `ISU_FLAG` varchar(3) DEFAULT NULL COMMENT '下发标志', `RID` varchar(40) NOT NULL DEFAULT '' COMMENT '数据唯一记录号', `CRTER_ID` varchar(20) DEFAULT NULL COMMENT '创建人ID', `CRTER_NAME` varchar(50) DEFAULT NULL COMMENT '创建人姓名', `CRTE_OPTINS_NO` varchar(20) DEFAULT NULL COMMENT '创建机构编号', `CRTE_TIME` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '数据创建时间', `OPTER_ID` varchar(20) DEFAULT NULL COMMENT '经办人ID', `OPTER_NAME` varchar(50) DEFAULT NULL COMMENT '经办人姓名', `OPTINS_NO` varchar(20) DEFAULT NULL COMMENT '经办机构编号', `UPDT_TIME` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '数据更新时间', `INVD_FLAG` varchar(3) NOT NULL DEFAULT '0' COMMENT '无效标志', PRIMARY KEY (`MCS_LIST_ID`) USING BTREE, KEY `IDX_RPUP_MCS_LIST_INFO_B_1` (`RPUP_CNT_ITEM_ID`) USING BTREE, KEY `IDX_RPUP_MCS_LIST_INFO_B_2` (`MCS_LIST_CODE`) USING BTREE, KEY `IDX_RPUP_MCS_LIST_INFO_B_3` (`GENNAME`) USING BTREE );
|
||||
SELECT rpup_list_mcs_asoc_b.LIST_MCS_ASOC_ID, rpup_list_mcs_asoc_b.RPUP_CNT_ITEM_ID, rpup_list_mcs_asoc_b.RPUP_CNT_ITEM_ID AS rupuCntItemId, rpup_list_mcs_asoc_b.MCS_REGNO,
|
||||
rpup_list_mcs_asoc_b.MCS_NAME, rpup_list_mcs_asoc_b.MCS_MOL, rpup_mcs_list_info_b.MCS_LIST_CODE, rpup_mcs_list_info_b.LV1_LIST_NAME,
|
||||
rpup_mcs_list_info_b.LV2_LIST_NAME, rpup_mcs_list_info_b.LV3_LIST_NAME, rpup_mcs_list_info_b.GENNAME, rpup_mcs_list_info_b.MATL,
|
||||
rpup_mcs_list_info_b.SPEC, bidprcu_mcs_regcert_b.PRODENTP_CODE, bidprcu_mcs_regcert_b.PRODENTP_NAME, rpup_list_mcs_asoc_b.RID, rpup_list_mcs_asoc_b.CRTER_ID,
|
||||
rpup_list_mcs_asoc_b.CRTER_NAME, rpup_list_mcs_asoc_b.CRTE_OPTINS_NO, rpup_list_mcs_asoc_b.CRTE_TIME, rpup_list_mcs_asoc_b.OPTER_ID,
|
||||
rpup_list_mcs_asoc_b.OPTER_NAME, rpup_list_mcs_asoc_b.OPTINS_NO, rpup_list_mcs_asoc_b.UPDT_TIME, rpup_list_mcs_asoc_b.INVD_FLAG
|
||||
FROM rpup_list_mcs_asoc_b LEFT JOIN bidprcu_mcs_regcert_b ON bidprcu_mcs_regcert_b.mcs_regno = rpup_list_mcs_asoc_b.MCS_REGNO
|
||||
LEFT JOIN rpup_mcs_list_info_b ON rpup_mcs_list_info_b.MCS_LIST_ID = rpup_list_mcs_asoc_b.MCS_LIST_ID
|
||||
WHERE rpup_list_mcs_asoc_b.INVD_FLAG = '0' AND rpup_mcs_list_info_b.INVD_FLAG = '0'
|
||||
AND rpup_list_mcs_asoc_b.RPUP_CNT_ITEM_ID = '1403980836851798017' AND bidprcu_mcs_regcert_b.PRODENTP_NAME IS NOT NULL
|
||||
GROUP BY MCS_LIST_CODE, MCS_REGNO, MCS_NAME, PRODENTP_NAME, MCS_MOL;
|
||||
LIST_MCS_ASOC_ID RPUP_CNT_ITEM_ID rupuCntItemId MCS_REGNO MCS_NAME MCS_MOL MCS_LIST_CODE LV1_LIST_NAME LV2_LIST_NAME LV3_LIST_NAME GENNAME MATL SPEC PRODENTP_CODE PRODENTP_NAME RID CRTER_ID CRTER_NAME CRTE_OPTINS_NO CRTE_TIME OPTER_ID OPTER_NAME OPTINS_NO UPDT_TIME INVD_FLAG
|
||||
select t1.c1 from t1, t2 group by c1;
|
||||
c1
|
||||
1
|
||||
select * from t1, t2 group by c1;
|
||||
ERROR 23000: Column 'c1' in group statement is ambiguous
|
||||
select 1 from t1, t2 group by c1;
|
||||
ERROR 23000: Column 'c1' in group statement is ambiguous
|
||||
drop table t1, t2;
|
||||
drop table `rpup_list_mcs_asoc_b`, `bidprcu_mcs_regcert_b`, `rpup_mcs_list_info_b`;
|
||||
258
tools/deploy/mysql_test/test_suite/groupby/t/group_by_basic.test
Normal file
258
tools/deploy/mysql_test/test_suite/groupby/t/group_by_basic.test
Normal file
@ -0,0 +1,258 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: guoping.wgp
|
||||
#owner group: sql1
|
||||
|
||||
##
|
||||
## Test Name: group_by_basic
|
||||
##
|
||||
## Scope: Test basic function of group-by operation
|
||||
##
|
||||
##
|
||||
## Date: 2015-9-16
|
||||
##
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1, t2, t3, t4, t5;
|
||||
--enable_warnings
|
||||
|
||||
## create tables
|
||||
create table t1(c1 int primary key, c2 int, c3 varchar(10));
|
||||
create table t2(c1 int primary key,
|
||||
c2 int,
|
||||
c3 varchar(10))
|
||||
partition by key(c1) partitions 5;
|
||||
create table t3(c1 int primary key, c2 datetime default now());
|
||||
|
||||
## generate data
|
||||
insert into t1 values(1, 1, 'abc');
|
||||
insert into t1 values(2, 1, 'def');
|
||||
insert into t1 values(3, 2, 'ghi');
|
||||
insert into t1 values(4, 3, 'jkl');
|
||||
insert into t1 values(5, 4, 'mno');
|
||||
|
||||
insert into t2 values(0, 1, 'beijing');
|
||||
insert into t2 values(10, 2, 'beijing');
|
||||
insert into t2 values(11, 3, 'beijing');
|
||||
insert into t2 values(1, 1, 'hangzhou');
|
||||
insert into t2 values(2, 1, 'hangzhou');
|
||||
insert into t2 values(3, 1, 'shanghai');
|
||||
insert into t2 values(5, 1, 'tianjin');
|
||||
|
||||
|
||||
|
||||
--sorted_result
|
||||
select c1, sum(c2), count(c2), avg(c2), max(c2), min(c2) from t1 group by c1;
|
||||
--sorted_result
|
||||
select c2, sum(c1), count(c1), avg(c1), max(c1), min(c1) from t1 group by c2;
|
||||
--sorted_result
|
||||
select c2, sum(c1), count(c2), avg(c2), max(c1), min(c1) from t1 group by c3;
|
||||
|
||||
--sorted_result
|
||||
select c1, sum(c2), count(c2), avg(c2), max(c2), min(c2) from t2 group by c1;
|
||||
select c2, sum(c1), count(c1), avg(c1), max(c1), min(c1) from t2 group by c2;
|
||||
|
||||
--sorted_result
|
||||
select c3, sum(c1), count(c1), avg(c1), max(c2), min(c1) from t2 group by c3;
|
||||
|
||||
select max(c1), count(*) from t1;
|
||||
select min(c2), count(*) from t2;
|
||||
|
||||
--sorted_result
|
||||
select c1, c2, count(c2) from t1 group by c1, c2, c3;
|
||||
--sorted_result
|
||||
select c1, c2, count(c2) from t1 group by 1, 2;
|
||||
--sorted_result
|
||||
select c1 as id, max(c2) from t1 group by id;
|
||||
--sorted_result
|
||||
select sum(c1) + sum(c2) from t1 group by c3;
|
||||
--sorted_result
|
||||
select sum(c1 + c2) from t1 group by c3;
|
||||
|
||||
--sorted_result
|
||||
select c1, c2, c3, count(*) from t1 group by c1, c2, c3;
|
||||
|
||||
select * from t1 group by -1;
|
||||
|
||||
|
||||
## group_concat
|
||||
|
||||
# basic
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1 (c1 int primary key, c2 varchar(100), c3 varchar(100), c4 int, c5 varchar(100));
|
||||
insert into t1 values (1, 'a', 'bc', 21, 'g1'), (2, 'ab', 'c', 22, 'g1'), (3, 'a2', 'b3', 24, 'g2'), (4, 'a1', 'b3', 24, 'g2'), (5, 'a3', 'b2', 25, 'g2');
|
||||
select group_concat(c2, c3) from t1;
|
||||
select group_concat(distinct c2, c3) from t1;
|
||||
select group_concat(c2, c3 order by c2) from t1;
|
||||
select group_concat(c2, c3 order by c3) from t1;
|
||||
select group_concat(c2, c3 order by c3 desc, c2 asc) from t1;
|
||||
select group_concat(distinct c2, c3 order by c3 desc, c2 asc) from t1;
|
||||
select group_concat(distinct c2, c3 order by 2 desc, 1 asc) from t1;
|
||||
|
||||
--sorted_result
|
||||
select group_concat(c2, c3) from t1 group by c5;
|
||||
select group_concat(distinct c2, c3) from t1 group by c5;
|
||||
--sorted_result
|
||||
select group_concat(c2, c3 order by c1) from t1 group by c5;
|
||||
--sorted_result
|
||||
select group_concat(c2, c3 order by c2) from t1 group by c5;
|
||||
--sorted_result
|
||||
select group_concat(c2, c3 order by c3) from t1 group by c5;
|
||||
--sorted_result
|
||||
select group_concat(c2, c3 order by c4 desc) from t1 group by c5;
|
||||
--sorted_result
|
||||
select group_concat(c2, c3 order by c3 desc, c2 asc) from t1 group by c5;
|
||||
--sorted_result
|
||||
select group_concat(distinct c2, c3 order by c3 desc, c2 asc) from t1 group by c5;
|
||||
--sorted_result
|
||||
select group_concat(distinct c2, c3 order by 2 desc, 1 asc) from t1 group by c5;
|
||||
select min(c2), max(c3), count(*), count(c1), avg(c4), group_concat(distinct c2, c3 order by 2 desc, 1 asc) from t1 group by c5;
|
||||
|
||||
--sorted_result
|
||||
select group_concat(c3, c4 order by c4 desc) from t1 group by c5;
|
||||
select group_concat(distinct c3, c4 order by c4 desc) from t1 group by c5;
|
||||
--sorted_result
|
||||
select group_concat(c4 order by 1 desc) from t1 group by c5;
|
||||
--sorted_result
|
||||
select group_concat(distinct c4 order by 1 desc) from t1 group by c5;
|
||||
|
||||
--sorted_result
|
||||
select group_concat(distinct c4 order by c4 desc separator 'AAA') from t1 group by c5;
|
||||
select group_concat(distinct c4 order by 1 desc separator '#') from t1 group by c5;
|
||||
select group_concat(distinct c2, c3 order by c3 asc, c2 desc separator '%%') from t1 group by c5;
|
||||
select group_concat(c2, c3 order by c4 desc separator '*') from t1 group by c5;
|
||||
select group_concat(c2 separator '\\') from t1;
|
||||
select group_concat(c2, c3 separator '\\') from t1;
|
||||
|
||||
# null and group_concat_max_len
|
||||
--disable_warnings
|
||||
drop table if exists t2;
|
||||
--enable_warnings
|
||||
create table t2 (c1 int primary key, c2 varchar(100), c3 varchar(100), c4 varchar(100));
|
||||
insert into t2 values (1, 'd1', 's1', 'g1'), (2, 'd2', NULL, 'g1'), (3, NULL, 's3', 'g1'), (4, 'd4', 's4', 'g1'), (5, 'd5', NULL, 'g2'), (6, NULL, 's6', 'g2'), (7, NULL, NULL, 'g3'), (8, '', '', 'g4');
|
||||
select group_concat(c2, c3) from t2;
|
||||
--sorted_result
|
||||
select group_concat(c2, c3) from t2 group by c4;
|
||||
--sorted_result
|
||||
select group_concat(c2) from t2 group by c4;
|
||||
select @@group_concat_max_len;
|
||||
set group_concat_max_len = 7;
|
||||
select @@group_concat_max_len;
|
||||
select group_concat(c2, c3) from t2;
|
||||
--sorted_result
|
||||
select group_concat(c2) from t2 group by c4;
|
||||
--sorted_result
|
||||
select group_concat(c2, c3) from t2 group by c4;
|
||||
set group_concat_max_len = 10;
|
||||
select @@group_concat_max_len;
|
||||
select group_concat(c2, c3) from t2;
|
||||
set group_concat_max_len = 9;
|
||||
--sorted_result
|
||||
select group_concat(c2, c3) from t2 group by c4;
|
||||
select @@group_concat_max_len;
|
||||
set group_concat_max_len = default;
|
||||
select @@group_concat_max_len;
|
||||
select group_concat(c2, c3) from t2;
|
||||
--sorted_result
|
||||
select group_concat(c2) from t2 group by c4;
|
||||
--sorted_result
|
||||
select group_concat(c2, c3) from t2 group by c4;
|
||||
|
||||
# scale
|
||||
--disable_warnings
|
||||
drop table if exists t3;
|
||||
--enable_warnings
|
||||
create table t3(c1 int, c2 timestamp(4));
|
||||
insert into t3 values(1,'2015-01-01 12:12:12'), (2, '2015-01-02 12:12:33.333333');
|
||||
select * from t3;
|
||||
select group_concat(c1,c2) from t3;
|
||||
|
||||
# collation
|
||||
--disable_warnings
|
||||
drop table if exists t4;
|
||||
--enable_warnings
|
||||
create table t4 (c1 int primary key, c2 varchar(100) charset utf8mb4 collate utf8mb4_bin, c3 varchar(50) charset utf8mb4 collate utf8mb4_general_ci);
|
||||
insert into t4 values (1, 'a', 'a'), (2, 'A', 'A'), (3, 'B', 'B'), (4, 'b', 'b');
|
||||
select group_concat(c2 order by c2) from t4;
|
||||
select group_concat(c3 order by c3) from t4;
|
||||
select group_concat(distinct c2) from t4;
|
||||
select group_concat(distinct c3) from t4;
|
||||
select collation(group_concat(c1)), collation(group_concat(c2)), collation(group_concat(c3)) from t4;
|
||||
|
||||
# pull down for distributed plan
|
||||
create table t5(c1 int primary key, c2 int, c3 varchar(100), c4 int) partition by hash(c1) partitions 2;
|
||||
insert into t5 values (1, 21, 'a', 1);
|
||||
insert into t5 values (2, 22, 'b', 2);
|
||||
insert into t5 values (3, 23, 'c', 1);
|
||||
insert into t5 values (4, 24, 'd', 1);
|
||||
insert into t5 values (5, 25, 'e', 1);
|
||||
--sorted_result
|
||||
select count(c2), group_concat(c3 order by c3 desc), max(c1) from t5 group by c4;
|
||||
|
||||
set @bug7726379 = 1;
|
||||
select group_concat(@bug7726379 order by 1);
|
||||
select group_concat(@bug7726379 order by @bug7726379);
|
||||
select group_concat(3 order by 1);
|
||||
select group_concat(3 + 2 order by 1);
|
||||
|
||||
drop table t1, t2;
|
||||
create table t1(c1 int, c2 int);
|
||||
create table t2(a int, b int);
|
||||
--error 1056
|
||||
select distinct (select max(a) from t1 where alias.b = a) as field1 from t2 as alias group by field1;
|
||||
|
||||
drop table t1;
|
||||
create table t1 (c1 int, c2 int, c3 int);
|
||||
insert into t1 (c1, c2, c3) values (1, 1, 1);
|
||||
insert into t1 (c1, c2, c3) values (1, 2, 2);
|
||||
insert into t1 (c1, c2, c3) values (1, 2, 2);
|
||||
insert into t1 (c1, c2, c3) values (1, 2, 3);
|
||||
insert into t1 (c1, c2, c3) values (2, 1, 2);
|
||||
insert into t1 (c1, c2, c3) values (2, 3, 2);
|
||||
insert into t1 (c1, c2, c3) values (2, 3, 2);
|
||||
insert into t1 (c1, c2, c3) values (2, 3, 3);
|
||||
|
||||
select c2, avg(distinct c3) from t1 group by c2;
|
||||
select c1,c2, group_concat(distinct c3 order by c3 desc) from t1 group by c1,c2;
|
||||
select c1,c2, group_concat(distinct c3 order by c3 desc) from t1 group by c1,c2 with rollup;
|
||||
|
||||
drop table t1, t2, t3, t4, t5;
|
||||
|
||||
## https://work.aone.alibaba-inc.com/issue/35012791
|
||||
--disable_warnings
|
||||
drop table if exists t1, t2;
|
||||
drop table if exists `rpup_list_mcs_asoc_b`, `bidprcu_mcs_regcert_b`, `rpup_mcs_list_info_b`;
|
||||
--enable_warnings
|
||||
|
||||
create table t1(c1 int, c2 int);
|
||||
create table t2(c1 int, c2 int);
|
||||
insert into t1 values (1, 1);
|
||||
insert into t2 values (2, 2);
|
||||
|
||||
CREATE TABLE `rpup_list_mcs_asoc_b` ( `LIST_MCS_ASOC_ID` varchar(40) NOT NULL COMMENT '目录耗材关联ID', `RPUP_CNT_ITEM_ID` varchar(40) DEFAULT NULL COMMENT '报量项目ID', `MCS_LIST_ID` varchar(40) DEFAULT NULL COMMENT '耗材目录ID', `MCS_REGNO` varchar(100) DEFAULT NULL COMMENT '耗材注册证编号', `MCS_CODE` varchar(100) DEFAULT NULL COMMENT '耗材代码', `MCS_NAME` varchar(500) DEFAULT NULL COMMENT '耗材名称', `MCS_MOL` varchar(500) DEFAULT NULL COMMENT '耗材型号', `RID` varchar(40) NOT NULL DEFAULT '' COMMENT '数据唯一记录号', `CRTER_ID` varchar(20) DEFAULT NULL COMMENT '创建人ID', `CRTER_NAME` varchar(50) DEFAULT NULL COMMENT '创建人姓名', `CRTE_OPTINS_NO` varchar(20) DEFAULT NULL COMMENT '创建机构编号', `CRTE_TIME` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '数据创建时间', `OPTER_ID` varchar(20) DEFAULT NULL COMMENT '经办人ID', `OPTER_NAME` varchar(50) DEFAULT NULL COMMENT '经办人姓名', `OPTINS_NO` varchar(20) DEFAULT NULL COMMENT '经办机构编号', `UPDT_TIME` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '数据更新时间', `INVD_FLAG` varchar(3) NOT NULL DEFAULT '0' COMMENT '无效标志', PRIMARY KEY (`LIST_MCS_ASOC_ID`) USING BTREE, KEY `IDX_RPUP_LIST_MCS_ASOC_B_1` (`RPUP_CNT_ITEM_ID`) USING BTREE, KEY `IDX_RPUP_LIST_MCS_ASOC_B_2` (`MCS_LIST_ID`) USING BTREE, KEY `IDX_RPUP_LIST_MCS_ASOC_B_3` (`MCS_CODE`) USING BTREE, KEY `IDX_RPUP_LIST_MCS_ASOC_B_4` (`MCS_REGNO`) USING BTREE );
|
||||
CREATE TABLE `bidprcu_mcs_regcert_b` ( `MCS_REGCERT_ID` varchar(40) NOT NULL COMMENT '耗材注册证ID', `MCS_REGNO` varchar(100) NOT NULL DEFAULT '' COMMENT '耗材注册证编号', `MCS_REGCERT_NAME` varchar(200) NOT NULL DEFAULT '' COMMENT '耗材注册证名称', `REGCERT_EXPY_BEGNTIME` datetime NOT NULL DEFAULT '1970-01-01 08:00:00' COMMENT '注册证有效期开始时间', `REGCERT_EXPY_ENDTIME` datetime NOT NULL DEFAULT '1970-01-01 08:00:00' COMMENT '注册证有效期结束时间', `PRODENTP_CODE` varchar(50) NOT NULL DEFAULT '' COMMENT '生产企业代码', `PRODENTP_NAME` varchar(200) NOT NULL DEFAULT '' COMMENT '生产企业名称', `PRXY_ENTP_CODE` varchar(50) NOT NULL DEFAULT '' COMMENT '代理企业代码', `PRXY_ENTP_NAME` varchar(200) NOT NULL DEFAULT '' COMMENT '代理企业名称', `MGT_TYPE_CODE` varchar(10) NOT NULL DEFAULT '' COMMENT '管理类别代码', `REGCERT_FILE_ID` varchar(500) NOT NULL DEFAULT '' COMMENT '注册证文件ID', `MANL_FILE_ID` varchar(500) DEFAULT NULL COMMENT '说明书文件ID', `OTH_FILE_ID` varchar(500) NOT NULL DEFAULT '' COMMENT '其他文件ID', `RID` varchar(40) NOT NULL DEFAULT '' COMMENT '数据唯一记录号', `CRTER_ID` varchar(20) DEFAULT NULL COMMENT '创建人ID', `CRTER_NAME` varchar(50) DEFAULT NULL COMMENT '创建人姓名', `CRTE_OPTINS_NO` varchar(20) DEFAULT NULL COMMENT '创建机构编号', `CRTE_TIME` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '数据创建时间', `OPT_TIME` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '经办时间', `OPTER_ID` varchar(20) DEFAULT NULL COMMENT '经办人ID', `OPTER_NAME` varchar(50) DEFAULT NULL COMMENT '经办人姓名', `OPTINS_NO` varchar(20) DEFAULT NULL COMMENT '经办机构编号', `UPDT_TIME` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '数据更新时间', `INVD_FLAG` varchar(3) NOT NULL DEFAULT '0' COMMENT '无效标志', `MANU_ADDR` varchar(2048) DEFAULT NULL COMMENT '生产地址', `APB_SCP` longtext COMMENT '适用范围', `STRU_COMP` longtext COMMENT '结构及组成', `PROD_SOUC` varchar(3) DEFAULT NULL COMMENT '耗材来源', `PROD_SOUC_CODE` varchar(3) DEFAULT NULL COMMENT '耗材来源', `SPEC_MOL` longtext COMMENT '规格型号', `MEMO` longtext COMMENT '备注', PRIMARY KEY (`MCS_REGCERT_ID`) USING BTREE, KEY `IDX_BIDPRCU_MCS_REGCERT_B_1` (`MCS_REGNO`) USING BTREE );
|
||||
CREATE TABLE `rpup_mcs_list_info_b` ( `MCS_LIST_ID` varchar(40) NOT NULL COMMENT '耗材目录ID', `RPUP_CNT_ITEM_ID` varchar(40) DEFAULT NULL COMMENT '报量项目ID', `MCS_LIST_CODE` varchar(40) DEFAULT NULL COMMENT '耗材目录代码', `LV1_LIST_NAME` varchar(100) DEFAULT NULL COMMENT '一级目录名称', `LV2_LIST_NAME` varchar(100) DEFAULT NULL COMMENT '二级目录名称', `LV3_LIST_NAME` varchar(100) DEFAULT NULL COMMENT '三级目录名称', `GENNAME` varchar(100) DEFAULT NULL COMMENT '通用名', `MATL` varchar(100) DEFAULT NULL COMMENT '材质', `SPEC` varchar(200) DEFAULT NULL COMMENT '规格', `ISU_FLAG` varchar(3) DEFAULT NULL COMMENT '下发标志', `RID` varchar(40) NOT NULL DEFAULT '' COMMENT '数据唯一记录号', `CRTER_ID` varchar(20) DEFAULT NULL COMMENT '创建人ID', `CRTER_NAME` varchar(50) DEFAULT NULL COMMENT '创建人姓名', `CRTE_OPTINS_NO` varchar(20) DEFAULT NULL COMMENT '创建机构编号', `CRTE_TIME` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '数据创建时间', `OPTER_ID` varchar(20) DEFAULT NULL COMMENT '经办人ID', `OPTER_NAME` varchar(50) DEFAULT NULL COMMENT '经办人姓名', `OPTINS_NO` varchar(20) DEFAULT NULL COMMENT '经办机构编号', `UPDT_TIME` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '数据更新时间', `INVD_FLAG` varchar(3) NOT NULL DEFAULT '0' COMMENT '无效标志', PRIMARY KEY (`MCS_LIST_ID`) USING BTREE, KEY `IDX_RPUP_MCS_LIST_INFO_B_1` (`RPUP_CNT_ITEM_ID`) USING BTREE, KEY `IDX_RPUP_MCS_LIST_INFO_B_2` (`MCS_LIST_CODE`) USING BTREE, KEY `IDX_RPUP_MCS_LIST_INFO_B_3` (`GENNAME`) USING BTREE );
|
||||
|
||||
SELECT rpup_list_mcs_asoc_b.LIST_MCS_ASOC_ID, rpup_list_mcs_asoc_b.RPUP_CNT_ITEM_ID, rpup_list_mcs_asoc_b.RPUP_CNT_ITEM_ID AS rupuCntItemId, rpup_list_mcs_asoc_b.MCS_REGNO,
|
||||
rpup_list_mcs_asoc_b.MCS_NAME, rpup_list_mcs_asoc_b.MCS_MOL, rpup_mcs_list_info_b.MCS_LIST_CODE, rpup_mcs_list_info_b.LV1_LIST_NAME,
|
||||
rpup_mcs_list_info_b.LV2_LIST_NAME, rpup_mcs_list_info_b.LV3_LIST_NAME, rpup_mcs_list_info_b.GENNAME, rpup_mcs_list_info_b.MATL,
|
||||
rpup_mcs_list_info_b.SPEC, bidprcu_mcs_regcert_b.PRODENTP_CODE, bidprcu_mcs_regcert_b.PRODENTP_NAME, rpup_list_mcs_asoc_b.RID, rpup_list_mcs_asoc_b.CRTER_ID,
|
||||
rpup_list_mcs_asoc_b.CRTER_NAME, rpup_list_mcs_asoc_b.CRTE_OPTINS_NO, rpup_list_mcs_asoc_b.CRTE_TIME, rpup_list_mcs_asoc_b.OPTER_ID,
|
||||
rpup_list_mcs_asoc_b.OPTER_NAME, rpup_list_mcs_asoc_b.OPTINS_NO, rpup_list_mcs_asoc_b.UPDT_TIME, rpup_list_mcs_asoc_b.INVD_FLAG
|
||||
FROM rpup_list_mcs_asoc_b LEFT JOIN bidprcu_mcs_regcert_b ON bidprcu_mcs_regcert_b.mcs_regno = rpup_list_mcs_asoc_b.MCS_REGNO
|
||||
LEFT JOIN rpup_mcs_list_info_b ON rpup_mcs_list_info_b.MCS_LIST_ID = rpup_list_mcs_asoc_b.MCS_LIST_ID
|
||||
WHERE rpup_list_mcs_asoc_b.INVD_FLAG = '0' AND rpup_mcs_list_info_b.INVD_FLAG = '0'
|
||||
AND rpup_list_mcs_asoc_b.RPUP_CNT_ITEM_ID = '1403980836851798017' AND bidprcu_mcs_regcert_b.PRODENTP_NAME IS NOT NULL
|
||||
GROUP BY MCS_LIST_CODE, MCS_REGNO, MCS_NAME, PRODENTP_NAME, MCS_MOL;
|
||||
|
||||
select t1.c1 from t1, t2 group by c1;
|
||||
--error 1052
|
||||
select * from t1, t2 group by c1;
|
||||
--error 1052
|
||||
select 1 from t1, t2 group by c1;
|
||||
|
||||
drop table t1, t2;
|
||||
drop table `rpup_list_mcs_asoc_b`, `bidprcu_mcs_regcert_b`, `rpup_mcs_list_info_b`;
|
||||
@ -0,0 +1,2 @@
|
||||
select SYS_CONNECT_BY_PATH(2,1) from dual;
|
||||
ERROR 42000: FUNCTION SYS_CONNECT_BY_PATH does not exist
|
||||
@ -0,0 +1,5 @@
|
||||
#owner: dachuan.sdc
|
||||
#owner group: SQL3
|
||||
--error 1305
|
||||
select SYS_CONNECT_BY_PATH(2,1) from dual;
|
||||
|
||||
@ -0,0 +1,147 @@
|
||||
drop tenant if exists tt1 force;
|
||||
drop resource pool if exists mypool1;
|
||||
drop resource unit if exists mybox1;
|
||||
select * from oceanbase.__all_unit_config where name='mybox1';
|
||||
gmt_create gmt_modified unit_config_id name max_cpu min_cpu max_memory min_memory max_iops min_iops max_disk_size max_session_num
|
||||
create_time modify_time unit_config_id mybox1 1 1 536870912 536870912 128 128 536870912 64
|
||||
gmt_create gmt_modified resource_pool_id name unit_count unit_config_id zone_list tenant_id replica_type is_tenant_sys_pool
|
||||
create_time modify_time resource_pool_id mypool1 1 unit_config_id zone -1 0 0
|
||||
select * from oceanbase.__all_tenant where tenant_name='tt1';
|
||||
gmt_create gmt_modified tenant_id tenant_name replica_num zone_list primary_zone locked collation_type info read_only rewrite_merge_version locality logonly_replica_num previous_locality storage_format_version storage_format_work_version default_tablegroup_id compatibility_mode drop_tenant_time status in_recyclebin
|
||||
create_time modify_time tenant_id tt1 -1 zone zone 0 0 0 0 locality logonly_replica_num previous_locality storage_format_version storage_format_work_version -1 0 -1 TENANT_STATUS_NORMAL 0
|
||||
create user testtt1 identified by 'testtt1';
|
||||
create database tt1_test;
|
||||
GRANT ALL ON *.* TO testtt1;
|
||||
use test;
|
||||
DROP TABLE IF EXISTS t0,t1,t2,t3,t4,t5;
|
||||
DROP VIEW IF EXISTS v1;
|
||||
#
|
||||
# Bug#18925: subqueries with MIN/MAX functions on INFORMARTION_SCHEMA
|
||||
#
|
||||
SELECT t.table_name, c1.column_name
|
||||
FROM information_schema.tables t
|
||||
INNER JOIN
|
||||
information_schema.columns c1
|
||||
ON t.table_schema = c1.table_schema AND
|
||||
t.table_name = c1.table_name
|
||||
WHERE t.table_schema = 'information_schema' AND
|
||||
c1.ordinal_position =
|
||||
( SELECT COALESCE(MIN(c2.ordinal_position),1)
|
||||
FROM information_schema.columns c2
|
||||
WHERE c2.table_schema = t.table_schema AND
|
||||
c2.table_name = t.table_name AND
|
||||
c2.column_name LIKE '%SCHEMA%')
|
||||
AND t.table_name NOT LIKE 'ndb%'
|
||||
AND t.table_name NOT LIKE 'innodb%';
|
||||
table_name column_name
|
||||
SELECT t.table_name, c1.column_name
|
||||
FROM information_schema.tables t
|
||||
INNER JOIN
|
||||
information_schema.columns c1
|
||||
ON t.table_schema = c1.table_schema AND
|
||||
t.table_name = c1.table_name
|
||||
WHERE t.table_schema = 'information_schema' AND
|
||||
c1.ordinal_position =
|
||||
( SELECT COALESCE(MIN(c2.ordinal_position),1)
|
||||
FROM information_schema.columns c2
|
||||
WHERE c2.table_schema = 'information_schema' AND
|
||||
c2.table_name = t.table_name AND
|
||||
c2.column_name LIKE '%SCHEMA%')
|
||||
AND t.table_name NOT LIKE 'ndb%'
|
||||
AND t.table_name NOT LIKE 'innodb%';
|
||||
table_name column_name
|
||||
SELECT t.table_name, c1.column_name
|
||||
FROM information_schema.tables t
|
||||
INNER JOIN
|
||||
information_schema.columns c1
|
||||
ON t.table_schema = c1.table_schema AND
|
||||
t.table_name = c1.table_name
|
||||
WHERE t.table_schema = 'information_schema' AND
|
||||
c1.ordinal_position =
|
||||
( SELECT COALESCE(MIN(c2.ordinal_position),1)
|
||||
FROM information_schema.columns c2
|
||||
WHERE c2.table_schema = t.table_schema AND
|
||||
c2.table_name = t.table_name AND
|
||||
c2.column_name LIKE '%SCHEMA%')
|
||||
AND t.table_name NOT LIKE 'ndb%'
|
||||
AND t.table_name NOT LIKE 'innodb%';
|
||||
table_name column_name
|
||||
GLOBAL_STATUS VARIABLE_NAME
|
||||
PARAMETERS SPECIFIC_SCHEMA
|
||||
PARTITIONS TABLE_SCHEMA
|
||||
REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA
|
||||
SCHEMA_PRIVILEGES TABLE_SCHEMA
|
||||
SESSION_STATUS VARIABLE_NAME
|
||||
SESSION_VARIABLES VARIABLE_NAME
|
||||
TABLE_CONSTRAINTS CONSTRAINT_SCHEMA
|
||||
TABLE_PRIVILEGES TABLE_SCHEMA
|
||||
USER_PRIVILEGES GRANTEE
|
||||
SELECT t.table_name, c1.column_name
|
||||
FROM information_schema.tables t
|
||||
INNER JOIN
|
||||
information_schema.columns c1
|
||||
ON t.table_schema = c1.table_schema AND
|
||||
t.table_name = c1.table_name
|
||||
WHERE t.table_schema = 'information_schema' AND
|
||||
c1.ordinal_position =
|
||||
( SELECT COALESCE(MIN(c2.ordinal_position),1)
|
||||
FROM information_schema.columns c2
|
||||
WHERE c2.table_schema = 'information_schema' AND
|
||||
c2.table_name = t.table_name AND
|
||||
c2.column_name LIKE '%SCHEMA%')
|
||||
AND t.table_name NOT LIKE 'ndb%'
|
||||
AND t.table_name NOT LIKE 'innodb%';
|
||||
table_name column_name
|
||||
GLOBAL_STATUS VARIABLE_NAME
|
||||
PARAMETERS SPECIFIC_SCHEMA
|
||||
PARTITIONS TABLE_SCHEMA
|
||||
REFERENTIAL_CONSTRAINTS CONSTRAINT_SCHEMA
|
||||
SCHEMA_PRIVILEGES TABLE_SCHEMA
|
||||
SESSION_STATUS VARIABLE_NAME
|
||||
SESSION_VARIABLES VARIABLE_NAME
|
||||
TABLE_CONSTRAINTS CONSTRAINT_SCHEMA
|
||||
TABLE_PRIVILEGES TABLE_SCHEMA
|
||||
USER_PRIVILEGES GRANTEE
|
||||
select 1;
|
||||
1
|
||||
1
|
||||
use test;
|
||||
create table if not exists t1(i1 int, v2 varchar(80), i3 char(20),i4 float, d4 datetime(6),i5 decimal(5,3), primary key(i1));
|
||||
create table if not exists t2(i1 int, v2 varchar(80), i3 char(20),i4 float, d4 datetime(6),i5 decimal(5,3), primary key(i1));
|
||||
create table if not exists t3(i1 int, v2 varchar(80), i3 char(20),i4 float, d4 datetime(6),i5 decimal(5,3), primary key(i1));
|
||||
create table if not exists t4(i1 int, v2 varchar(80), i3 char(20),i4 float, d4 datetime(6),i5 decimal(5,3), primary key(i1));
|
||||
SELECT t.table_name, c1.column_name
|
||||
FROM information_schema.tables t
|
||||
INNER JOIN
|
||||
information_schema.columns c1
|
||||
ON t.table_schema = c1.table_schema AND
|
||||
t.table_name = c1.table_name
|
||||
WHERE t.table_schema = 'information_schema' AND
|
||||
c1.ordinal_position =
|
||||
( SELECT COALESCE(MIN(c2.ordinal_position),1)
|
||||
FROM information_schema.columns c2
|
||||
WHERE c2.table_schema = t.table_schema AND
|
||||
c2.table_name = t.table_name AND
|
||||
c2.column_name LIKE '%SCHEMA%')
|
||||
AND t.table_name NOT LIKE 'ndb%'
|
||||
AND t.table_name NOT LIKE 'innodb%';
|
||||
table_name column_name
|
||||
SELECT t.table_name, c1.column_name
|
||||
FROM information_schema.tables t
|
||||
INNER JOIN
|
||||
information_schema.columns c1
|
||||
ON t.table_schema = c1.table_schema AND
|
||||
t.table_name = c1.table_name
|
||||
WHERE t.table_schema = 'information_schema' AND
|
||||
c1.ordinal_position =
|
||||
( SELECT COALESCE(MIN(c2.ordinal_position),1)
|
||||
FROM information_schema.columns c2
|
||||
WHERE c2.table_schema = 'information_schema' AND
|
||||
c2.table_name = t.table_name AND
|
||||
c2.column_name LIKE '%SCHEMA%')
|
||||
AND t.table_name NOT LIKE 'ndb%'
|
||||
AND t.table_name NOT LIKE 'innodb%';
|
||||
table_name column_name
|
||||
drop tenant if exists tt1 force;
|
||||
drop resource pool if exists mypool1;
|
||||
drop resource unit if exists mybox1;
|
||||
@ -0,0 +1,356 @@
|
||||
drop tenant if exists tt1 force;
|
||||
drop resource pool if exists mypool1;
|
||||
drop resource unit if exists mybox1;
|
||||
create resource unit mybox1 max_cpu 1, max_memory 536870912, max_iops 128, max_disk_size 536870912, max_session_num 64, MIN_CPU=1, MIN_MEMORY=536870912, MIN_IOPS=128;
|
||||
select * from oceanbase.__all_unit_config where name='mybox1';
|
||||
gmt_create gmt_modified unit_config_id name max_cpu min_cpu max_memory min_memory max_iops min_iops max_disk_size max_session_num
|
||||
create_time modify_time unit_config_id mybox1 1 1 536870912 536870912 128 128 536870912 64
|
||||
gmt_create gmt_modified resource_pool_id name unit_count unit_config_id zone_list tenant_id replica_type is_tenant_sys_pool
|
||||
create_time modify_time resource_pool_id mypool1 1 unit_config_id zone tenant_id 0 0
|
||||
select * from oceanbase.__all_tenant where tenant_name='tt1';
|
||||
gmt_create gmt_modified tenant_id tenant_name replica_num zone_list primary_zone locked collation_type info read_only rewrite_merge_version locality logonly_replica_num previous_locality storage_format_version storage_format_work_version default_tablegroup_id compatibility_mode drop_tenant_time status in_recyclebin
|
||||
create_time modify_time tenant_id tt1 -1 zone zone 0 0 0 0 locality logonly_replica_num previous_locality storage_format_version storage_format_work_version -1 0 -1 TENANT_STATUS_NORMAL 0
|
||||
use information_schema;
|
||||
show variables like "%lower%";
|
||||
Variable_name Value
|
||||
lower_case_table_names 1
|
||||
desc character_sets;
|
||||
Field Type Null Key Default Extra
|
||||
CHARACTER_SET_NAME varchar(128) NO
|
||||
DEFAULT_COLLATE_NAME varchar(128) NO
|
||||
DESCRIPTION varchar(64) NO
|
||||
MAXLEN bigint(20) NO
|
||||
desc collation_character_set_applicability;
|
||||
Field Type Null Key Default Extra
|
||||
COLLATION_NAME varchar(128) NO
|
||||
CHARACTER_SET_NAME varchar(128) NO
|
||||
desc collations;
|
||||
Field Type Null Key Default Extra
|
||||
COLLATION_NAME varchar(128) NO
|
||||
CHARACTER_SET_NAME varchar(128) NO
|
||||
ID bigint(20) NO
|
||||
IS_DEFAULT varchar(4) NO
|
||||
IS_COMPILED varchar(4) NO
|
||||
SORTLEN bigint(20) NO
|
||||
desc columns;
|
||||
Field Type Null Key Default Extra
|
||||
TABLE_CATALOG varchar(4096) NO
|
||||
TABLE_SCHEMA varchar(128) NO NULL
|
||||
TABLE_NAME varchar(256) NO NULL
|
||||
COLUMN_NAME varchar(128) NO
|
||||
ORDINAL_POSITION bigint(20) unsigned NO
|
||||
COLUMN_DEFAULT varchar(262144) YES NULL
|
||||
IS_NULLABLE varchar(4) NO
|
||||
DATA_TYPE varchar(64) NO
|
||||
CHARACTER_MAXIMUM_LENGTH bigint(20) unsigned YES NULL
|
||||
CHARACTER_OCTET_LENGTH bigint(20) unsigned YES NULL
|
||||
NUMERIC_PRECISION bigint(20) unsigned YES NULL
|
||||
NUMERIC_SCALE bigint(20) unsigned YES NULL
|
||||
DATETIME_PRECISION bigint(20) unsigned YES NULL
|
||||
CHARACTER_SET_NAME varchar(128) YES NULL
|
||||
COLLATION_NAME varchar(128) YES NULL
|
||||
COLUMN_TYPE varchar(64) NO NULL
|
||||
COLUMN_KEY varchar(3) NO
|
||||
EXTRA varchar(4096) NO
|
||||
PRIVILEGES varchar(200) NO
|
||||
COLUMN_COMMENT varchar(2048) NO
|
||||
GENERATION_EXPRESSION varchar(262144) NO
|
||||
desc global_status;
|
||||
Field Type Null Key Default Extra
|
||||
VARIABLE_NAME varchar(128) NO
|
||||
VARIABLE_VALUE varchar(1024) YES NULL
|
||||
desc global_variables;
|
||||
Field Type Null Key Default Extra
|
||||
VARIABLE_NAME varchar(128) NO
|
||||
VARIABLE_VALUE varchar(65536) YES NULL
|
||||
desc key_column_usage;
|
||||
Field Type Null Key Default Extra
|
||||
CONSTRAINT_CATALOG varchar(3) NO
|
||||
CONSTRAINT_SCHEMA varchar(128) NO
|
||||
CONSTRAINT_NAME varchar(7) NO
|
||||
TABLE_CATALOG varchar(3) NO
|
||||
TABLE_SCHEMA varchar(128) NO
|
||||
TABLE_NAME varchar(256) NO
|
||||
COLUMN_NAME varchar(128) NO
|
||||
ORDINAL_POSITION bigint(20) NO
|
||||
POSITION_IN_UNIQUE_CONSTRAINT null NO
|
||||
REFERENCED_TABLE_SCHEMA varchar(128) NO
|
||||
REFERENCED_TABLE_NAME varchar(256) NO
|
||||
REFERENCED_COLUMN_NAME varchar(128) NO
|
||||
desc partitions;
|
||||
Field Type Null Key Default Extra
|
||||
TABLE_CATALOG varchar(4096) NO
|
||||
TABLE_SCHEMA varchar(128) NO
|
||||
TABLE_NAME varchar(256) NO
|
||||
PARTITION_NAME varchar(64) YES NULL
|
||||
SUBPARTITION_NAME varchar(64) YES NULL
|
||||
PARTITION_ORDINAL_POSITION bigint(20) unsigned YES NULL
|
||||
SUBPARTITION_ORDINAL_POSITION bigint(20) unsigned YES NULL
|
||||
PARTITION_METHOD varchar(18) YES NULL
|
||||
SUBPARTITION_METHOD varchar(18) YES NULL
|
||||
PARTITION_EXPRESSION varchar(4096) YES NULL
|
||||
SUBPARTITION_EXPRESSION varchar(4096) YES NULL
|
||||
PARTITION_DESCRIPTION varchar(1024) YES NULL
|
||||
TABLE_ROWS bigint(20) unsigned NO 0
|
||||
AVG_ROW_LENGTH bigint(20) unsigned NO 0
|
||||
DATA_LENGTH bigint(20) unsigned NO 0
|
||||
MAX_DATA_LENGTH bigint(20) unsigned YES NULL
|
||||
INDEX_LENGTH bigint(20) unsigned NO 0
|
||||
DATA_FREE bigint(20) unsigned NO 0
|
||||
CREATE_TIME timestamp(6) YES NULL
|
||||
UPDATE_TIME timestamp(6) YES NULL
|
||||
CHECK_TIME timestamp(6) YES NULL
|
||||
CHECKSUM bigint(20) YES NULL
|
||||
PARTITION_COMMENT varchar(1024) NO
|
||||
NODEGROUP varchar(12) NO
|
||||
TABLESPACE_NAME varchar(128) YES NULL
|
||||
desc processlist;
|
||||
Field Type Null Key Default Extra
|
||||
ID bigint(20) unsigned NO
|
||||
USER varchar(32) NO
|
||||
HOST varchar(128) NO
|
||||
DB varchar(128) YES NULL
|
||||
COMMAND varchar(4096) NO
|
||||
TIME bigint(20) NO
|
||||
STATE varchar(128) YES NULL
|
||||
INFO varchar(262143) YES NULL
|
||||
desc schema_privileges;
|
||||
Field Type Null Key Default Extra
|
||||
GRANTEE varchar(81) NO
|
||||
TABLE_CATALOG varchar(4096) NO
|
||||
TABLE_SCHEMA varchar(128) NO
|
||||
PRIVILEGE_TYPE varchar(64) NO
|
||||
IS_GRANTABLE varchar(3) NO
|
||||
desc schemata;
|
||||
Field Type Null Key Default Extra
|
||||
CATALOG_NAME varchar(3) NO
|
||||
SCHEMA_NAME varchar(128) NO
|
||||
DEFAULT_CHARACTER_SET_NAME varchar(7) NO
|
||||
DEFAULT_COLLATION_NAME varchar(18) NO
|
||||
SQL_PATH null NO
|
||||
DEFAULT_ENCRYPTION varchar(2) NO
|
||||
desc session_status;
|
||||
Field Type Null Key Default Extra
|
||||
VARIABLE_NAME varchar(128) NO
|
||||
VARIABLE_VALUE varchar(1024) YES NULL
|
||||
desc session_variables;
|
||||
Field Type Null Key Default Extra
|
||||
VARIABLE_NAME varchar(128) NO
|
||||
VARIABLE_VALUE varchar(1024) YES NULL
|
||||
desc statistics;
|
||||
Field Type Null Key Default Extra
|
||||
TABLE_CATALOG varchar(3) NO
|
||||
TABLE_SCHEMA varchar(128) NO
|
||||
TABLE_NAME varchar(256) NO
|
||||
NON_UNIQUE bigint(20) NO
|
||||
INDEX_SCHEMA varchar(128) NO
|
||||
INDEX_NAME varchar(128) NO
|
||||
SEQ_IN_INDEX bigint(20) NO
|
||||
COLUMN_NAME varchar(128) NO
|
||||
COLLATION varchar(128) YES NULL
|
||||
CARDINALITY bigint(20) YES NULL
|
||||
SUB_PART varchar(256) YES NULL
|
||||
PACKED varchar(256) YES NULL
|
||||
NULLABLE varchar(128) NO
|
||||
INDEX_TYPE varchar(128) NO
|
||||
COMMENT varchar(4096) YES NULL
|
||||
INDEX_COMMENT varchar(4096) NO
|
||||
IS_VISIBLE varchar(3) NO
|
||||
desc table_constraints;
|
||||
Field Type Null Key Default Extra
|
||||
CONSTRAINT_CATALOG varchar(4096) NO
|
||||
CONSTRAINT_SCHEMA varchar(128) NO
|
||||
CONSTRAINT_NAME varchar(128) NO
|
||||
TABLE_SCHEMA varchar(128) NO
|
||||
TABLE_NAME varchar(256) NO
|
||||
CONSTRAINT_TYPE varchar(128) NO
|
||||
desc table_privileges;
|
||||
Field Type Null Key Default Extra
|
||||
GRANTEE varchar(81) NO
|
||||
TABLE_CATALOG varchar(4096) NO
|
||||
TABLE_SCHEMA varchar(128) NO
|
||||
TABLE_NAME varchar(64) NO
|
||||
PRIVILEGE_TYPE varchar(64) NO
|
||||
IS_GRANTABLE varchar(3) NO
|
||||
desc tables;
|
||||
Field Type Null Key Default Extra
|
||||
TABLE_CATALOG varchar(3) NO
|
||||
TABLE_SCHEMA varchar(128) NO
|
||||
TABLE_NAME varchar(256) NO
|
||||
TABLE_TYPE varchar(12) NO
|
||||
ENGINE varchar(9) NO
|
||||
VERSION null NO
|
||||
ROW_FORMAT null NO
|
||||
TABLE_ROWS decimal(20,0) NO NULL
|
||||
AVG_ROW_LENGTH decimal(24,4) NO
|
||||
DATA_LENGTH decimal(20,0) NO NULL
|
||||
MAX_DATA_LENGTH null NO
|
||||
INDEX_LENGTH null NO
|
||||
DATA_FREE null NO
|
||||
AUTO_INCREMENT null NO
|
||||
CREATE_TIME timestamp(6) NO NULL
|
||||
UPDATE_TIME timestamp(6) NO NULL
|
||||
CHECK_TIME null NO
|
||||
TABLE_COLLATION varchar(128) NO
|
||||
CHECKSUM bigint(0) unsigned NO
|
||||
CREATE_OPTIONS null NO
|
||||
TABLE_COMMENT varchar(4096) NO
|
||||
desc user_privileges;
|
||||
Field Type Null Key Default Extra
|
||||
GRANTEE varchar(81) NO
|
||||
TABLE_CATALOG varchar(4096) NO
|
||||
PRIVILEGE_TYPE varchar(64) NO
|
||||
IS_GRANTABLE varchar(3) NO
|
||||
desc views;
|
||||
Field Type Null Key Default Extra
|
||||
TABLE_CATALOG varchar(3) NO
|
||||
TABLE_SCHEMA varchar(128) NO
|
||||
TABLE_NAME varchar(256) NO
|
||||
VIEW_DEFINITION longtext NO NULL
|
||||
CHECK_OPTION varchar(4) NO
|
||||
IS_UPDATABLE varchar(3) NO NULL
|
||||
DEFINER varchar(4) NO
|
||||
SECURITY_TYPE varchar(4) NO
|
||||
CHARACTER_SET_CLIENT varchar(7) NO NULL
|
||||
COLLATION_CONNECTION varchar(18) NO NULL
|
||||
show create table character_sets;
|
||||
View Create View character_set_client collation_connection
|
||||
CHARACTER_SETS CREATE VIEW `CHARACTER_SETS` AS SELECT CHARSET AS CHARACTER_SET_NAME, DEFAULT_COLLATION AS DEFAULT_COLLATE_NAME, DESCRIPTION, max_length AS MAXLEN FROM oceanbase.__tenant_virtual_charset utf8mb4 utf8mb4_general_ci
|
||||
show create table collation_character_set_applicability;
|
||||
View Create View character_set_client collation_connection
|
||||
COLLATION_CHARACTER_SET_APPLICABILITY CREATE VIEW `COLLATION_CHARACTER_SET_APPLICABILITY` AS select collation as COLLATION_NAME, charset as CHARACTER_SET_NAME from oceanbase.__tenant_virtual_collation utf8mb4 utf8mb4_general_ci
|
||||
show create table collations;
|
||||
View Create View character_set_client collation_connection
|
||||
COLLATIONS CREATE VIEW `COLLATIONS` AS select collation as COLLATION_NAME, charset as CHARACTER_SET_NAME, id as ID, `is_default` as IS_DEFAULT, is_compiled as IS_COMPILED, sortlen as SORTLEN from oceanbase.__tenant_virtual_collation utf8mb4 utf8mb4_general_ci
|
||||
show create table columns;
|
||||
View Create View character_set_client collation_connection
|
||||
COLUMNS CREATE VIEW `COLUMNS` AS SELECT TABLE_CATALOG,
|
||||
TABLE_SCHEMA,
|
||||
TABLE_NAME,
|
||||
COLUMN_NAME,
|
||||
ORDINAL_POSITION,
|
||||
COLUMN_DEFAULT,
|
||||
IS_NULLABLE,
|
||||
DATA_TYPE,
|
||||
CHARACTER_MAXIMUM_LENGTH,
|
||||
CHARACTER_OCTET_LENGTH,
|
||||
NUMERIC_PRECISION,
|
||||
NUMERIC_SCALE,
|
||||
DATETIME_PRECISION,
|
||||
CHARACTER_SET_NAME,
|
||||
COLLATION_NAME,
|
||||
COLUMN_TYPE,
|
||||
COLUMN_KEY,
|
||||
EXTRA,
|
||||
PRIVILEGES,
|
||||
COLUMN_COMMENT,
|
||||
GENERATION_EXPRESSION
|
||||
FROM OCEANBASE.__ALL_VIRTUAL_INFORMATION_COLUMNS where 0 = sys_privilege_check('table_acc', effective_tenant_id(), table_schema, table_name) utf8mb4 utf8mb4_general_ci
|
||||
show create table global_status;
|
||||
Table Create Table
|
||||
GLOBAL_STATUS CREATE TABLE `GLOBAL_STATUS` (
|
||||
`VARIABLE_NAME` varchar(128) NOT NULL DEFAULT '',
|
||||
`VARIABLE_VALUE` varchar(1024) DEFAULT NULL
|
||||
) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'none' REPLICA_NUM = 1 BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 10 TABLEGROUP = 'oceanbase'
|
||||
show create table global_variables;
|
||||
View Create View character_set_client collation_connection
|
||||
GLOBAL_VARIABLES CREATE VIEW `GLOBAL_VARIABLES` AS SELECT `variable_name` as VARIABLE_NAME, `value` as VARIABLE_VALUE FROM oceanbase.__tenant_virtual_global_variable utf8mb4 utf8mb4_general_ci
|
||||
show create table key_column_usage;
|
||||
View Create View character_set_client collation_connection
|
||||
KEY_COLUMN_USAGE CREATE VIEW `KEY_COLUMN_USAGE` AS (select /*+ READ_CONSISTENCY(WEAK) */ 'def' as CONSTRAINT_CATALOG, c.database_name as CONSTRAINT_SCHEMA, 'PRIMARY' as CONSTRAINT_NAME, 'def' as TABLE_CATALOG, c.database_name as TABLE_SCHEMA, a.table_name as TABLE_NAME, b.column_name as COLUMN_NAME, b.rowkey_position as ORDINAL_POSITION, NULL as POSITION_IN_UNIQUE_CONSTRAINT, NULL as REFERENCED_TABLE_SCHEMA, NULL as REFERENCED_TABLE_NAME, NULL as REFERENCED_COLUMN_NAME from oceanbase.__all_virtual_table a inner join oceanbase.__all_virtual_column b on a.table_id = b.table_id inner join oceanbase.__all_virtual_database c on a.database_id = c.database_id where a.tenant_id = effective_tenant_id() and b.tenant_id = effective_tenant_id() and c.tenant_id = effective_tenant_id() and c.in_recyclebin = 0 and c.database_name != '__recyclebin' and b.rowkey_position > 0 and b.column_id >= 16 and a.table_type != 5 and b.column_flags & (0x1 << 8) = 0) union all (select /*+ READ_CONSISTENCY(WEAK) */ 'def' as CONSTRAINT_CATALOG, d.database_name as CONSTRAINT_SCHEMA, substr(a.table_name, 2 + length(substring_index(a.table_name,'_',4))) as CONSTRAINT_NAME, 'def' as TABLE_CATALOG, d.database_name as TABLE_SCHEMA, c.table_name as TABLE_NAME, b.column_name as COLUMN_NAME, b.index_position as ORDINAL_POSITION, NULL as POSITION_IN_UNIQUE_CONSTRAINT, NULL as REFERENCED_TABLE_SCHEMA, NULL as REFERENCED_TABLE_NAME, NULL as REFERENCED_COLUMN_NAME from oceanbase.__all_virtual_table a inner join oceanbase.__all_virtual_column b on a.table_id = b.table_id inner join oceanbase.__all_virtual_table c on a.data_table_id = c.table_id inner join oceanbase.__all_virtual_database d on c.database_id = d.database_id where a.tenant_id = effective_tenant_id() and b.tenant_id = effective_tenant_id() and c.tenant_id = effective_tenant_id() and d.in_recyclebin = 0 and d.tenant_id = effective_tenant_id() and d.database_name != '__recyclebin' and a.table_type = 5 and a.index_type in (2, 4, 8) and b.index_position > 0) union all (select /*+ READ_CONSISTENCY(WEAK) */ 'def' as CONSTRAINT_CATALOG, d.database_name as CONSTRAINT_SCHEMA, f.foreign_key_name as CONSTRAINT_NAME, 'def' as TABLE_CATALOG, d.database_name as TABLE_SCHEMA, t.table_name as TABLE_NAME, c.column_name as COLUMN_NAME, fc.position as ORDINAL_POSITION, NULL as POSITION_IN_UNIQUE_CONSTRAINT, /* POSITION_IN_UNIQUE_CONSTRAINT is not supported now */ d2.database_name as REFERENCED_TABLE_SCHEMA, t2.table_name as REFERENCED_TABLE_NAME, c2.column_name as REFERENCED_COLUMN_NAME from oceanbase.__all_virtual_foreign_key f inner join oceanbase.__all_virtual_table t on f.child_table_id = t.table_id inner join oceanbase.__all_virtual_database d on t.database_id = d.database_id inner join oceanbase.__all_virtual_foreign_key_column fc on f.foreign_key_id = fc.foreign_key_id inner join oceanbase.__all_virtual_column c on fc.child_column_id = c.column_id and t.table_id = c.table_id inner join oceanbase.__all_virtual_table t2 on f.parent_table_id = t2.table_id inner join oceanbase.__all_virtual_database d2 on t2.database_id = d2.database_id inner join oceanbase.__all_virtual_column c2 on fc.parent_column_id = c2.column_id and t2.table_id = c2.table_id where f.tenant_id = effective_tenant_id() and fc.tenant_id = effective_tenant_id() and t.tenant_id = effective_tenant_id() and d.tenant_id = effective_tenant_id() and c.tenant_id = effective_tenant_id() and t2.tenant_id = effective_tenant_id() and d2.tenant_id = effective_tenant_id() and c2.tenant_id = effective_tenant_id()) utf8mb4 utf8mb4_general_ci
|
||||
show create table partitions;
|
||||
Table Create Table
|
||||
PARTITIONS CREATE TABLE `PARTITIONS` (
|
||||
`TABLE_CATALOG` varchar(4096) NOT NULL DEFAULT '',
|
||||
`TABLE_SCHEMA` varchar(128) NOT NULL DEFAULT '',
|
||||
`TABLE_NAME` varchar(256) NOT NULL DEFAULT '',
|
||||
`PARTITION_NAME` varchar(64) DEFAULT NULL,
|
||||
`SUBPARTITION_NAME` varchar(64) DEFAULT NULL,
|
||||
`PARTITION_ORDINAL_POSITION` bigint(20) unsigned DEFAULT NULL,
|
||||
`SUBPARTITION_ORDINAL_POSITION` bigint(20) unsigned DEFAULT NULL,
|
||||
`PARTITION_METHOD` varchar(18) DEFAULT NULL,
|
||||
`SUBPARTITION_METHOD` varchar(18) DEFAULT NULL,
|
||||
`PARTITION_EXPRESSION` varchar(4096) DEFAULT NULL,
|
||||
`SUBPARTITION_EXPRESSION` varchar(4096) DEFAULT NULL,
|
||||
`PARTITION_DESCRIPTION` varchar(1024) DEFAULT NULL,
|
||||
`TABLE_ROWS` bigint(20) unsigned NOT NULL DEFAULT '0',
|
||||
`AVG_ROW_LENGTH` bigint(20) unsigned NOT NULL DEFAULT '0',
|
||||
`DATA_LENGTH` bigint(20) unsigned NOT NULL DEFAULT '0',
|
||||
`MAX_DATA_LENGTH` bigint(20) unsigned DEFAULT NULL,
|
||||
`INDEX_LENGTH` bigint(20) unsigned NOT NULL DEFAULT '0',
|
||||
`DATA_FREE` bigint(20) unsigned NOT NULL DEFAULT '0',
|
||||
`CREATE_TIME` timestamp(6) NULL DEFAULT NULL,
|
||||
`UPDATE_TIME` timestamp(6) NULL DEFAULT NULL,
|
||||
`CHECK_TIME` timestamp(6) NULL DEFAULT NULL,
|
||||
`CHECKSUM` bigint(20) DEFAULT NULL,
|
||||
`PARTITION_COMMENT` varchar(1024) NOT NULL DEFAULT '',
|
||||
`NODEGROUP` varchar(12) NOT NULL DEFAULT '',
|
||||
`TABLESPACE_NAME` varchar(128) DEFAULT NULL
|
||||
) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'none' REPLICA_NUM = 1 BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 10
|
||||
show create table processlist;
|
||||
View Create View character_set_client collation_connection
|
||||
PROCESSLIST CREATE VIEW `PROCESSLIST` AS SELECT id AS ID, user AS USER, host AS HOST, db AS DB, command AS COMMAND, time AS TIME, state AS STATE, info AS INFO FROM oceanbase.__all_virtual_processlist WHERE is_serving_tenant(svr_ip, svr_port, effective_tenant_id()) utf8mb4 utf8mb4_general_ci
|
||||
show create table schema_privileges;
|
||||
Table Create Table
|
||||
SCHEMA_PRIVILEGES CREATE TABLE `SCHEMA_PRIVILEGES` (
|
||||
`GRANTEE` varchar(81) NOT NULL DEFAULT '',
|
||||
`TABLE_CATALOG` varchar(4096) NOT NULL DEFAULT '',
|
||||
`TABLE_SCHEMA` varchar(128) NOT NULL DEFAULT '',
|
||||
`PRIVILEGE_TYPE` varchar(64) NOT NULL DEFAULT '',
|
||||
`IS_GRANTABLE` varchar(3) NOT NULL DEFAULT ''
|
||||
) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'none' REPLICA_NUM = 1 BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 10 TABLEGROUP = 'oceanbase'
|
||||
show create table schemata;
|
||||
View Create View character_set_client collation_connection
|
||||
SCHEMATA CREATE VIEW `SCHEMATA` AS SELECT 'def' AS CATALOG_NAME, DATABASE_NAME AS SCHEMA_NAME, 'utf8mb4' AS DEFAULT_CHARACTER_SET_NAME, 'utf8mb4_general_ci' AS DEFAULT_COLLATION_NAME, NULL AS SQL_PATH, 'NO' as DEFAULT_ENCRYPTION FROM oceanbase.__all_virtual_database a WHERE a.tenant_id = effective_tenant_id() and in_recyclebin = 0 and database_name != '__recyclebin' utf8mb4 utf8mb4_general_ci
|
||||
show create table session_status;
|
||||
Table Create Table
|
||||
SESSION_STATUS CREATE TABLE `SESSION_STATUS` (
|
||||
`VARIABLE_NAME` varchar(128) NOT NULL DEFAULT '',
|
||||
`VARIABLE_VALUE` varchar(1024) DEFAULT NULL
|
||||
) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'none' REPLICA_NUM = 1 BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 10
|
||||
show create table session_variables;
|
||||
Table Create Table
|
||||
SESSION_VARIABLES CREATE TABLE `SESSION_VARIABLES` (
|
||||
`VARIABLE_NAME` varchar(128) NOT NULL DEFAULT '',
|
||||
`VARIABLE_VALUE` varchar(1024) DEFAULT NULL
|
||||
) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'none' REPLICA_NUM = 1 BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 10 TABLEGROUP = 'oceanbase'
|
||||
show create table statistics;
|
||||
View Create View character_set_client collation_connection
|
||||
STATISTICS CREATE VIEW `STATISTICS` AS SELECT 'def' as TABLE_CATALOG, table_schema AS TABLE_SCHEMA, `table` as TABLE_NAME, non_unique AS NON_UNIQUE, index_schema as INDEX_SCHEMA, key_name as INDEX_NAME, seq_in_index as SEQ_IN_INDEX, column_name as COLUMN_NAME, collation as COLLATION, cardinality as CARDINALITY, sub_part as SUB_PART, packed as PACKED, `null` as NULLABLE, index_type as INDEX_TYPE, COMMENT, index_comment as INDEX_COMMENT, is_visible as IS_VISIBLE FROM oceanbase.__tenant_virtual_table_index utf8mb4 utf8mb4_general_ci
|
||||
show create table table_constraints;
|
||||
Table Create Table
|
||||
TABLE_CONSTRAINTS CREATE TABLE `TABLE_CONSTRAINTS` (
|
||||
`CONSTRAINT_CATALOG` varchar(4096) NOT NULL DEFAULT '',
|
||||
`CONSTRAINT_SCHEMA` varchar(128) NOT NULL DEFAULT '',
|
||||
`CONSTRAINT_NAME` varchar(128) NOT NULL DEFAULT '',
|
||||
`TABLE_SCHEMA` varchar(128) NOT NULL DEFAULT '',
|
||||
`TABLE_NAME` varchar(256) NOT NULL DEFAULT '',
|
||||
`CONSTRAINT_TYPE` varchar(128) NOT NULL DEFAULT ''
|
||||
) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'none' REPLICA_NUM = 1 BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 10
|
||||
show create table table_privileges;
|
||||
Table Create Table
|
||||
TABLE_PRIVILEGES CREATE TABLE `TABLE_PRIVILEGES` (
|
||||
`GRANTEE` varchar(81) NOT NULL DEFAULT '',
|
||||
`TABLE_CATALOG` varchar(4096) NOT NULL DEFAULT '',
|
||||
`TABLE_SCHEMA` varchar(128) NOT NULL DEFAULT '',
|
||||
`TABLE_NAME` varchar(64) NOT NULL DEFAULT '',
|
||||
`PRIVILEGE_TYPE` varchar(64) NOT NULL DEFAULT '',
|
||||
`IS_GRANTABLE` varchar(3) NOT NULL DEFAULT ''
|
||||
) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'none' REPLICA_NUM = 1 BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 10 TABLEGROUP = 'oceanbase'
|
||||
show create table tables;
|
||||
View Create View character_set_client collation_connection
|
||||
TABLES CREATE VIEW `TABLES` AS select /*+ READ_CONSISTENCY(WEAK), use_merge(b, c, d, e)*/ 'def' as TABLE_CATALOG, b.database_name as TABLE_SCHEMA, a.table_name as TABLE_NAME, case when a.database_id & 0xFFFFFFFFFF = 2 then 'SYSTEM VIEW' when (a.table_type = 1 or a.table_type = 4) then 'VIEW' when a.table_type = 2 then 'SYSTEM TABLE' when a.table_type = 1 then 'INDEX' else 'BASE TABLE' end as TABLE_TYPE, 'OceanBase' as ENGINE, NULL as VERSION, NULL as ROW_FORMAT, sum(c.row_count) as TABLE_ROWS, case when sum(c.row_count) = 0 then 0 else sum(c.data_size)/sum(c.row_count) end as AVG_ROW_LENGTH, sum(c.data_size) as DATA_LENGTH, NULL as MAX_DATA_LENGTH, NULL as INDEX_LENGTH, NULL as DATA_FREE, NULL as AUTO_INCREMENT, a.gmt_create as CREATE_TIME, a.gmt_modified as UPDATE_TIME, NULL as CHECK_TIME, d.collation as TABLE_COLLATION, cast(NULL as unsigned) as CHECKSUM, NULL as CREATE_OPTIONS, a.comment as TABLE_COMMENT from oceanbase.__all_virtual_table a inner join oceanbase.__all_virtual_database b on a.database_id = b.database_id left join oceanbase.__all_virtual_tenant_partition_meta_table c on a.table_id = c.table_id and c.tenant_id = effective_tenant_id() and a.tenant_id = c.tenant_id and c.role = 1 inner join oceanbase.__all_collation d on a.collation_type = d.id where a.tenant_id = effective_tenant_id() and b.tenant_id = effective_tenant_id() and a.table_type != 5 and b.database_name != '__recyclebin' and b.in_recyclebin = 0 and 0 = sys_privilege_check('table_acc', effective_tenant_id(), b.database_name, a.table_name) group by a.table_id, b.database_name, a.table_name, a.table_type, a.gmt_create, a.gmt_modified, d.collation, a.comment utf8mb4 utf8mb4_general_ci
|
||||
show create table user_privileges;
|
||||
Table Create Table
|
||||
USER_PRIVILEGES CREATE TABLE `USER_PRIVILEGES` (
|
||||
`GRANTEE` varchar(81) NOT NULL DEFAULT '',
|
||||
`TABLE_CATALOG` varchar(4096) NOT NULL DEFAULT '',
|
||||
`PRIVILEGE_TYPE` varchar(64) NOT NULL DEFAULT '',
|
||||
`IS_GRANTABLE` varchar(3) NOT NULL DEFAULT ''
|
||||
) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'none' REPLICA_NUM = 1 BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 10 TABLEGROUP = 'oceanbase'
|
||||
show create table views;
|
||||
View Create View character_set_client collation_connection
|
||||
VIEWS CREATE VIEW `VIEWS` AS select /*+ READ_CONSISTENCY(WEAK) */ 'def' AS TABLE_CATALOG, d.database_name as TABLE_SCHEMA, t.table_name as TABLE_NAME, t.view_definition as VIEW_DEFINITION, 'NONE' as CHECK_OPTION, case t.view_is_updatable when 1 then 'YES' else 'NO' end as IS_UPDATABLE, 'NONE' as DEFINER, 'NONE' AS SECURITY_TYPE, case t.collation_type when 45 then 'utf8mb4' else 'NONE' end AS CHARACTER_SET_CLIENT, case t.collation_type when 45 then 'utf8mb4_general_ci' else 'NONE' end AS COLLATION_CONNECTION from oceanbase.__all_virtual_table as t join oceanbase.__all_virtual_database as d on t.tenant_id = effective_tenant_id() and d.tenant_id = effective_tenant_id() and t.database_id = d.database_id where (t.table_type = 1 or t.table_type = 4) and d.in_recyclebin = 0 and d.database_name != '__recyclebin' and d.database_name != 'information_schema' and d.database_name != 'oceanbase' and 0 = sys_privilege_check('table_acc', effective_tenant_id(), d.database_name, t.table_name) utf8mb4 utf8mb4_general_ci
|
||||
drop tenant tt1 force;
|
||||
drop resource pool mypool1;
|
||||
drop resource unit mybox1;
|
||||
@ -0,0 +1,205 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: yanmu.ztl
|
||||
#owner group:sql2
|
||||
#description:information_schema test
|
||||
# This test uses grants, which can't get tested for embedded server
|
||||
#-- source mysql_test/include/big_test.inc
|
||||
-- source mysql_test/include/not_embedded.inc
|
||||
|
||||
# check that CSV engine was compiled in, as the result of the test depends
|
||||
# on the presence of the log tables (which are CSV-based).
|
||||
#--source mysql_test/include/have_csv.inc
|
||||
|
||||
let $cpu = 1;
|
||||
let $memory = 536870912;
|
||||
let $min_memory = 536870912;
|
||||
let $disk = 536870912;
|
||||
let $iops = 128;
|
||||
let $session = 64;
|
||||
|
||||
connect (obsys1,$OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connection obsys1;
|
||||
|
||||
--disable_warnings
|
||||
drop tenant if exists tt1 force;
|
||||
drop resource pool if exists mypool1;
|
||||
drop resource unit if exists mybox1;
|
||||
--enable_warnings
|
||||
--disable_query_log
|
||||
eval create resource unit mybox1 max_cpu $cpu, max_memory $memory, max_iops $iops, max_disk_size $disk, max_session_num $session, MIN_CPU=1, MIN_MEMORY=$min_memory, MIN_IOPS=128;
|
||||
--enable_query_log
|
||||
let $zone_name=query_get_value(select zone from oceanbase.__all_zone where zone != '' limit 1, zone, 1);
|
||||
|
||||
--replace_column 1 create_time 2 modify_time 3 unit_config_id
|
||||
select * from oceanbase.__all_unit_config where name='mybox1';
|
||||
|
||||
--disable_query_log
|
||||
eval create resource pool mypool1 unit = 'mybox1', unit_num = 1, zone_list = ('$zone_name');
|
||||
--replace_column 1 create_time 2 modify_time 3 resource_pool_id 6 unit_config_id 7 zone
|
||||
select * from oceanbase.__all_resource_pool where name='mypool1';
|
||||
|
||||
eval create tenant tt1 replica_num = 1, primary_zone='$zone_name', resource_pool_list=('mypool1') set ob_tcp_invited_nodes='%';
|
||||
--source mysql_test/include/check_tenant_sync.inc
|
||||
--enable_query_log
|
||||
--replace_column 1 create_time 2 modify_time 3 tenant_id 6 zone 7 zone 13 locality 14 logonly_replica_num 15 previous_locality 16 storage_format_version 17 storage_format_work_version
|
||||
select * from oceanbase.__all_tenant where tenant_name='tt1';
|
||||
#connect (conn1,$OBMYSQL_MS0,admin@tt1,admin,test,$OBMYSQL_PORT);
|
||||
let $__tenant_name__ = 'tt1';
|
||||
--source mysql_test/include/get_tenant_server.inc
|
||||
|
||||
disconnect obsys1;
|
||||
|
||||
connect (tt1_root,$TE_SERVER_IP,root@tt1,,*NO-ONE*,$TE_SERVER_PORT);
|
||||
connection tt1_root;
|
||||
|
||||
create user testtt1 identified by 'testtt1';
|
||||
create database tt1_test;
|
||||
GRANT ALL ON *.* TO testtt1;
|
||||
|
||||
--source mysql_test/include/check_schema_sync.inc
|
||||
connect (conn1,$TE_SERVER_IP,testtt1@tt1,testtt1,tt1_test,$TE_SERVER_PORT);
|
||||
connection conn1;
|
||||
|
||||
--disable_query_log
|
||||
set @@session.ob_query_timeout = 30000000;
|
||||
--enable_query_log
|
||||
use test;
|
||||
#
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t0,t1,t2,t3,t4,t5;
|
||||
--disable_warnings
|
||||
DROP VIEW IF EXISTS v1;
|
||||
--enable_warnings
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Bug#18925: subqueries with MIN/MAX functions on INFORMARTION_SCHEMA
|
||||
--echo #
|
||||
--sorted_result
|
||||
SELECT t.table_name, c1.column_name
|
||||
FROM information_schema.tables t
|
||||
INNER JOIN
|
||||
information_schema.columns c1
|
||||
ON t.table_schema = c1.table_schema AND
|
||||
t.table_name = c1.table_name
|
||||
WHERE t.table_schema = 'information_schema' AND
|
||||
c1.ordinal_position =
|
||||
( SELECT COALESCE(MIN(c2.ordinal_position),1)
|
||||
FROM information_schema.columns c2
|
||||
WHERE c2.table_schema = t.table_schema AND
|
||||
c2.table_name = t.table_name AND
|
||||
c2.column_name LIKE '%SCHEMA%')
|
||||
AND t.table_name NOT LIKE 'ndb%'
|
||||
AND t.table_name NOT LIKE 'innodb%';
|
||||
--sorted_result
|
||||
SELECT t.table_name, c1.column_name
|
||||
FROM information_schema.tables t
|
||||
INNER JOIN
|
||||
information_schema.columns c1
|
||||
ON t.table_schema = c1.table_schema AND
|
||||
t.table_name = c1.table_name
|
||||
WHERE t.table_schema = 'information_schema' AND
|
||||
c1.ordinal_position =
|
||||
( SELECT COALESCE(MIN(c2.ordinal_position),1)
|
||||
FROM information_schema.columns c2
|
||||
WHERE c2.table_schema = 'information_schema' AND
|
||||
c2.table_name = t.table_name AND
|
||||
c2.column_name LIKE '%SCHEMA%')
|
||||
AND t.table_name NOT LIKE 'ndb%'
|
||||
AND t.table_name NOT LIKE 'innodb%';
|
||||
connect (conn_root,$OBMYSQL_MS0,root@sys,,*NO-ONE*,$OBMYSQL_PORT);
|
||||
connection conn_root;
|
||||
--disable_query_log
|
||||
set @@session.ob_query_timeout = 30000000;
|
||||
--enable_query_log
|
||||
--sorted_result
|
||||
SELECT t.table_name, c1.column_name
|
||||
FROM information_schema.tables t
|
||||
INNER JOIN
|
||||
information_schema.columns c1
|
||||
ON t.table_schema = c1.table_schema AND
|
||||
t.table_name = c1.table_name
|
||||
WHERE t.table_schema = 'information_schema' AND
|
||||
c1.ordinal_position =
|
||||
( SELECT COALESCE(MIN(c2.ordinal_position),1)
|
||||
FROM information_schema.columns c2
|
||||
WHERE c2.table_schema = t.table_schema AND
|
||||
c2.table_name = t.table_name AND
|
||||
c2.column_name LIKE '%SCHEMA%')
|
||||
AND t.table_name NOT LIKE 'ndb%'
|
||||
AND t.table_name NOT LIKE 'innodb%';
|
||||
--sorted_result
|
||||
SELECT t.table_name, c1.column_name
|
||||
FROM information_schema.tables t
|
||||
INNER JOIN
|
||||
information_schema.columns c1
|
||||
ON t.table_schema = c1.table_schema AND
|
||||
t.table_name = c1.table_name
|
||||
WHERE t.table_schema = 'information_schema' AND
|
||||
c1.ordinal_position =
|
||||
( SELECT COALESCE(MIN(c2.ordinal_position),1)
|
||||
FROM information_schema.columns c2
|
||||
WHERE c2.table_schema = 'information_schema' AND
|
||||
c2.table_name = t.table_name AND
|
||||
c2.column_name LIKE '%SCHEMA%')
|
||||
AND t.table_name NOT LIKE 'ndb%'
|
||||
AND t.table_name NOT LIKE 'innodb%';
|
||||
|
||||
select 1;
|
||||
connection conn1;
|
||||
use test;
|
||||
create table if not exists t1(i1 int, v2 varchar(80), i3 char(20),i4 float, d4 datetime(6),i5 decimal(5,3), primary key(i1));
|
||||
connection conn1;
|
||||
create table if not exists t2(i1 int, v2 varchar(80), i3 char(20),i4 float, d4 datetime(6),i5 decimal(5,3), primary key(i1));
|
||||
connection conn1;
|
||||
create table if not exists t3(i1 int, v2 varchar(80), i3 char(20),i4 float, d4 datetime(6),i5 decimal(5,3), primary key(i1));
|
||||
connection conn1;
|
||||
create table if not exists t4(i1 int, v2 varchar(80), i3 char(20),i4 float, d4 datetime(6),i5 decimal(5,3), primary key(i1));
|
||||
connection conn1;
|
||||
--disable_query_log
|
||||
set @@session.ob_query_timeout = 30000000;
|
||||
--enable_query_log
|
||||
SELECT t.table_name, c1.column_name
|
||||
FROM information_schema.tables t
|
||||
INNER JOIN
|
||||
information_schema.columns c1
|
||||
ON t.table_schema = c1.table_schema AND
|
||||
t.table_name = c1.table_name
|
||||
WHERE t.table_schema = 'information_schema' AND
|
||||
c1.ordinal_position =
|
||||
( SELECT COALESCE(MIN(c2.ordinal_position),1)
|
||||
FROM information_schema.columns c2
|
||||
WHERE c2.table_schema = t.table_schema AND
|
||||
c2.table_name = t.table_name AND
|
||||
c2.column_name LIKE '%SCHEMA%')
|
||||
AND t.table_name NOT LIKE 'ndb%'
|
||||
AND t.table_name NOT LIKE 'innodb%';
|
||||
--sorted_result
|
||||
SELECT t.table_name, c1.column_name
|
||||
FROM information_schema.tables t
|
||||
INNER JOIN
|
||||
information_schema.columns c1
|
||||
ON t.table_schema = c1.table_schema AND
|
||||
t.table_name = c1.table_name
|
||||
WHERE t.table_schema = 'information_schema' AND
|
||||
c1.ordinal_position =
|
||||
( SELECT COALESCE(MIN(c2.ordinal_position),1)
|
||||
FROM information_schema.columns c2
|
||||
WHERE c2.table_schema = 'information_schema' AND
|
||||
c2.table_name = t.table_name AND
|
||||
c2.column_name LIKE '%SCHEMA%')
|
||||
AND t.table_name NOT LIKE 'ndb%'
|
||||
AND t.table_name NOT LIKE 'innodb%';
|
||||
|
||||
connect (obsys1,$OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connection obsys1;
|
||||
|
||||
--disable_warnings
|
||||
drop tenant if exists tt1 force;
|
||||
drop resource pool if exists mypool1;
|
||||
drop resource unit if exists mybox1;
|
||||
--enable_warnings
|
||||
|
||||
disconnect obsys1;
|
||||
@ -0,0 +1,111 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: yanmu.ztl
|
||||
#owner group:sql2
|
||||
#tags: ddl
|
||||
#description:information schema
|
||||
|
||||
connect (obsys1,$OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connection obsys1;
|
||||
|
||||
--disable_abort_on_error
|
||||
let $cpu = 1;
|
||||
let $memory = 536870912;
|
||||
let $min_memory = 536870912;
|
||||
let $disk = 536870912;
|
||||
let $iops = 128;
|
||||
let $session = 64;
|
||||
|
||||
--disable_warnings
|
||||
drop tenant if exists tt1 force;
|
||||
drop resource pool if exists mypool1;
|
||||
drop resource unit if exists mybox1;
|
||||
--enable_warnings
|
||||
|
||||
eval create resource unit mybox1 max_cpu $cpu, max_memory $memory, max_iops $iops, max_disk_size $disk, max_session_num $session, MIN_CPU=1, MIN_MEMORY=$min_memory, MIN_IOPS=128;
|
||||
let $zone_name=query_get_value(select zone from oceanbase.__all_zone where zone != '' limit 1, zone, 1);
|
||||
|
||||
--replace_column 1 create_time 2 modify_time 3 unit_config_id
|
||||
select * from oceanbase.__all_unit_config where name='mybox1';
|
||||
|
||||
--disable_query_log
|
||||
eval create resource pool mypool1 unit = 'mybox1', unit_num = 1, zone_list = ('$zone_name');
|
||||
--replace_column 1 create_time 2 modify_time 3 resource_pool_id 6 unit_config_id 7 zone 8 tenant_id
|
||||
select * from oceanbase.__all_resource_pool where name='mypool1';
|
||||
|
||||
eval create tenant tt1 replica_num = 1, primary_zone='$zone_name', resource_pool_list=('mypool1') set ob_tcp_invited_nodes='%';
|
||||
--source mysql_test/include/check_tenant_sync.inc
|
||||
--enable_query_log
|
||||
--replace_column 1 create_time 2 modify_time 3 tenant_id 6 zone 7 zone 13 locality 14 logonly_replica_num 15 previous_locality 16 storage_format_version 17 storage_format_work_version
|
||||
select * from oceanbase.__all_tenant where tenant_name='tt1';
|
||||
let $__tenant_name__ = 'tt1';
|
||||
--source mysql_test/include/get_tenant_server.inc
|
||||
|
||||
disconnect obsys1;
|
||||
connect (conn1,$TE_SERVER_IP,root@tt1,,*NO-ONE*,$TE_SERVER_PORT);
|
||||
|
||||
use information_schema;
|
||||
show variables like "%lower%";
|
||||
desc character_sets;
|
||||
desc collation_character_set_applicability;
|
||||
desc collations;
|
||||
desc columns;
|
||||
desc global_status;
|
||||
desc global_variables;
|
||||
desc key_column_usage;
|
||||
desc partitions;
|
||||
desc processlist;
|
||||
desc schema_privileges;
|
||||
desc schemata;
|
||||
desc session_status;
|
||||
desc session_variables;
|
||||
desc statistics;
|
||||
desc table_constraints;
|
||||
desc table_privileges;
|
||||
desc tables;
|
||||
desc user_privileges;
|
||||
desc views;
|
||||
--source mysql_test/include/show_create_table_old_version.inc
|
||||
show create table character_sets;
|
||||
--source mysql_test/include/show_create_table_old_version.inc
|
||||
show create table collation_character_set_applicability;
|
||||
--source mysql_test/include/show_create_table_old_version.inc
|
||||
show create table collations;
|
||||
--source mysql_test/include/show_create_table_old_version.inc
|
||||
show create table columns;
|
||||
--source mysql_test/include/show_create_table_old_version.inc
|
||||
show create table global_status;
|
||||
--source mysql_test/include/show_create_table_old_version.inc
|
||||
show create table global_variables;
|
||||
--source mysql_test/include/show_create_table_old_version.inc
|
||||
show create table key_column_usage;
|
||||
--source mysql_test/include/show_create_table_old_version.inc
|
||||
show create table partitions;
|
||||
--source mysql_test/include/show_create_table_old_version.inc
|
||||
show create table processlist;
|
||||
--source mysql_test/include/show_create_table_old_version.inc
|
||||
show create table schema_privileges;
|
||||
--source mysql_test/include/show_create_table_old_version.inc
|
||||
show create table schemata;
|
||||
--source mysql_test/include/show_create_table_old_version.inc
|
||||
show create table session_status;
|
||||
--source mysql_test/include/show_create_table_old_version.inc
|
||||
show create table session_variables;
|
||||
--source mysql_test/include/show_create_table_old_version.inc
|
||||
show create table statistics;
|
||||
--source mysql_test/include/show_create_table_old_version.inc
|
||||
show create table table_constraints;
|
||||
--source mysql_test/include/show_create_table_old_version.inc
|
||||
show create table table_privileges;
|
||||
--source mysql_test/include/show_create_table_old_version.inc
|
||||
show create table tables;
|
||||
--source mysql_test/include/show_create_table_old_version.inc
|
||||
show create table user_privileges;
|
||||
--source mysql_test/include/show_create_table_old_version.inc
|
||||
show create table views;
|
||||
|
||||
connect (conn_sys,$OBMYSQL_MS0,root@sys,,*NO-ONE*,$OBMYSQL_PORT);
|
||||
drop tenant tt1 force;
|
||||
drop resource pool mypool1;
|
||||
drop resource unit mybox1;
|
||||
@ -0,0 +1,165 @@
|
||||
use oceanbase;
|
||||
select * from __all_virtual_data_type order by data_type;
|
||||
data_type data_type_str data_type_class
|
||||
0 NULL 0
|
||||
1 TINYINT 1
|
||||
2 SMALLINT 1
|
||||
3 MEDIUMINT 1
|
||||
4 INT 1
|
||||
5 BIGINT 1
|
||||
6 TINYINT UNSIGNED 2
|
||||
7 SMALLINT UNSIGNED 2
|
||||
8 MEDIUMINT UNSIGNED 2
|
||||
9 INT UNSIGNED 2
|
||||
10 BIGINT UNSIGNED 2
|
||||
11 FLOAT 3
|
||||
12 DOUBLE 4
|
||||
13 FLOAT UNSIGNED 3
|
||||
14 DOUBLE UNSIGNED 4
|
||||
15 DECIMAL 5
|
||||
16 DECIMAL UNSIGNED 5
|
||||
17 DATETIME 6
|
||||
18 TIMESTAMP 6
|
||||
19 DATE 7
|
||||
20 TIME 8
|
||||
21 YEAR 9
|
||||
22 VARCHAR 10
|
||||
23 CHAR 10
|
||||
24 HEX_STRING 10
|
||||
25 EXT 11
|
||||
26 UNKNOWN 12
|
||||
27 TINYTEXT 13
|
||||
28 TEXT 13
|
||||
29 MEDIUMTEXT 13
|
||||
30 LONGTEXT 13
|
||||
31 BIT 14
|
||||
32 ENUM 15
|
||||
33 SET 15
|
||||
34 ENUM_INNER 16
|
||||
35 SET_INNER 16
|
||||
36 TIMESTAMP_WITH_TIME_ZONE 17
|
||||
37 TIMESTAMP_WITH_LOCAL_TIME_ZONE 17
|
||||
38 TIMESTAMP 17
|
||||
39 RAW 18
|
||||
40 INTERVAL_YEAR_TO_MONTH 19
|
||||
41 INTERVAL_DAY_TO_SECOND 19
|
||||
42 NUMBER_FLOAT 5
|
||||
43 NVARCHAR2 10
|
||||
44 NCHAR 10
|
||||
45 ROWID 20
|
||||
46 LOB 21
|
||||
47 JSON 22
|
||||
select data_type, data_type_str, data_type_class from __all_virtual_data_type order by data_type;
|
||||
data_type data_type_str data_type_class
|
||||
0 NULL 0
|
||||
1 TINYINT 1
|
||||
2 SMALLINT 1
|
||||
3 MEDIUMINT 1
|
||||
4 INT 1
|
||||
5 BIGINT 1
|
||||
6 TINYINT UNSIGNED 2
|
||||
7 SMALLINT UNSIGNED 2
|
||||
8 MEDIUMINT UNSIGNED 2
|
||||
9 INT UNSIGNED 2
|
||||
10 BIGINT UNSIGNED 2
|
||||
11 FLOAT 3
|
||||
12 DOUBLE 4
|
||||
13 FLOAT UNSIGNED 3
|
||||
14 DOUBLE UNSIGNED 4
|
||||
15 DECIMAL 5
|
||||
16 DECIMAL UNSIGNED 5
|
||||
17 DATETIME 6
|
||||
18 TIMESTAMP 6
|
||||
19 DATE 7
|
||||
20 TIME 8
|
||||
21 YEAR 9
|
||||
22 VARCHAR 10
|
||||
23 CHAR 10
|
||||
24 HEX_STRING 10
|
||||
25 EXT 11
|
||||
26 UNKNOWN 12
|
||||
27 TINYTEXT 13
|
||||
28 TEXT 13
|
||||
29 MEDIUMTEXT 13
|
||||
30 LONGTEXT 13
|
||||
31 BIT 14
|
||||
32 ENUM 15
|
||||
33 SET 15
|
||||
34 ENUM_INNER 16
|
||||
35 SET_INNER 16
|
||||
36 TIMESTAMP_WITH_TIME_ZONE 17
|
||||
37 TIMESTAMP_WITH_LOCAL_TIME_ZONE 17
|
||||
38 TIMESTAMP 17
|
||||
39 RAW 18
|
||||
40 INTERVAL_YEAR_TO_MONTH 19
|
||||
41 INTERVAL_DAY_TO_SECOND 19
|
||||
42 NUMBER_FLOAT 5
|
||||
43 NVARCHAR2 10
|
||||
44 NCHAR 10
|
||||
45 ROWID 20
|
||||
46 LOB 21
|
||||
47 JSON 22
|
||||
select * from __all_virtual_data_type where data_type = 22;
|
||||
data_type data_type_str data_type_class
|
||||
22 VARCHAR 10
|
||||
select a.data_type_str, b.data_type_class_str from __all_virtual_data_type a inner join __all_virtual_data_type_class b on a.data_type_class = b.data_type_class order by a.data_type;
|
||||
data_type_str data_type_class_str
|
||||
NULL NULL
|
||||
TINYINT INT
|
||||
SMALLINT INT
|
||||
MEDIUMINT INT
|
||||
INT INT
|
||||
BIGINT INT
|
||||
TINYINT UNSIGNED UINT
|
||||
SMALLINT UNSIGNED UINT
|
||||
MEDIUMINT UNSIGNED UINT
|
||||
INT UNSIGNED UINT
|
||||
BIGINT UNSIGNED UINT
|
||||
FLOAT FLOAT
|
||||
DOUBLE DOUBLE
|
||||
FLOAT UNSIGNED FLOAT
|
||||
DOUBLE UNSIGNED DOUBLE
|
||||
DECIMAL DECIMAL
|
||||
DECIMAL UNSIGNED DECIMAL
|
||||
DATETIME DATETIME
|
||||
TIMESTAMP DATETIME
|
||||
DATE DATE
|
||||
TIME TIME
|
||||
YEAR YEAR
|
||||
VARCHAR STRING
|
||||
CHAR STRING
|
||||
HEX_STRING STRING
|
||||
EXT EXT
|
||||
UNKNOWN UNKNOWN
|
||||
TINYTEXT TEXT
|
||||
TEXT TEXT
|
||||
MEDIUMTEXT TEXT
|
||||
LONGTEXT TEXT
|
||||
BIT BIT
|
||||
ENUM ENUM_SET
|
||||
SET ENUM_SET
|
||||
TIMESTAMP_WITH_TIME_ZONE OTIMESTAMP
|
||||
TIMESTAMP_WITH_LOCAL_TIME_ZONE OTIMESTAMP
|
||||
TIMESTAMP OTIMESTAMP
|
||||
RAW RAW
|
||||
INTERVAL_YEAR_TO_MONTH INTERVAL
|
||||
INTERVAL_DAY_TO_SECOND INTERVAL
|
||||
NUMBER_FLOAT DECIMAL
|
||||
NVARCHAR2 STRING
|
||||
NCHAR STRING
|
||||
ROWID ROWID
|
||||
LOB LOB
|
||||
JSON JSON
|
||||
show create table __all_virtual_data_type;
|
||||
Table Create Table
|
||||
__all_virtual_data_type CREATE TABLE `__all_virtual_data_type` (
|
||||
`data_type` bigint(20) NOT NULL,
|
||||
`data_type_str` varchar(128) NOT NULL,
|
||||
`data_type_class` bigint(20) NOT NULL,
|
||||
PRIMARY KEY (`data_type`)
|
||||
) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'none' REPLICA_NUM = NUM BLOCK_SIZE = SIZE USE_BLOOM_FILTER = FALSE TABLET_SIZE = SIZE PCTFREE = 10 TABLEGROUP = 'oceanbase'
|
||||
desc __all_virtual_data_type;
|
||||
Field Type Null Key Default Extra
|
||||
data_type bigint(20) NO PRI NULL
|
||||
data_type_str varchar(128) NO NULL
|
||||
data_type_class bigint(20) NO NULL
|
||||
@ -0,0 +1,111 @@
|
||||
use oceanbase;
|
||||
select * from __all_virtual_data_type_class;
|
||||
data_type_class data_type_class_str
|
||||
0 NULL
|
||||
1 INT
|
||||
2 UINT
|
||||
3 FLOAT
|
||||
4 DOUBLE
|
||||
5 DECIMAL
|
||||
6 DATETIME
|
||||
7 DATE
|
||||
8 TIME
|
||||
9 YEAR
|
||||
10 STRING
|
||||
11 EXT
|
||||
12 UNKNOWN
|
||||
13 TEXT
|
||||
14 BIT
|
||||
15 ENUM_SET
|
||||
17 OTIMESTAMP
|
||||
18 RAW
|
||||
19 INTERVAL
|
||||
20 ROWID
|
||||
21 LOB
|
||||
22 JSON
|
||||
select data_type_class, data_type_class_str from __all_virtual_data_type_class;
|
||||
data_type_class data_type_class_str
|
||||
0 NULL
|
||||
1 INT
|
||||
2 UINT
|
||||
3 FLOAT
|
||||
4 DOUBLE
|
||||
5 DECIMAL
|
||||
6 DATETIME
|
||||
7 DATE
|
||||
8 TIME
|
||||
9 YEAR
|
||||
10 STRING
|
||||
11 EXT
|
||||
12 UNKNOWN
|
||||
13 TEXT
|
||||
14 BIT
|
||||
15 ENUM_SET
|
||||
17 OTIMESTAMP
|
||||
18 RAW
|
||||
19 INTERVAL
|
||||
20 ROWID
|
||||
21 LOB
|
||||
22 JSON
|
||||
select * from __all_virtual_data_type_class where data_type_class = 10;
|
||||
data_type_class data_type_class_str
|
||||
10 STRING
|
||||
select a.data_type_str, b.data_type_class_str from __all_virtual_data_type a inner join __all_virtual_data_type_class b on a.data_type_class = b.data_type_class order by a.data_type;
|
||||
data_type_str data_type_class_str
|
||||
NULL NULL
|
||||
TINYINT INT
|
||||
SMALLINT INT
|
||||
MEDIUMINT INT
|
||||
INT INT
|
||||
BIGINT INT
|
||||
TINYINT UNSIGNED UINT
|
||||
SMALLINT UNSIGNED UINT
|
||||
MEDIUMINT UNSIGNED UINT
|
||||
INT UNSIGNED UINT
|
||||
BIGINT UNSIGNED UINT
|
||||
FLOAT FLOAT
|
||||
DOUBLE DOUBLE
|
||||
FLOAT UNSIGNED FLOAT
|
||||
DOUBLE UNSIGNED DOUBLE
|
||||
DECIMAL DECIMAL
|
||||
DECIMAL UNSIGNED DECIMAL
|
||||
DATETIME DATETIME
|
||||
TIMESTAMP DATETIME
|
||||
DATE DATE
|
||||
TIME TIME
|
||||
YEAR YEAR
|
||||
VARCHAR STRING
|
||||
CHAR STRING
|
||||
HEX_STRING STRING
|
||||
EXT EXT
|
||||
UNKNOWN UNKNOWN
|
||||
TINYTEXT TEXT
|
||||
TEXT TEXT
|
||||
MEDIUMTEXT TEXT
|
||||
LONGTEXT TEXT
|
||||
BIT BIT
|
||||
ENUM ENUM_SET
|
||||
SET ENUM_SET
|
||||
TIMESTAMP_WITH_TIME_ZONE OTIMESTAMP
|
||||
TIMESTAMP_WITH_LOCAL_TIME_ZONE OTIMESTAMP
|
||||
TIMESTAMP OTIMESTAMP
|
||||
RAW RAW
|
||||
INTERVAL_YEAR_TO_MONTH INTERVAL
|
||||
INTERVAL_DAY_TO_SECOND INTERVAL
|
||||
NUMBER_FLOAT DECIMAL
|
||||
NVARCHAR2 STRING
|
||||
NCHAR STRING
|
||||
ROWID ROWID
|
||||
LOB LOB
|
||||
JSON JSON
|
||||
show create table __all_virtual_data_type_class;
|
||||
Table Create Table
|
||||
__all_virtual_data_type_class CREATE TABLE `__all_virtual_data_type_class` (
|
||||
`data_type_class` bigint(20) NOT NULL,
|
||||
`data_type_class_str` varchar(128) NOT NULL,
|
||||
PRIMARY KEY (`data_type_class`)
|
||||
) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'none' REPLICA_NUM = NUM BLOCK_SIZE = SIZE USE_BLOOM_FILTER = FALSE TABLET_SIZE = SIZE PCTFREE = 10 TABLEGROUP = 'oceanbase'
|
||||
desc __all_virtual_data_type_class;
|
||||
Field Type Null Key Default Extra
|
||||
data_type_class bigint(20) NO PRI NULL
|
||||
data_type_class_str varchar(128) NO NULL
|
||||
@ -0,0 +1,25 @@
|
||||
use oceanbase;
|
||||
select * from __all_virtual_engine;
|
||||
Engine Support Comment Transactions XA Savepoints
|
||||
OceanBase YES Supports transactions YES NO NO
|
||||
select Engine, Support, Comment, Transactions, XA, Savepoints from __all_virtual_engine;
|
||||
Engine Support Comment Transactions XA Savepoints
|
||||
OceanBase YES Supports transactions YES NO NO
|
||||
show create table __all_virtual_engine;
|
||||
Table Create Table
|
||||
__all_virtual_engine CREATE TABLE `__all_virtual_engine` (
|
||||
`Engine` varchar(64) NOT NULL,
|
||||
`Support` varchar(4) NOT NULL,
|
||||
`Comment` varchar(2048) NOT NULL,
|
||||
`Transactions` varchar(4) NOT NULL,
|
||||
`XA` varchar(4) NOT NULL,
|
||||
`Savepoints` varchar(4) NOT NULL
|
||||
) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'none' REPLICA_NUM = NUM BLOCK_SIZE = SIZE USE_BLOOM_FILTER = FALSE TABLET_SIZE = SIZE PCTFREE = 10 TABLEGROUP = 'oceanbase'
|
||||
desc __all_virtual_engine;
|
||||
Field Type Null Key Default Extra
|
||||
Engine varchar(64) NO NULL
|
||||
Support varchar(4) NO NULL
|
||||
Comment varchar(2048) NO NULL
|
||||
Transactions varchar(4) NO NULL
|
||||
XA varchar(4) NO NULL
|
||||
Savepoints varchar(4) NO NULL
|
||||
@ -0,0 +1,12 @@
|
||||
select * from oceanbase.__tenant_virtual_interm_result where svr_ip = '0.0.0.0' and svr_port = 0;
|
||||
job_id task_id slice_id execution_id svr_ip svr_port expire_time row_count scanner_count used_memory_size used_disk_size partition_ip partition_port
|
||||
select * from oceanbase.__tenant_virtual_interm_result;
|
||||
select * from oceanbase.__tenant_virtual_interm_result where svr_port > 0;
|
||||
select * from oceanbase.__tenant_virtual_interm_result where scanner_count > 0;
|
||||
select * from oceanbase.__tenant_virtual_interm_result where expire_time > 0;
|
||||
select * from oceanbase.__tenant_virtual_interm_result where used_memory_size > 0;
|
||||
select * from oceanbase.__tenant_virtual_interm_result where is_serving_tenant(svr_ip, svr_port, 1);
|
||||
select * from oceanbase.__tenant_virtual_interm_result where is_serving_tenant(svr_ip, svr_port, 1001);
|
||||
select is_serving_tenant(svr_ip, svr_port, 1), is_serving_tenant(svr_ip, svr_port, 1001) from oceanbase.__tenant_virtual_interm_result where is_serving_tenant(svr_ip, svr_port, 1);
|
||||
select svr_ip, svr_port from oceanbase.__tenant_virtual_interm_result group by svr_ip, svr_port having is_serving_tenant(svr_ip, svr_port, 1);
|
||||
select t1.svr_ip, t1.svr_port, t2.svr_ip, t2.svr_port from oceanbase.__tenant_virtual_interm_result t1 join oceanbase.__tenant_virtual_interm_result t2 on is_serving_tenant(t1.svr_ip, t2.svr_port, 1);
|
||||
@ -0,0 +1,56 @@
|
||||
desc oceanbase.__all_virtual_pg_partition_info;
|
||||
Field Type Null Key Default Extra
|
||||
svr_ip varchar(46) NO NULL
|
||||
svr_port bigint(20) NO NULL
|
||||
tenant_id bigint(20) NO NULL
|
||||
table_id bigint(20) NO NULL
|
||||
partition_idx bigint(20) NO NULL
|
||||
tg_id bigint(20) NO NULL
|
||||
pg_idx bigint(20) NO NULL
|
||||
max_decided_trans_version bigint(20) NO NULL
|
||||
max_passed_trans_ts bigint(20) NO NULL
|
||||
freeze_ts bigint(20) NO NULL
|
||||
allow_gc tinyint(4) NO NULL
|
||||
partition_state varchar(128) NO NULL
|
||||
min_log_service_ts bigint(20) NO -1
|
||||
min_trans_service_ts bigint(20) NO -1
|
||||
min_replay_engine_ts bigint(20) NO -1
|
||||
is_pg tinyint(4) NO NULL
|
||||
weak_read_timestamp bigint(20) NO -1
|
||||
replica_type bigint(20) NO 0
|
||||
use test;
|
||||
create tablegroup tg1 binding true;
|
||||
create table test1 (id1 int, id2 int) tablegroup tg1;
|
||||
create table test2 (id1 int, id2 int) tablegroup tg1;
|
||||
create table test3 (id1 int, id2 int);
|
||||
create table test4 (id1 int, id2 int);
|
||||
select count(1) from oceanbase.__all_virtual_pg_partition_info
|
||||
where table_id in (select table_id from oceanbase.__all_virtual_table where table_name = 'test1') and partition_state = 'L_WORKING';
|
||||
count(1)
|
||||
1
|
||||
select count(1) from oceanbase.__all_virtual_pg_partition_info
|
||||
where table_id in (select table_id from oceanbase.__all_virtual_table where table_name = 'test2') and partition_state = 'L_WORKING';
|
||||
count(1)
|
||||
1
|
||||
select count(1) from oceanbase.__all_virtual_pg_partition_info
|
||||
where table_id in (select table_id from oceanbase.__all_virtual_table where table_name = 'test3') and partition_state = 'L_WORKING';
|
||||
count(1)
|
||||
1
|
||||
select count(1) from oceanbase.__all_virtual_pg_partition_info
|
||||
where table_id in (select table_id from oceanbase.__all_virtual_table where table_name = 'test4') and partition_state = 'L_WORKING';
|
||||
count(1)
|
||||
1
|
||||
select count(1) from oceanbase.__all_virtual_pg_partition_info
|
||||
where tg_id in (select tablegroup_id as tg_id from oceanbase.__all_virtual_tablegroup where tablegroup_name = 'tg1') and partition_state = 'L_WORKING';
|
||||
count(1)
|
||||
2
|
||||
select pg_partition_count from oceanbase.__all_virtual_partition_info
|
||||
where table_id in (select tablegroup_id as table_id from oceanbase.__all_virtual_tablegroup where tablegroup_name = 'tg1') and partition_state = 'L_WORKING';
|
||||
pg_partition_count
|
||||
2
|
||||
drop table if exists test1;
|
||||
drop table if exists test2;
|
||||
drop table if exists test3;
|
||||
drop table if exists test4;
|
||||
purge recyclebin;
|
||||
drop tablegroup tg1;
|
||||
@ -0,0 +1,382 @@
|
||||
select tenant_id, table_name from oceanbase.__all_virtual_table where table_name = '__all_virtual_sys_parameter_stat';
|
||||
tenant_id table_name
|
||||
1 __all_virtual_sys_parameter_stat
|
||||
use oceanbase;
|
||||
desc __all_virtual_sys_parameter_stat;
|
||||
Field Type Null Key Default Extra
|
||||
zone varchar(128) NO NULL
|
||||
svr_type varchar(16) NO NULL
|
||||
svr_ip varchar(46) NO NULL
|
||||
svr_port bigint(20) NO NULL
|
||||
name varchar(128) NO NULL
|
||||
data_type varchar(128) YES NULL
|
||||
value varchar(65536) NO NULL
|
||||
value_strict varchar(4096) YES NULL
|
||||
info varchar(4096) NO NULL
|
||||
need_reboot bigint(20) NO NULL
|
||||
section varchar(128) NO NULL
|
||||
visible_level varchar(64) NO NULL
|
||||
scope varchar(64) NO NULL
|
||||
source varchar(64) NO NULL
|
||||
edit_level varchar(128) NO NULL
|
||||
select name from __all_virtual_sys_parameter_stat where name not like "module_test_%" group by name order by name;
|
||||
name
|
||||
all_cluster_list
|
||||
all_server_list
|
||||
autoinc_cache_refresh_interval
|
||||
auto_broadcast_location_cache_rate_limit
|
||||
auto_delete_expired_backup
|
||||
auto_leader_switch_interval
|
||||
auto_refresh_location_cache_rate_limit
|
||||
backup_backup_dest
|
||||
backup_backup_dest_option
|
||||
backup_concurrency
|
||||
backup_dest
|
||||
backup_dest_option
|
||||
backup_log_archive_option
|
||||
backup_net_limit
|
||||
backup_recovery_window
|
||||
backup_region
|
||||
backup_zone
|
||||
balancer_emergency_percentage
|
||||
balancer_idle_time
|
||||
balancer_log_interval
|
||||
balancer_task_timeout
|
||||
balancer_timeout_check_interval
|
||||
balancer_tolerance_percentage
|
||||
balance_blacklist_failure_threshold
|
||||
balance_blacklist_retry_interval
|
||||
bf_cache_miss_count_threshold
|
||||
bf_cache_priority
|
||||
builtin_db_data_verify_cycle
|
||||
cache_wash_threshold
|
||||
clog_cache_priority
|
||||
clog_disk_usage_limit_percentage
|
||||
clog_disk_utilization_threshold
|
||||
clog_max_unconfirmed_log_count
|
||||
clog_sync_time_warn_threshold
|
||||
cluster
|
||||
cluster_id
|
||||
config_additional_dir
|
||||
cpu_count
|
||||
cpu_quota_concurrency
|
||||
cpu_reserved
|
||||
datafile_disk_percentage
|
||||
datafile_maxsize
|
||||
datafile_next
|
||||
datafile_size
|
||||
data_copy_concurrency
|
||||
data_dir
|
||||
data_disk_usage_limit_percentage
|
||||
data_storage_error_tolerance_time
|
||||
data_storage_warning_tolerance_time
|
||||
dead_socket_detection_timeout
|
||||
debug_sync_timeout
|
||||
default_compress
|
||||
default_compress_func
|
||||
default_progressive_merge_num
|
||||
default_row_format
|
||||
devname
|
||||
disk_io_thread_count
|
||||
dtl_buffer_size
|
||||
election_blacklist_interval
|
||||
election_cpu_quota
|
||||
enable_async_syslog
|
||||
enable_auto_leader_switch
|
||||
enable_auto_refresh_location_cache
|
||||
enable_ddl
|
||||
enable_early_lock_release
|
||||
enable_election_group
|
||||
enable_global_freeze_trigger
|
||||
enable_kv_ttl
|
||||
enable_log_archive
|
||||
enable_major_freeze
|
||||
enable_manual_merge
|
||||
enable_merge_by_turn
|
||||
enable_monotonic_weak_read
|
||||
enable_one_phase_commit
|
||||
enable_perf_event
|
||||
enable_rebalance
|
||||
enable_record_trace_id
|
||||
enable_record_trace_log
|
||||
enable_rereplication
|
||||
enable_rich_error_msg
|
||||
enable_rootservice_standalone
|
||||
enable_separate_sys_clog
|
||||
enable_smooth_leader_switch
|
||||
enable_sql_audit
|
||||
enable_sql_operator_dump
|
||||
enable_syslog_file_compress
|
||||
enable_syslog_recycle
|
||||
enable_syslog_wf
|
||||
enable_sys_table_ddl
|
||||
enable_sys_unit_standalone
|
||||
enable_tcp_keepalive
|
||||
enable_unit_balance_resource_weight
|
||||
enable_upgrade_mode
|
||||
fast_recovery_concurrency
|
||||
flush_log_at_trx_commit
|
||||
force_refresh_location_cache_interval
|
||||
force_refresh_location_cache_threshold
|
||||
freeze_trigger_percentage
|
||||
fuse_row_cache_priority
|
||||
gc_wait_archive
|
||||
get_leader_candidate_rpc_timeout
|
||||
global_index_build_single_replica_timeout
|
||||
global_major_freeze_residual_memory
|
||||
global_write_halt_residual_memory
|
||||
gts_refresh_interval
|
||||
high_priority_net_thread_count
|
||||
ignore_replay_checksum_error
|
||||
ignore_replica_checksum_error
|
||||
ilog_index_expire_time
|
||||
index_cache_priority
|
||||
index_clog_cache_priority
|
||||
index_info_block_cache_priority
|
||||
internal_sql_execute_timeout
|
||||
kv_ttl_duty_duration
|
||||
kv_ttl_history_recycle_interval
|
||||
large_query_threshold
|
||||
large_query_worker_percentage
|
||||
leak_mod_to_check
|
||||
lease_time
|
||||
location_cache_cpu_quota
|
||||
location_cache_expire_time
|
||||
location_cache_priority
|
||||
location_cache_refresh_min_interval
|
||||
location_cache_refresh_rpc_timeout
|
||||
location_cache_refresh_sql_timeout
|
||||
location_fetch_concurrency
|
||||
location_refresh_thread_count
|
||||
log_archive_batch_buffer_limit
|
||||
log_archive_checkpoint_interval
|
||||
log_archive_concurrency
|
||||
log_restore_concurrency
|
||||
major_compact_trigger
|
||||
major_freeze_duty_time
|
||||
max_kept_major_version_number
|
||||
max_px_worker_count
|
||||
max_stale_time_for_weak_consistency
|
||||
max_string_print_length
|
||||
max_syslog_file_count
|
||||
max_syslog_file_time
|
||||
memory_chunk_cache_size
|
||||
memory_limit
|
||||
memory_limit_percentage
|
||||
memory_reserved
|
||||
memstore_limit_percentage
|
||||
merger_check_interval
|
||||
merger_completion_percentage
|
||||
merger_switch_leader_duration_time
|
||||
merger_warm_up_duration_time
|
||||
merge_stat_sampling_ratio
|
||||
merge_thread_count
|
||||
meta_table_read_write_mode
|
||||
micro_block_merge_verify_level
|
||||
migrate_concurrency
|
||||
migration_disable_time
|
||||
minor_compact_trigger
|
||||
minor_deferred_gc_time
|
||||
minor_freeze_times
|
||||
minor_merge_concurrency
|
||||
minor_warm_up_duration_time
|
||||
min_observer_version
|
||||
multiblock_read_gap_size
|
||||
multiblock_read_size
|
||||
mysql_port
|
||||
net_thread_count
|
||||
obconfig_url
|
||||
ob_enable_batched_multi_statement
|
||||
ob_event_history_recycle_interval
|
||||
ob_proxy_readonly_transaction_routing_policy
|
||||
ob_ssl_invited_common_names
|
||||
open_cursors
|
||||
partition_table_check_interval
|
||||
partition_table_scan_batch_count
|
||||
plan_cache_evict_interval
|
||||
plan_cache_high_watermark
|
||||
plan_cache_low_watermark
|
||||
plsql_ccflags
|
||||
plsql_code_type
|
||||
plsql_debug
|
||||
plsql_optimize_level
|
||||
plsql_v2_compatibility
|
||||
plsql_warnings
|
||||
px_task_size
|
||||
px_workers_per_cpu_quota
|
||||
query_response_time_flush
|
||||
query_response_time_range_base
|
||||
query_response_time_stats
|
||||
rebuild_replica_data_lag_threshold
|
||||
recyclebin_object_expire_time
|
||||
redundancy_level
|
||||
replica_safe_remove_time
|
||||
resource_hard_limit
|
||||
resource_soft_limit
|
||||
restore_concurrency
|
||||
rootservice_async_task_queue_size
|
||||
rootservice_async_task_thread_count
|
||||
rootservice_list
|
||||
rootservice_memory_limit
|
||||
rootservice_ready_check_interval
|
||||
row_compaction_update_limit
|
||||
row_purge_thread_count
|
||||
rpc_port
|
||||
rpc_timeout
|
||||
schema_history_expire_time
|
||||
schema_history_recycle_interval
|
||||
server_balance_cpu_mem_tolerance_percent
|
||||
server_balance_critical_disk_waterlevel
|
||||
server_balance_disk_tolerance_percent
|
||||
server_check_interval
|
||||
server_cpu_quota_max
|
||||
server_cpu_quota_min
|
||||
server_data_copy_in_concurrency
|
||||
server_data_copy_out_concurrency
|
||||
server_permanent_offline_time
|
||||
server_temporary_offline_time
|
||||
sql_audit_memory_limit
|
||||
sql_audit_queue_size
|
||||
sql_work_area
|
||||
ssl_client_authentication
|
||||
ssl_external_kms_info
|
||||
stack_size
|
||||
switchover_process_thread_count
|
||||
syslog_io_bandwidth_limit
|
||||
syslog_level
|
||||
system_cpu_quota
|
||||
system_memory
|
||||
system_trace_level
|
||||
sys_bkgd_io_high_percentage
|
||||
sys_bkgd_io_low_percentage
|
||||
sys_bkgd_migration_change_member_list_timeout
|
||||
sys_bkgd_migration_retry_num
|
||||
sys_bkgd_net_percentage
|
||||
sys_cpu_limit_trigger
|
||||
tableapi_transport_compress_func
|
||||
tablet_size
|
||||
tcp_keepcnt
|
||||
tcp_keepidle
|
||||
tcp_keepintvl
|
||||
tenant_cpu_variation_per_server
|
||||
tenant_groups
|
||||
tenant_task_queue_size
|
||||
token_reserved_percentage
|
||||
trace_log_sampling_interval
|
||||
trace_log_slow_query_watermark
|
||||
trx_2pc_retry_interval
|
||||
trx_force_kill_threshold
|
||||
trx_try_wait_lock_timeout
|
||||
unit_balance_resource_weight
|
||||
user_block_cache_priority
|
||||
user_iort_up_percentage
|
||||
user_row_cache_priority
|
||||
user_tab_col_stat_cache_priority
|
||||
use_ipv6
|
||||
use_large_pages
|
||||
virtual_table_location_cache_expire_time
|
||||
wait_leader_batch_count
|
||||
weak_read_version_refresh_interval
|
||||
workarea_size_policy
|
||||
workers_per_cpu_quota
|
||||
writing_throttling_maximum_duration
|
||||
writing_throttling_trigger_percentage
|
||||
zone
|
||||
zone_merge_concurrency
|
||||
zone_merge_order
|
||||
zone_merge_timeout
|
||||
_alter_column_mode
|
||||
_auto_drop_tenant_if_restore_failed
|
||||
_auto_update_reserved_backup_timestamp
|
||||
_backup_idle_time
|
||||
_backup_retry_timeout
|
||||
_bloom_filter_enabled
|
||||
_bloom_filter_ratio
|
||||
_cache_wash_interval
|
||||
_chunk_row_store_mem_limit
|
||||
_clog_aggregation_buffer_amount
|
||||
_create_table_partition_distribution_strategy
|
||||
_datafile_usage_lower_bound_percentage
|
||||
_datafile_usage_upper_bound_percentage
|
||||
_data_storage_io_timeout
|
||||
_enable_block_file_punch_hole
|
||||
_enable_compaction_diagnose
|
||||
_enable_defensive_check
|
||||
_enable_easy_keepalive
|
||||
_enable_fast_commit
|
||||
_enable_filter_push_down_storage
|
||||
_enable_fulltext_index
|
||||
_enable_hash_join_hasher
|
||||
_enable_hash_join_processor
|
||||
_enable_ha_gts_full_service
|
||||
_enable_oracle_priv_check
|
||||
_enable_parallel_minor_merge
|
||||
_enable_plan_cache_mem_diagnosis
|
||||
_enable_sparse_row
|
||||
_enable_static_typing_engine
|
||||
_enable_trans_ctx_size_limit
|
||||
_flush_clog_aggregation_buffer_timeout
|
||||
_follower_replica_merge_level
|
||||
_force_hash_join_spill
|
||||
_gts_core_num
|
||||
_hash_area_size
|
||||
_io_callback_thread_count
|
||||
_large_query_io_percentage
|
||||
_max_elr_dependent_trx_count
|
||||
_max_partition_cnt_per_server
|
||||
_max_schema_slot_num
|
||||
_max_trx_size
|
||||
_migrate_block_verify_level
|
||||
_mini_merge_concurrency
|
||||
_minor_compaction_amplification_factor
|
||||
_minor_compaction_interval
|
||||
_minor_deferred_gc_level
|
||||
_ob_clog_disk_buffer_cnt
|
||||
_ob_clog_timeout_to_force_switch_leader
|
||||
_ob_ddl_timeout
|
||||
_ob_elr_fast_freeze_threshold
|
||||
_ob_enable_fast_freeze
|
||||
_ob_enable_log_replica_strict_recycle_mode
|
||||
_ob_enable_prepared_statement
|
||||
_ob_enable_px_for_inner_sql
|
||||
_ob_get_gts_ahead_interval
|
||||
_ob_minor_merge_schedule_interval
|
||||
_ob_plan_cache_gc_strategy
|
||||
_ob_query_rate_limit
|
||||
_ob_ssl_invited_nodes
|
||||
_ob_sys_high_load_per_cpu_threshold
|
||||
_ob_trans_rpc_timeout
|
||||
_parallel_min_message_pool
|
||||
_parallel_server_sleep_time
|
||||
_partition_balance_strategy
|
||||
_private_buffer_size
|
||||
_px_chunklist_count_ratio
|
||||
_px_max_message_pool_pct
|
||||
_px_max_pipeline_depth
|
||||
_px_message_compression
|
||||
_recyclebin_object_purge_frequency
|
||||
_restore_idle_time
|
||||
_rpc_checksum
|
||||
_single_zone_deployment_on
|
||||
_sort_area_size
|
||||
_temporary_file_io_area_size
|
||||
_trx_commit_retry_interval
|
||||
_upgrade_stage
|
||||
_xa_gc_interval
|
||||
_xa_gc_timeout
|
||||
__balance_controller
|
||||
__easy_memory_limit
|
||||
__easy_memory_reserved_percentage
|
||||
__enable_identical_partition_distribution
|
||||
__enable_small_tenant
|
||||
__min_full_resource_pool_memory
|
||||
__schema_split_mode
|
||||
select section,info from oceanbase.__all_virtual_sys_parameter_stat where name like '%major%' group by name;
|
||||
section info
|
||||
DAILY_MERGE the maximum number of kept major versions. Range: [1, 16] in integer
|
||||
DAILY_MERGE the start time of system daily merge procedure. Range: [00:00, 24:00)
|
||||
OBSERVER post global major freeze when observer memstore free memory(plus memory held by frozen memstore and blockcache) reach this limit. Rang:(0, 100)limit calc by (memory_limit - system_memory) * global_major_freeze_residual_memory/100
|
||||
ROOT_SERVICE specifies whether major_freeze function is turned on. Value: True:turned on; False: turned off
|
||||
TENANT major_compact_trigger alias to minor_freeze_times, Range: [0,65535] in integer
|
||||
show parameters;
|
||||
show parameters like '%log%';
|
||||
@ -0,0 +1,14 @@
|
||||
desc oceanbase.__all_virtual_upgrade_inspection;
|
||||
Field Type Null Key Default Extra
|
||||
name varchar(128) NO NULL
|
||||
info varchar(4096) NO NULL
|
||||
select * from oceanbase.__all_virtual_upgrade_inspection;
|
||||
name info
|
||||
zone_check succeed
|
||||
sys_stat_check succeed
|
||||
sys_param_check succeed
|
||||
sys_table_schema_check succeed
|
||||
STATISTIC_PRIMARY_ZONE_ENTITY_COUNT succeed
|
||||
SCHEMA_SPLIT_V2 succeed
|
||||
SCHEMA_REVISE succeed
|
||||
all_check succeed
|
||||
@ -0,0 +1,25 @@
|
||||
use information_schema;
|
||||
select * from character_sets;
|
||||
CHARACTER_SET_NAME DEFAULT_COLLATE_NAME DESCRIPTION MAXLEN
|
||||
binary binary Binary pseudo charset 1
|
||||
utf8mb4 utf8mb4_general_ci UTF-8 Unicode 4
|
||||
select character_set_name, default_collate_name, description, maxlen from character_sets;
|
||||
character_set_name default_collate_name description maxlen
|
||||
binary binary Binary pseudo charset 1
|
||||
utf8mb4 utf8mb4_general_ci UTF-8 Unicode 4
|
||||
select maxlen from character_sets;
|
||||
maxlen
|
||||
1
|
||||
4
|
||||
select * from character_sets where character_set_name like '%binary%';
|
||||
CHARACTER_SET_NAME DEFAULT_COLLATE_NAME DESCRIPTION MAXLEN
|
||||
binary binary Binary pseudo charset 1
|
||||
show create table character_sets;
|
||||
View Create View character_set_client collation_connection
|
||||
CHARACTER_SETS CREATE VIEW `CHARACTER_SETS` AS SELECT CHARSET AS CHARACTER_SET_NAME, DEFAULT_COLLATION AS DEFAULT_COLLATE_NAME, DESCRIPTION, max_length AS MAXLEN FROM oceanbase.__tenant_virtual_charset utf8mb4 utf8mb4_general_ci
|
||||
desc character_sets;
|
||||
Field Type Null Key Default Extra
|
||||
CHARACTER_SET_NAME varchar(128) NO
|
||||
DEFAULT_COLLATE_NAME varchar(128) NO
|
||||
DESCRIPTION varchar(64) NO
|
||||
MAXLEN bigint(20) NO
|
||||
@ -0,0 +1,28 @@
|
||||
use information_schema;
|
||||
select * from collation_character_set_applicability;
|
||||
COLLATION_NAME CHARACTER_SET_NAME
|
||||
utf8mb4_general_ci utf8mb4
|
||||
utf8mb4_bin utf8mb4
|
||||
binary binary
|
||||
select COLLATION_NAME, CHARACTER_SET_NAME from collation_character_set_applicability;
|
||||
COLLATION_NAME CHARACTER_SET_NAME
|
||||
utf8mb4_general_ci utf8mb4
|
||||
utf8mb4_bin utf8mb4
|
||||
binary binary
|
||||
select COLLATION_NAME from collation_character_set_applicability;
|
||||
COLLATION_NAME
|
||||
utf8mb4_general_ci
|
||||
utf8mb4_bin
|
||||
binary
|
||||
select CHARACTER_SET_NAME from collation_character_set_applicability;
|
||||
CHARACTER_SET_NAME
|
||||
utf8mb4
|
||||
utf8mb4
|
||||
binary
|
||||
select * from collation_character_set_applicability where COLLATION_NAME = 'utf8mb4_bin';
|
||||
COLLATION_NAME CHARACTER_SET_NAME
|
||||
utf8mb4_bin utf8mb4
|
||||
desc collation_character_set_applicability;
|
||||
Field Type Null Key Default Extra
|
||||
COLLATION_NAME varchar(128) NO
|
||||
CHARACTER_SET_NAME varchar(128) NO
|
||||
@ -0,0 +1,26 @@
|
||||
use information_schema;
|
||||
select * from collations;
|
||||
COLLATION_NAME CHARACTER_SET_NAME ID IS_DEFAULT IS_COMPILED SORTLEN
|
||||
utf8mb4_general_ci utf8mb4 45 Yes Yes 1
|
||||
utf8mb4_bin utf8mb4 46 Yes 1
|
||||
binary binary 63 Yes Yes 1
|
||||
select collation_name, character_set_name, id, is_default, is_compiled, sortlen from collations;
|
||||
collation_name character_set_name id is_default is_compiled sortlen
|
||||
utf8mb4_general_ci utf8mb4 45 Yes Yes 1
|
||||
utf8mb4_bin utf8mb4 46 Yes 1
|
||||
binary binary 63 Yes Yes 1
|
||||
select * from collations where collation_name like '%utf8%';
|
||||
COLLATION_NAME CHARACTER_SET_NAME ID IS_DEFAULT IS_COMPILED SORTLEN
|
||||
utf8mb4_general_ci utf8mb4 45 Yes Yes 1
|
||||
utf8mb4_bin utf8mb4 46 Yes 1
|
||||
show create table collations;
|
||||
View Create View character_set_client collation_connection
|
||||
COLLATIONS CREATE VIEW `COLLATIONS` AS select collation as COLLATION_NAME, charset as CHARACTER_SET_NAME, id as ID, `is_default` as IS_DEFAULT, is_compiled as IS_COMPILED, sortlen as SORTLEN from oceanbase.__tenant_virtual_collation utf8mb4 utf8mb4_general_ci
|
||||
desc collations;
|
||||
Field Type Null Key Default Extra
|
||||
COLLATION_NAME varchar(128) NO
|
||||
CHARACTER_SET_NAME varchar(128) NO
|
||||
ID bigint(20) NO
|
||||
IS_DEFAULT varchar(4) NO
|
||||
IS_COMPILED varchar(4) NO
|
||||
SORTLEN bigint(20) NO
|
||||
@ -0,0 +1,14 @@
|
||||
use information_schema;
|
||||
select count(*) from global_status;
|
||||
count(*)
|
||||
2
|
||||
show create table global_status;
|
||||
Table Create Table
|
||||
GLOBAL_STATUS CREATE TABLE `GLOBAL_STATUS` (
|
||||
`VARIABLE_NAME` varchar(128) NOT NULL DEFAULT '',
|
||||
`VARIABLE_VALUE` varchar(1024) DEFAULT NULL
|
||||
) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'none' REPLICA_NUM = NUM BLOCK_SIZE = SIZE USE_BLOOM_FILTER = FALSE TABLET_SIZE = SIZE PCTFREE = 10 TABLEGROUP = 'oceanbase'
|
||||
desc global_status;
|
||||
Field Type Null Key Default Extra
|
||||
VARIABLE_NAME varchar(128) NO
|
||||
VARIABLE_VALUE varchar(1024) YES NULL
|
||||
@ -0,0 +1,21 @@
|
||||
use information_schema;
|
||||
select variable_value from global_variables where variable_name = 'auto_increment_increment';
|
||||
variable_value
|
||||
1
|
||||
set @@session.auto_increment_increment = 10;
|
||||
select variable_value from global_variables where variable_name = 'auto_increment_increment';
|
||||
variable_value
|
||||
1
|
||||
set @@session.auto_increment_increment = 5;
|
||||
select variable_value from session_variables where variable_name = 'auto_increment_increment';
|
||||
variable_value
|
||||
5
|
||||
set @@global.auto_increment_increment = 1;
|
||||
set @@session.auto_increment_increment = 1;
|
||||
show create view global_variables;
|
||||
View Create View character_set_client collation_connection
|
||||
GLOBAL_VARIABLES CREATE VIEW `GLOBAL_VARIABLES` AS SELECT `variable_name` as VARIABLE_NAME, `value` as VARIABLE_VALUE FROM oceanbase.__tenant_virtual_global_variable utf8mb4 utf8mb4_general_ci
|
||||
desc global_variables;
|
||||
Field Type Null Key Default Extra
|
||||
VARIABLE_NAME varchar(128) NO
|
||||
VARIABLE_VALUE varchar(65536) YES NULL
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,40 @@
|
||||
drop table if exists pt1;
|
||||
create table pt1 (c1 int primary key, c2 int) partition by key(c1) partitions 3;
|
||||
select * from information_schema.partitions where table_name = 'pt1';
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PARTITION_NAME SUBPARTITION_NAME PARTITION_ORDINAL_POSITION SUBPARTITION_ORDINAL_POSITION PARTITION_METHOD SUBPARTITION_METHOD PARTITION_EXPRESSION SUBPARTITION_EXPRESSION PARTITION_DESCRIPTION TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE CREATE_TIME UPDATE_TIME CHECK_TIME CHECKSUM PARTITION_COMMENT NODEGROUP TABLESPACE_NAME
|
||||
def test pt1 p0 NULL 0 0 KEY NULL c1 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL default
|
||||
def test pt1 p1 NULL 1 0 KEY NULL c1 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL default
|
||||
def test pt1 p2 NULL 2 0 KEY NULL c1 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL default
|
||||
select table_schema, table_name from information_schema.partitions where table_name = 'pt1';
|
||||
table_schema table_name
|
||||
test pt1
|
||||
test pt1
|
||||
test pt1
|
||||
desc information_schema.partitions;
|
||||
Field Type Null Key Default Extra
|
||||
TABLE_CATALOG varchar(4096) NO
|
||||
TABLE_SCHEMA varchar(128) NO
|
||||
TABLE_NAME varchar(256) NO
|
||||
PARTITION_NAME varchar(64) YES NULL
|
||||
SUBPARTITION_NAME varchar(64) YES NULL
|
||||
PARTITION_ORDINAL_POSITION bigint(20) unsigned YES NULL
|
||||
SUBPARTITION_ORDINAL_POSITION bigint(20) unsigned YES NULL
|
||||
PARTITION_METHOD varchar(18) YES NULL
|
||||
SUBPARTITION_METHOD varchar(18) YES NULL
|
||||
PARTITION_EXPRESSION varchar(4096) YES NULL
|
||||
SUBPARTITION_EXPRESSION varchar(4096) YES NULL
|
||||
PARTITION_DESCRIPTION varchar(1024) YES NULL
|
||||
TABLE_ROWS bigint(20) unsigned NO 0
|
||||
AVG_ROW_LENGTH bigint(20) unsigned NO 0
|
||||
DATA_LENGTH bigint(20) unsigned NO 0
|
||||
MAX_DATA_LENGTH bigint(20) unsigned YES NULL
|
||||
INDEX_LENGTH bigint(20) unsigned NO 0
|
||||
DATA_FREE bigint(20) unsigned NO 0
|
||||
CREATE_TIME timestamp(6) YES NULL
|
||||
UPDATE_TIME timestamp(6) YES NULL
|
||||
CHECK_TIME timestamp(6) YES NULL
|
||||
CHECKSUM bigint(20) YES NULL
|
||||
PARTITION_COMMENT varchar(1024) NO
|
||||
NODEGROUP varchar(12) NO
|
||||
TABLESPACE_NAME varchar(128) YES NULL
|
||||
drop table pt1;
|
||||
@ -0,0 +1,15 @@
|
||||
use information_schema;
|
||||
select * from schemata limit 0;
|
||||
CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH DEFAULT_ENCRYPTION
|
||||
select schema_name from schemata;
|
||||
show create view schemata;
|
||||
View Create View character_set_client collation_connection
|
||||
SCHEMATA CREATE VIEW `SCHEMATA` AS SELECT 'def' AS CATALOG_NAME, DATABASE_NAME AS SCHEMA_NAME, 'utf8mb4' AS DEFAULT_CHARACTER_SET_NAME, 'utf8mb4_general_ci' AS DEFAULT_COLLATION_NAME, NULL AS SQL_PATH, 'NO' as DEFAULT_ENCRYPTION FROM oceanbase.__all_virtual_database a WHERE a.tenant_id = effective_tenant_id() and in_recyclebin = 0 and database_name != '__recyclebin' utf8mb4 utf8mb4_general_ci
|
||||
desc schemata;
|
||||
Field Type Null Key Default Extra
|
||||
CATALOG_NAME varchar(3) NO
|
||||
SCHEMA_NAME varchar(128) NO
|
||||
DEFAULT_CHARACTER_SET_NAME varchar(7) NO
|
||||
DEFAULT_COLLATION_NAME varchar(18) NO
|
||||
SQL_PATH null NO
|
||||
DEFAULT_ENCRYPTION varchar(2) NO
|
||||
@ -0,0 +1,14 @@
|
||||
use information_schema;
|
||||
select count(*) from global_status;
|
||||
count(*)
|
||||
2
|
||||
show create table global_status;
|
||||
Table Create Table
|
||||
GLOBAL_STATUS CREATE TABLE `GLOBAL_STATUS` (
|
||||
`VARIABLE_NAME` varchar(128) NOT NULL DEFAULT '',
|
||||
`VARIABLE_VALUE` varchar(1024) DEFAULT NULL
|
||||
) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'none' REPLICA_NUM = NUM BLOCK_SIZE = SIZE USE_BLOOM_FILTER = FALSE TABLET_SIZE = SIZE PCTFREE = 10 TABLEGROUP = 'oceanbase'
|
||||
desc global_status;
|
||||
Field Type Null Key Default Extra
|
||||
VARIABLE_NAME varchar(128) NO
|
||||
VARIABLE_VALUE varchar(1024) YES NULL
|
||||
@ -0,0 +1,24 @@
|
||||
use information_schema;
|
||||
select variable_value from session_variables where variable_name = 'auto_increment_increment';
|
||||
variable_value
|
||||
1
|
||||
set @@session.auto_increment_increment = 10;
|
||||
select variable_value from session_variables where variable_name = 'auto_increment_increment';
|
||||
variable_value
|
||||
10
|
||||
set @@global.auto_increment_increment = 5;
|
||||
select variable_value from session_variables where variable_name = 'auto_increment_increment';
|
||||
variable_value
|
||||
10
|
||||
set @@global.auto_increment_increment = 1;
|
||||
set @@session.auto_increment_increment = 1;
|
||||
show create table session_variables;
|
||||
Table Create Table
|
||||
SESSION_VARIABLES CREATE TABLE `SESSION_VARIABLES` (
|
||||
`VARIABLE_NAME` varchar(128) NOT NULL DEFAULT '',
|
||||
`VARIABLE_VALUE` varchar(1024) DEFAULT NULL
|
||||
) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'none' REPLICA_NUM = NUM BLOCK_SIZE = SIZE USE_BLOOM_FILTER = FALSE TABLET_SIZE = SIZE PCTFREE = 10 TABLEGROUP = 'oceanbase'
|
||||
desc session_variables;
|
||||
Field Type Null Key Default Extra
|
||||
VARIABLE_NAME varchar(128) NO
|
||||
VARIABLE_VALUE varchar(1024) YES NULL
|
||||
@ -0,0 +1,19 @@
|
||||
result_format: 4
|
||||
drop database if exists xiaofeng_db;
|
||||
create database xiaofeng_db;
|
||||
use xiaofeng_db;
|
||||
create table t1(c1 int primary key);
|
||||
create table t2(c1 int unique, c2 int, c3 varchar(10), c4 varchar(10), constraint test_for_table_constraints_check_name check(c3 = substr(c4, 1, 1)),
|
||||
constraint test_for_table_constraints_fk_name_1 foreign key (c1) references t1(c1),
|
||||
constraint test_for_table_constraints_fk_name_2 foreign key (c2) references t2(c1));
|
||||
select * from information_schema.table_constraints where CONSTRAINT_SCHEMA = 'xiaofeng_db';
|
||||
+--------------------+-------------------+---------------------------------------+--------------+------------+-----------------+
|
||||
| CONSTRAINT_CATALOG | CONSTRAINT_SCHEMA | CONSTRAINT_NAME | TABLE_SCHEMA | TABLE_NAME | CONSTRAINT_TYPE |
|
||||
+--------------------+-------------------+---------------------------------------+--------------+------------+-----------------+
|
||||
| def | xiaofeng_db | PRIMARY | xiaofeng_db | t1 | PRIMARY KEY |
|
||||
| def | xiaofeng_db | c1 | xiaofeng_db | t2 | UNIQUE |
|
||||
| def | xiaofeng_db | test_for_table_constraints_check_name | xiaofeng_db | t2 | CHECK |
|
||||
| def | xiaofeng_db | test_for_table_constraints_fk_name_2 | xiaofeng_db | t2 | FOREIGN KEY |
|
||||
| def | xiaofeng_db | test_for_table_constraints_fk_name_1 | xiaofeng_db | t2 | FOREIGN KEY |
|
||||
+--------------------+-------------------+---------------------------------------+--------------+------------+-----------------+
|
||||
drop database xiaofeng_db;
|
||||
@ -0,0 +1,33 @@
|
||||
create user tmp_user_test_user_priv identified by '123';
|
||||
create database test_user_priv_db;
|
||||
use test_user_priv_db;
|
||||
create table zhan_t1 (a int primary key, b int);
|
||||
show create table information_schema.table_privileges;
|
||||
Table Create Table
|
||||
TABLE_PRIVILEGES CREATE TABLE `TABLE_PRIVILEGES` (
|
||||
`GRANTEE` varchar(81) NOT NULL DEFAULT '',
|
||||
`TABLE_CATALOG` varchar(4096) NOT NULL DEFAULT '',
|
||||
`TABLE_SCHEMA` varchar(128) NOT NULL DEFAULT '',
|
||||
`TABLE_NAME` varchar(64) NOT NULL DEFAULT '',
|
||||
`PRIVILEGE_TYPE` varchar(64) NOT NULL DEFAULT '',
|
||||
`IS_GRANTABLE` varchar(3) NOT NULL DEFAULT ''
|
||||
) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'none' REPLICA_NUM = NUM BLOCK_SIZE = SIZE USE_BLOOM_FILTER = FALSE TABLET_SIZE = SIZE PCTFREE = 10 TABLEGROUP = 'oceanbase'
|
||||
desc information_schema.table_privileges;
|
||||
Field Type Null Key Default Extra
|
||||
GRANTEE varchar(81) NO
|
||||
TABLE_CATALOG varchar(4096) NO
|
||||
TABLE_SCHEMA varchar(128) NO
|
||||
TABLE_NAME varchar(64) NO
|
||||
PRIVILEGE_TYPE varchar(64) NO
|
||||
IS_GRANTABLE varchar(3) NO
|
||||
select * from information_schema.table_privileges where table_name = 'zhan_t1';
|
||||
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
|
||||
grant select on test_user_priv_db.zhan_t1 to tmp_user_test_user_priv;
|
||||
select * from information_schema.table_privileges where table_name = 'zhan_t1';
|
||||
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
|
||||
'tmp_user_test_user_priv'@'%' def test_user_priv_db zhan_t1 SELECT NO
|
||||
revoke select on test_user_priv_db.zhan_t1 from tmp_user_test_user_priv;
|
||||
select * from information_schema.table_privileges where table_name = 'zhan_t1';
|
||||
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
|
||||
drop database test_user_priv_db;
|
||||
drop user tmp_user_test_user_priv;
|
||||
@ -0,0 +1,28 @@
|
||||
use oceanbase;
|
||||
desc __tenant_virtual_event_name;
|
||||
Field Type Null Key Default Extra
|
||||
tenant_id bigint(20) NO NULL
|
||||
event_id bigint(20) NO NULL
|
||||
event# bigint(20) NO NULL
|
||||
name varchar(64) NO NULL
|
||||
display_name varchar(64) NO NULL
|
||||
parameter1 varchar(64) NO NULL
|
||||
parameter2 varchar(64) NO NULL
|
||||
parameter3 varchar(64) NO NULL
|
||||
wait_class_id bigint(20) NO NULL
|
||||
wait_class# bigint(20) NO NULL
|
||||
wait_class varchar(64) NO NULL
|
||||
desc v$event_name;
|
||||
Field Type Null Key Default Extra
|
||||
CON_ID bigint(20) NO NULL
|
||||
EVENT_ID bigint(20) NO NULL
|
||||
EVENT# bigint(20) NO NULL
|
||||
NAME varchar(64) NO NULL
|
||||
DISPLAY_NAME varchar(64) NO NULL
|
||||
PARAMETER1 varchar(64) NO NULL
|
||||
PARAMETER2 varchar(64) NO NULL
|
||||
PARAMETER3 varchar(64) NO NULL
|
||||
WAIT_CLASS_ID bigint(20) NO NULL
|
||||
WAIT_CLASS# bigint(20) NO NULL
|
||||
WAIT_CLASS varchar(64) NO NULL
|
||||
succeed
|
||||
@ -0,0 +1,8 @@
|
||||
desc oceanbase.__tenant_virtual_partition_stat;
|
||||
Field Type Null Key Default Extra
|
||||
table_id bigint(20) NO NULL
|
||||
partition_id bigint(20) NO NULL
|
||||
partition_cnt bigint(20) NO NULL
|
||||
row_count bigint(20) NO NULL
|
||||
diff_percentage bigint(20) NO NULL
|
||||
pass
|
||||
@ -0,0 +1,18 @@
|
||||
use oceanbase;
|
||||
desc __tenant_virtual_statname;
|
||||
Field Type Null Key Default Extra
|
||||
tenant_id bigint(20) NO NULL
|
||||
stat_id bigint(20) NO NULL
|
||||
statistic# bigint(20) NO NULL
|
||||
name varchar(64) NO NULL
|
||||
display_name varchar(64) NO NULL
|
||||
class bigint(20) NO NULL
|
||||
desc v$statname;
|
||||
Field Type Null Key Default Extra
|
||||
CON_ID bigint(20) NO NULL
|
||||
STAT_ID bigint(20) NO NULL
|
||||
STATISTIC# bigint(20) NO NULL
|
||||
NAME varchar(64) NO NULL
|
||||
DISPLAY_NAME varchar(64) NO NULL
|
||||
CLASS bigint(20) NO NULL
|
||||
succeed
|
||||
@ -0,0 +1,85 @@
|
||||
show create table information_schema.user_privileges;
|
||||
Table Create Table
|
||||
USER_PRIVILEGES CREATE TABLE `USER_PRIVILEGES` (
|
||||
`GRANTEE` varchar(81) NOT NULL DEFAULT '',
|
||||
`TABLE_CATALOG` varchar(4096) NOT NULL DEFAULT '',
|
||||
`PRIVILEGE_TYPE` varchar(64) NOT NULL DEFAULT '',
|
||||
`IS_GRANTABLE` varchar(3) NOT NULL DEFAULT ''
|
||||
) DEFAULT CHARSET = utf8mb4 COMPRESSION = 'none' REPLICA_NUM = NUM BLOCK_SIZE = SIZE USE_BLOOM_FILTER = FALSE TABLET_SIZE = SIZE PCTFREE = 10 TABLEGROUP = 'oceanbase'
|
||||
desc information_schema.user_privileges;
|
||||
Field Type Null Key Default Extra
|
||||
GRANTEE varchar(81) NO
|
||||
TABLE_CATALOG varchar(4096) NO
|
||||
PRIVILEGE_TYPE varchar(64) NO
|
||||
IS_GRANTABLE varchar(3) NO
|
||||
select * from information_schema.user_privileges where grantee like '%tmp_user_user_privileges%';
|
||||
GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
|
||||
create user tmp_user_user_privileges identified by '123';
|
||||
select * from information_schema.user_privileges where grantee like '%tmp_user_user_privileges%';
|
||||
GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
|
||||
'tmp_user_user_privileges'@'%' def USAGE NO
|
||||
grant select on *.* to tmp_user_user_privileges;
|
||||
select * from information_schema.user_privileges where grantee like '%tmp_user_user_privileges%';
|
||||
GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
|
||||
'tmp_user_user_privileges'@'%' def SELECT NO
|
||||
revoke select on *.* from tmp_user_user_privileges;
|
||||
select * from information_schema.user_privileges where grantee like '%tmp_user_user_privileges%';
|
||||
GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
|
||||
'tmp_user_user_privileges'@'%' def USAGE NO
|
||||
grant select on *.* to tmp_user_user_privileges with grant option;
|
||||
select * from information_schema.user_privileges where grantee like '%tmp_user_user_privileges%';
|
||||
GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
|
||||
'tmp_user_user_privileges'@'%' def SELECT YES
|
||||
revoke grant option on *.* from tmp_user_user_privileges;
|
||||
select * from information_schema.user_privileges where grantee like '%tmp_user_user_privileges%';
|
||||
GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
|
||||
'tmp_user_user_privileges'@'%' def SELECT NO
|
||||
revoke all on *.* from tmp_user_user_privileges;
|
||||
select * from information_schema.user_privileges where grantee like '%tmp_user_user_privileges%';
|
||||
GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
|
||||
'tmp_user_user_privileges'@'%' def USAGE NO
|
||||
drop user tmp_user_user_privileges;
|
||||
select * from information_schema.user_privileges where grantee like '%tmp_user_user_privileges%';
|
||||
GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
|
||||
select * from information_schema.user_privileges where grantee like '%root%' or grantee like '%admin%';
|
||||
GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
|
||||
'root'@'%' def ALTER YES
|
||||
'root'@'%' def CREATE YES
|
||||
'root'@'%' def CREATE USER YES
|
||||
'root'@'%' def DELETE YES
|
||||
'root'@'%' def DROP YES
|
||||
'root'@'%' def INSERT YES
|
||||
'root'@'%' def UPDATE YES
|
||||
'root'@'%' def SELECT YES
|
||||
'root'@'%' def INDEX YES
|
||||
'root'@'%' def CREATE VIEW YES
|
||||
'root'@'%' def SHOW VIEW YES
|
||||
'root'@'%' def SHOW DB YES
|
||||
'root'@'%' def SUPER YES
|
||||
'root'@'%' def PROCESS YES
|
||||
'root'@'%' def CREATE SYNONYM YES
|
||||
'root'@'%' def FILE YES
|
||||
'root'@'%' def ALTER TENANT YES
|
||||
'root'@'%' def ALTER SYSTEM YES
|
||||
'root'@'%' def CREATE RESOURCE POOL YES
|
||||
'root'@'%' def CREATE RESOURCE UNIT YES
|
||||
'admin'@'%' def ALTER YES
|
||||
'admin'@'%' def CREATE YES
|
||||
'admin'@'%' def CREATE USER YES
|
||||
'admin'@'%' def DELETE YES
|
||||
'admin'@'%' def DROP YES
|
||||
'admin'@'%' def INSERT YES
|
||||
'admin'@'%' def UPDATE YES
|
||||
'admin'@'%' def SELECT YES
|
||||
'admin'@'%' def INDEX YES
|
||||
'admin'@'%' def CREATE VIEW YES
|
||||
'admin'@'%' def SHOW VIEW YES
|
||||
'admin'@'%' def SHOW DB YES
|
||||
'admin'@'%' def SUPER YES
|
||||
'admin'@'%' def PROCESS YES
|
||||
'admin'@'%' def CREATE SYNONYM YES
|
||||
'admin'@'%' def FILE YES
|
||||
'admin'@'%' def ALTER TENANT YES
|
||||
'admin'@'%' def ALTER SYSTEM YES
|
||||
'admin'@'%' def CREATE RESOURCE POOL YES
|
||||
'admin'@'%' def CREATE RESOURCE UNIT YES
|
||||
File diff suppressed because one or more lines are too long
@ -0,0 +1,19 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner : nijia.nj
|
||||
#owner group : sql2
|
||||
#description : test oceanbase.__all_virtual_data_type
|
||||
|
||||
use oceanbase;
|
||||
|
||||
#basic
|
||||
select * from __all_virtual_data_type order by data_type;
|
||||
select data_type, data_type_str, data_type_class from __all_virtual_data_type order by data_type;
|
||||
select * from __all_virtual_data_type where data_type = 22;
|
||||
select a.data_type_str, b.data_type_class_str from __all_virtual_data_type a inner join __all_virtual_data_type_class b on a.data_type_class = b.data_type_class order by a.data_type;
|
||||
|
||||
#show
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create table __all_virtual_data_type;
|
||||
desc __all_virtual_data_type;
|
||||
@ -0,0 +1,19 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner : nijia.nj
|
||||
#owner group : sql2
|
||||
#description : test oceanbase.__all_virtual_data_type_class
|
||||
|
||||
use oceanbase;
|
||||
|
||||
#basic
|
||||
select * from __all_virtual_data_type_class;
|
||||
select data_type_class, data_type_class_str from __all_virtual_data_type_class;
|
||||
select * from __all_virtual_data_type_class where data_type_class = 10;
|
||||
select a.data_type_str, b.data_type_class_str from __all_virtual_data_type a inner join __all_virtual_data_type_class b on a.data_type_class = b.data_type_class order by a.data_type;
|
||||
|
||||
#show
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create table __all_virtual_data_type_class;
|
||||
desc __all_virtual_data_type_class;
|
||||
@ -0,0 +1,17 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner : nijia.nj
|
||||
#owner group : sql2
|
||||
#description : test oceanbase.__all_virtual_engine
|
||||
|
||||
use oceanbase;
|
||||
|
||||
#basic
|
||||
select * from __all_virtual_engine;
|
||||
select Engine, Support, Comment, Transactions, XA, Savepoints from __all_virtual_engine;
|
||||
|
||||
#show
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create table __all_virtual_engine;
|
||||
desc __all_virtual_engine;
|
||||
@ -0,0 +1,22 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: yuchen.wyc
|
||||
# owner group: SQL1
|
||||
# description: 虚拟表__tenant_virtual_interm_result的简单测试
|
||||
|
||||
select * from oceanbase.__tenant_virtual_interm_result where svr_ip = '0.0.0.0' and svr_port = 0;
|
||||
--disable_result_log
|
||||
select * from oceanbase.__tenant_virtual_interm_result;
|
||||
select * from oceanbase.__tenant_virtual_interm_result where svr_port > 0;
|
||||
select * from oceanbase.__tenant_virtual_interm_result where scanner_count > 0;
|
||||
select * from oceanbase.__tenant_virtual_interm_result where expire_time > 0;
|
||||
select * from oceanbase.__tenant_virtual_interm_result where used_memory_size > 0;
|
||||
select * from oceanbase.__tenant_virtual_interm_result where is_serving_tenant(svr_ip, svr_port, 1);
|
||||
select * from oceanbase.__tenant_virtual_interm_result where is_serving_tenant(svr_ip, svr_port, 1001);
|
||||
select is_serving_tenant(svr_ip, svr_port, 1), is_serving_tenant(svr_ip, svr_port, 1001) from oceanbase.__tenant_virtual_interm_result where is_serving_tenant(svr_ip, svr_port, 1);
|
||||
--sorted_result
|
||||
select svr_ip, svr_port from oceanbase.__tenant_virtual_interm_result group by svr_ip, svr_port having is_serving_tenant(svr_ip, svr_port, 1);
|
||||
select t1.svr_ip, t1.svr_port, t2.svr_ip, t2.svr_port from oceanbase.__tenant_virtual_interm_result t1 join oceanbase.__tenant_virtual_interm_result t2 on is_serving_tenant(t1.svr_ip, t2.svr_port, 1);
|
||||
--enable_result_log
|
||||
|
||||
@ -0,0 +1,54 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner : shanyan.g
|
||||
#owner group : transaction
|
||||
#description : 测试虚拟表__all_virtual_pg_partition_info
|
||||
|
||||
--disable_abort_on_error
|
||||
--disable_warnings
|
||||
|
||||
connect (conn_admin,$OBMYSQL_MS0,admin@sys,admin,*NO-ONE*,$OBMYSQL_PORT);
|
||||
|
||||
## case:检查表结构
|
||||
desc oceanbase.__all_virtual_pg_partition_info;
|
||||
|
||||
#测试PG内的表
|
||||
use test;
|
||||
create tablegroup tg1 binding true;
|
||||
create table test1 (id1 int, id2 int) tablegroup tg1;
|
||||
create table test2 (id1 int, id2 int) tablegroup tg1;
|
||||
|
||||
#创建非PG的表
|
||||
create table test3 (id1 int, id2 int);
|
||||
create table test4 (id1 int, id2 int);
|
||||
sleep 5;
|
||||
|
||||
#预期记录有1条
|
||||
select count(1) from oceanbase.__all_virtual_pg_partition_info
|
||||
where table_id in (select table_id from oceanbase.__all_virtual_table where table_name = 'test1') and partition_state = 'L_WORKING';
|
||||
select count(1) from oceanbase.__all_virtual_pg_partition_info
|
||||
where table_id in (select table_id from oceanbase.__all_virtual_table where table_name = 'test2') and partition_state = 'L_WORKING';
|
||||
select count(1) from oceanbase.__all_virtual_pg_partition_info
|
||||
where table_id in (select table_id from oceanbase.__all_virtual_table where table_name = 'test3') and partition_state = 'L_WORKING';
|
||||
select count(1) from oceanbase.__all_virtual_pg_partition_info
|
||||
where table_id in (select table_id from oceanbase.__all_virtual_table where table_name = 'test4') and partition_state = 'L_WORKING';
|
||||
|
||||
#预期记录有2条
|
||||
select count(1) from oceanbase.__all_virtual_pg_partition_info
|
||||
where tg_id in (select tablegroup_id as tg_id from oceanbase.__all_virtual_tablegroup where tablegroup_name = 'tg1') and partition_state = 'L_WORKING';
|
||||
|
||||
#根据all_virtual_partition_info来查询pg下的count数量,预期为2
|
||||
select pg_partition_count from oceanbase.__all_virtual_partition_info
|
||||
where table_id in (select tablegroup_id as table_id from oceanbase.__all_virtual_tablegroup where tablegroup_name = 'tg1') and partition_state = 'L_WORKING';
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists test1;
|
||||
drop table if exists test2;
|
||||
drop table if exists test3;
|
||||
drop table if exists test4;
|
||||
purge recyclebin;
|
||||
drop tablegroup tg1;
|
||||
--enable_warnings
|
||||
--enable_abort_on_error
|
||||
--enable_warnings
|
||||
@ -0,0 +1,23 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: guoping.wgp
|
||||
# owner group: SQL1
|
||||
# description: 测试虚拟表__all_virtual_sys_parameter_stat
|
||||
#tags : parameter
|
||||
|
||||
connect (my_obsys,$OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connection my_obsys;
|
||||
|
||||
select tenant_id, table_name from oceanbase.__all_virtual_table where table_name = '__all_virtual_sys_parameter_stat';
|
||||
use oceanbase;
|
||||
desc __all_virtual_sys_parameter_stat;
|
||||
select name from __all_virtual_sys_parameter_stat where name not like "module_test_%" group by name order by name;
|
||||
--sorted_result
|
||||
select section,info from oceanbase.__all_virtual_sys_parameter_stat where name like '%major%' group by name;
|
||||
|
||||
--disable_result_log
|
||||
show parameters;
|
||||
show parameters like '%log%';
|
||||
--enable_result_log
|
||||
disconnect my_obsys;
|
||||
@ -0,0 +1,19 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner : zhenjiang.xzj
|
||||
#owner group : STORAGE
|
||||
#description : 测试虚拟表__all_virtual_upgrade_inspection
|
||||
|
||||
--disable_abort_on_error
|
||||
--disable_warnings
|
||||
#检查表结构
|
||||
#login into the sys tenant
|
||||
connect (conn_admin,$OBMYSQL_MS0,admin@sys,admin,*NO-ONE*,$OBMYSQL_PORT);
|
||||
|
||||
desc oceanbase.__all_virtual_upgrade_inspection;
|
||||
|
||||
--disable_result_log
|
||||
|
||||
--enable_result_log
|
||||
select * from oceanbase.__all_virtual_upgrade_inspection;
|
||||
@ -0,0 +1,19 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner : nijia.nj
|
||||
#owner group : sql2
|
||||
#description : test information_schema.character_sets
|
||||
|
||||
use information_schema;
|
||||
|
||||
#basic
|
||||
select * from character_sets;
|
||||
select character_set_name, default_collate_name, description, maxlen from character_sets;
|
||||
select maxlen from character_sets;
|
||||
select * from character_sets where character_set_name like '%binary%';
|
||||
|
||||
#show
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create table character_sets;
|
||||
desc character_sets;
|
||||
@ -0,0 +1,18 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner : xiaofeng.lby
|
||||
#owner group : sql2
|
||||
#desription : test collation_character_set_applicability
|
||||
|
||||
use information_schema;
|
||||
|
||||
select * from collation_character_set_applicability;
|
||||
select COLLATION_NAME, CHARACTER_SET_NAME from collation_character_set_applicability;
|
||||
select COLLATION_NAME from collation_character_set_applicability;
|
||||
select CHARACTER_SET_NAME from collation_character_set_applicability;
|
||||
select * from collation_character_set_applicability where COLLATION_NAME = 'utf8mb4_bin';
|
||||
|
||||
desc collation_character_set_applicability;
|
||||
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner : nijia.nj
|
||||
#owner group : sql2
|
||||
#description : test information_schema.collations
|
||||
|
||||
use information_schema;
|
||||
|
||||
#basic
|
||||
select * from collations;
|
||||
select collation_name, character_set_name, id, is_default, is_compiled, sortlen from collations;
|
||||
select * from collations where collation_name like '%utf8%';
|
||||
|
||||
#show
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create table collations;
|
||||
desc collations;
|
||||
@ -0,0 +1,16 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner : nijia.nj
|
||||
#owner group : sql2
|
||||
#description : test information_schema.global_status
|
||||
|
||||
use information_schema;
|
||||
|
||||
#basic
|
||||
select count(*) from global_status;
|
||||
|
||||
#show
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create table global_status;
|
||||
desc global_status;
|
||||
@ -0,0 +1,24 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner : nijia.nj
|
||||
#owner group : sql2
|
||||
#description : test information_schema.global_variables
|
||||
|
||||
use information_schema;
|
||||
|
||||
#basic
|
||||
let $old_global_increment = query_get_value(select variable_value from global_variables where variable_name = 'auto_increment_increment', variable_value, 1);
|
||||
let $old_session_increment = query_get_value(select variable_value from session_variables where variable_name = 'auto_increment_increment', variable_value, 1);
|
||||
select variable_value from global_variables where variable_name = 'auto_increment_increment';
|
||||
set @@session.auto_increment_increment = 10;
|
||||
select variable_value from global_variables where variable_name = 'auto_increment_increment';
|
||||
set @@session.auto_increment_increment = 5;
|
||||
select variable_value from session_variables where variable_name = 'auto_increment_increment';
|
||||
eval set @@global.auto_increment_increment = $old_global_increment;
|
||||
eval set @@session.auto_increment_increment = $old_session_increment;
|
||||
|
||||
#show
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create view global_variables;
|
||||
desc global_variables;
|
||||
@ -0,0 +1,757 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: yanmu.ztl
|
||||
#owner group: SQL2
|
||||
# tags: optimizer
|
||||
#description: 该case是为了验证内部表是否符合规范
|
||||
## 规范: 1.基础系统表保持OB既有风格,以’__all_’开头,统一用单数、主动、第一人称一般时(不搞ing、ed、s等)
|
||||
## 2.虚拟表保持OB既有风格,以’__all_virtual’或者’__tenant_virtual’开头,统一用单数、主动、第一人称一般时(不搞ing、ed、s等)。__all_virtual为展示系统内部信息的虚拟表,支持直接查询,可基于此建立兼容其他数据库的视图;__tenant_virtual虚拟表为支持特定操作(如show)而创建的,一般不支持直接查询。
|
||||
## 3.基础系统表和虚拟表属OB系统内部实现,其定义要考虑版本平滑升级和扩展性的需要,不建议DBA及普通用户直接使用这两类对象。后续会增加对该类对象可见性的控制,在通常的show table等外部命令的一般性输出中不显示内部对象。
|
||||
## 4.明确_all_table对象的类型,区分基础系统表、用户表、虚拟表、系统视图、用户视图,同时确认各种对象table_id的范围符合设计。
|
||||
## 5.提供给DBA普通用户的信息,通过定义相应的视图来实现。视图的命名规则及模式按照需要兼容的目标数据库的相应视图来确定,保持定义的稳定。除MySQL兼容的视图外,系统诊断信息相关的视图,命名统一采用类Oracle的方式。
|
||||
## 6.虚拟表的名称和字段进行局部调整,如对于需要展示集群所有节点信息的虚拟表,统一使用server的唯一标识(`svr_ip`, `svr_port`)为分区键,部分特定的字段名称也加以统一(当前某些地方用host/port,有些用svr_ip/svr_port);如果虚拟表包含`tenant_id`, `svr_ip`, `svr_port`字段,则主键包含这些字段。
|
||||
##
|
||||
|
||||
##over all test
|
||||
connect (obsys1,$OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connection obsys1;
|
||||
use oceanbase;
|
||||
|
||||
set @@ob_query_timeout = 10000000000;
|
||||
set @@ob_log_level = 'WARN';
|
||||
|
||||
##overall check
|
||||
select 0xffffffffff & table_id, table_name, table_type, database_id, part_num from oceanbase.__all_virtual_table where table_type in (0,1,2) order by 1,2;
|
||||
|
||||
##check count and table_id range (0, 10000] for inner sys table
|
||||
let $sys_table_count = query_get_value(select count(table_id) from __all_virtual_table where table_type=0, count(table_id), 1);
|
||||
let $sys_table_count_with_tid = query_get_value(select count(table_id) from __all_virtual_table where table_type=0 and (0xffffffffff & table_id) <= 10000, count(table_id), 1);
|
||||
if ($sys_table_count == $sys_table_count_with_tid)
|
||||
{
|
||||
--echo check sys table count and table_id range success
|
||||
}
|
||||
|
||||
##check count and table_id range (10000, 20000] for inner virtual table
|
||||
let $virtual_table_count = query_get_value(select count(table_id) from __all_virtual_table where table_type=2, count(table_id), 1);
|
||||
let $virtual_table_count_with_tid = query_get_value(select count(table_id) from __all_virtual_table where table_type=2 and (0xffffffffff & table_id) > 10000 and (0xffffffffff & table_id) <= 20000, count(table_id), 1);
|
||||
if ($virtual_table_count == $virtual_table_count_with_tid)
|
||||
{
|
||||
--echo check count and table_id range for virtual table success
|
||||
}
|
||||
|
||||
##check count and table_id range (10000, 20000] for inner view
|
||||
let $view_count = query_get_value(select count(table_id) from __all_virtual_table where table_type=1, count(table_id), 1);
|
||||
let $view_count_with_tid = query_get_value(select count(table_id) from __all_virtual_table where table_type=1 and (0xffffffffff & table_id) > 20000 and (0xffffffffff & table_id) <= 30000, count(table_id), 1);
|
||||
if ($view_table_count == $view_count_with_tid)
|
||||
{
|
||||
--echo check count and table_id range for view success
|
||||
}
|
||||
|
||||
##
|
||||
## Check all sys tables created before 2018-11-15, new table added after this date should
|
||||
## add it's own case, can not depends on this hot point any more.
|
||||
##
|
||||
## table list are selected by: select concat(a, ".", b) from (select d.database_name a, t.table_name b from __all_virtual_database d, __all_virtual_table t where t.database_id = d.database_id and t.table_type in (0, 1, 2) and t.table_name not in ('__tenant_virtual_all_table','__tenant_virtual_current_tenant','__tenant_virtual_show_create_table','__tenant_virtual_show_create_database','__tenant_virtual_table_column','__all_virtual_proxy_schema', '__all_virtual_proxy_partition_info', '__all_virtual_proxy_partition', '__all_virtual_proxy_sub_partition', '__all_virtual_proxy_route','__tenant_virtual_show_create_procedure', '__all_virtual_partition_location', '__tenant_virtual_show_tables', '__tenant_virtual_show_create_tablegroup') order by 1,2) x;
|
||||
#
|
||||
|
||||
desc information_schema.CHARACTER_SETS;
|
||||
desc information_schema.COLLATIONS;
|
||||
desc information_schema.COLLATION_CHARACTER_SET_APPLICABILITY;
|
||||
desc information_schema.COLUMNS;
|
||||
desc information_schema.DBA_OUTLINES;
|
||||
desc information_schema.ENGINES;
|
||||
desc information_schema.GLOBAL_STATUS;
|
||||
desc information_schema.GLOBAL_VARIABLES;
|
||||
desc information_schema.KEY_COLUMN_USAGE;
|
||||
desc information_schema.PARAMETERS;
|
||||
desc information_schema.PARTITIONS;
|
||||
desc information_schema.PROCESSLIST;
|
||||
desc information_schema.ROUTINES;
|
||||
desc information_schema.SCHEMATA;
|
||||
desc information_schema.SCHEMA_PRIVILEGES;
|
||||
desc information_schema.SESSION_STATUS;
|
||||
desc information_schema.SESSION_VARIABLES;
|
||||
desc information_schema.STATISTICS;
|
||||
desc information_schema.TABLES;
|
||||
desc information_schema.TABLE_CONSTRAINTS;
|
||||
desc information_schema.TABLE_PRIVILEGES;
|
||||
desc information_schema.USER_PRIVILEGES;
|
||||
desc information_schema.USER_RECYCLEBIN;
|
||||
desc information_schema.VIEWS;
|
||||
desc information_schema.TRIGGERS;
|
||||
desc mysql.db;
|
||||
desc mysql.proc;
|
||||
desc mysql.time_zone;
|
||||
desc mysql.time_zone_name;
|
||||
desc mysql.time_zone_transition;
|
||||
desc mysql.time_zone_transition_type;
|
||||
desc mysql.user;
|
||||
desc oceanbase.gv$concurrent_limit_sql;
|
||||
desc oceanbase.gv$database;
|
||||
desc oceanbase.gv$latch;
|
||||
desc oceanbase.gv$lock_wait_stat;
|
||||
desc oceanbase.gv$memory;
|
||||
desc oceanbase.gv$memstore;
|
||||
desc oceanbase.gv$memstore_info;
|
||||
desc oceanbase.gv$obrpc_incoming;
|
||||
desc oceanbase.gv$obrpc_outgoing;
|
||||
desc oceanbase.gv$outline;
|
||||
desc oceanbase.gv$partition;
|
||||
desc oceanbase.gv$plan_cache_plan_explain;
|
||||
desc oceanbase.gv$plan_cache_plan_stat;
|
||||
desc oceanbase.gv$plan_cache_stat;
|
||||
desc oceanbase.gv$server_memstore;
|
||||
desc oceanbase.gv$session_event;
|
||||
desc oceanbase.gv$session_longops;
|
||||
desc oceanbase.gv$session_wait;
|
||||
desc oceanbase.gv$session_wait_history;
|
||||
desc oceanbase.gv$sql;
|
||||
desc oceanbase.gv$sql_audit;
|
||||
desc oceanbase.gv$sql_monitor;
|
||||
desc oceanbase.gv$sql_plan_monitor;
|
||||
desc oceanbase.gv$sql_plan_statistics;
|
||||
desc oceanbase.gv$sysstat;
|
||||
desc oceanbase.gv$system_event;
|
||||
desc oceanbase.gv$table;
|
||||
desc oceanbase.gv$tenant;
|
||||
desc oceanbase.gv$tenant_memstore_allocator_info;
|
||||
desc oceanbase.gv$tenant_sequence_object;
|
||||
desc oceanbase.gv$unit;
|
||||
desc oceanbase.gv$unit_load_balance_event_history;
|
||||
desc oceanbase.v$event_name;
|
||||
desc oceanbase.v$latch;
|
||||
desc oceanbase.v$lock_wait_stat;
|
||||
desc oceanbase.v$memory;
|
||||
desc oceanbase.v$memstore;
|
||||
desc oceanbase.v$memstore_info;
|
||||
desc oceanbase.v$obrpc_incoming;
|
||||
desc oceanbase.v$obrpc_outgoing;
|
||||
desc oceanbase.v$partition;
|
||||
desc oceanbase.v$plan_cache_plan_explain;
|
||||
desc oceanbase.v$plan_cache_plan_stat;
|
||||
desc oceanbase.v$plan_cache_stat;
|
||||
desc oceanbase.v$session_event;
|
||||
desc oceanbase.v$session_longops;
|
||||
desc oceanbase.v$session_wait;
|
||||
desc oceanbase.v$session_wait_history;
|
||||
desc oceanbase.v$sql;
|
||||
desc oceanbase.v$sql_audit;
|
||||
desc oceanbase.v$sql_monitor;
|
||||
desc oceanbase.v$sql_plan_monitor;
|
||||
desc oceanbase.v$sql_plan_statistics;
|
||||
desc oceanbase.v$statname;
|
||||
desc oceanbase.v$sysstat;
|
||||
desc oceanbase.v$system_event;
|
||||
desc oceanbase.v$tenant_memstore_allocator_info;
|
||||
desc oceanbase.v$unit;
|
||||
desc oceanbase.gv$tenant_px_worker_stat;
|
||||
desc oceanbase.v$tenant_px_worker_stat;
|
||||
desc oceanbase.__all_acquired_snapshot;
|
||||
desc oceanbase.__all_build_index_param;
|
||||
desc oceanbase.__all_charset;
|
||||
desc oceanbase.__all_clog_history_info;
|
||||
desc oceanbase.__all_clog_history_info_v2;
|
||||
desc oceanbase.__all_collation;
|
||||
desc oceanbase.__all_column_history;
|
||||
desc oceanbase.__all_column_stat;
|
||||
desc oceanbase.__all_column_statistic;
|
||||
desc oceanbase.__all_constraint;
|
||||
desc oceanbase.__all_constraint_history;
|
||||
desc oceanbase.__all_database;
|
||||
desc oceanbase.__all_database_history;
|
||||
desc oceanbase.__all_database_privilege;
|
||||
desc oceanbase.__all_database_privilege_history;
|
||||
desc oceanbase.__all_ddl_id;
|
||||
desc oceanbase.__all_def_sub_part;
|
||||
desc oceanbase.__all_def_sub_part_history;
|
||||
desc oceanbase.__all_dummy;
|
||||
desc oceanbase.__all_election_event_history;
|
||||
desc oceanbase.__all_foreign_key;
|
||||
desc oceanbase.__all_foreign_key_column;
|
||||
desc oceanbase.__all_foreign_key_column_history;
|
||||
desc oceanbase.__all_foreign_key_history;
|
||||
desc oceanbase.__all_frozen_map;
|
||||
desc oceanbase.__all_func;
|
||||
desc oceanbase.__all_func_history;
|
||||
desc oceanbase.__all_global_index_data_src;
|
||||
desc oceanbase.__all_histogram_stat;
|
||||
desc oceanbase.__all_immediate_effect_index_sstable;
|
||||
desc oceanbase.__all_index_build_stat;
|
||||
desc oceanbase.__all_index_checksum;
|
||||
desc oceanbase.__all_index_schedule_task;
|
||||
desc oceanbase.__all_index_wait_transaction_status;
|
||||
desc oceanbase.__all_local_index_status;
|
||||
desc oceanbase.__all_meta_table;
|
||||
desc oceanbase.__all_ori_schema_version;
|
||||
desc oceanbase.__all_outline;
|
||||
desc oceanbase.__all_outline_history;
|
||||
desc oceanbase.__all_package;
|
||||
desc oceanbase.__all_package_history;
|
||||
desc oceanbase.__all_part;
|
||||
desc oceanbase.__all_part_history;
|
||||
desc oceanbase.__all_part_info;
|
||||
desc oceanbase.__all_part_info_history;
|
||||
desc oceanbase.__all_privilege;
|
||||
desc oceanbase.__all_recyclebin;
|
||||
desc oceanbase.__all_resource_pool;
|
||||
desc oceanbase.__all_restore_job;
|
||||
desc oceanbase.__all_restore_job_history;
|
||||
desc oceanbase.__all_restore_task;
|
||||
desc oceanbase.__all_rootservice_event_history;
|
||||
desc oceanbase.__all_rootservice_job;
|
||||
desc oceanbase.__all_routine;
|
||||
desc oceanbase.__all_routine_history;
|
||||
desc oceanbase.__all_routine_param;
|
||||
desc oceanbase.__all_routine_param_history;
|
||||
desc oceanbase.__all_sequence;
|
||||
desc oceanbase.__all_sequence_object;
|
||||
desc oceanbase.__all_sequence_object_history;
|
||||
desc oceanbase.__all_sequence_v2;
|
||||
desc oceanbase.__all_sequence_value;
|
||||
desc oceanbase.__all_server;
|
||||
desc oceanbase.__all_server_event_history;
|
||||
desc oceanbase.__all_sql_execute_task;
|
||||
desc oceanbase.__all_sstable_checksum;
|
||||
desc oceanbase.__all_sstable_column_checksum;
|
||||
desc oceanbase.__all_sub_part;
|
||||
desc oceanbase.__all_sub_part_history;
|
||||
desc oceanbase.__all_synonym;
|
||||
desc oceanbase.__all_synonym_history;
|
||||
desc oceanbase.__all_sys_parameter;
|
||||
desc oceanbase.__all_sys_stat;
|
||||
desc oceanbase.__all_sys_variable;
|
||||
desc oceanbase.__all_sys_variable_history;
|
||||
desc oceanbase.__all_tablegroup;
|
||||
desc oceanbase.__all_tablegroup_history;
|
||||
desc oceanbase.__all_table_history;
|
||||
desc oceanbase.__all_table_privilege;
|
||||
desc oceanbase.__all_table_privilege_history;
|
||||
desc oceanbase.__all_table_stat;
|
||||
desc oceanbase.__all_temp_table;
|
||||
desc oceanbase.__all_tenant;
|
||||
desc oceanbase.__all_tenant_gc_partition_info;
|
||||
desc oceanbase.__all_tenant_history;
|
||||
desc oceanbase.__all_tenant_meta_table;
|
||||
desc oceanbase.__all_tenant_resource_usage;
|
||||
desc oceanbase.__all_time_zone;
|
||||
desc oceanbase.__all_time_zone_name;
|
||||
desc oceanbase.__all_time_zone_transition;
|
||||
desc oceanbase.__all_time_zone_transition_type;
|
||||
desc oceanbase.__all_unit;
|
||||
desc oceanbase.__all_unit_config;
|
||||
desc oceanbase.__all_unit_load_history;
|
||||
desc oceanbase.__all_user;
|
||||
desc oceanbase.__all_user_history;
|
||||
desc oceanbase.__all_virtual_bad_block_table;
|
||||
desc oceanbase.__all_virtual_clog_stat;
|
||||
desc oceanbase.__all_virtual_concurrency_object_pool;
|
||||
desc oceanbase.__all_virtual_core_all_table;
|
||||
desc oceanbase.__all_virtual_core_column_table;
|
||||
desc oceanbase.__all_virtual_core_meta_table;
|
||||
desc oceanbase.__all_virtual_core_root_table;
|
||||
desc oceanbase.__all_virtual_data_type;
|
||||
desc oceanbase.__all_virtual_data_type_class;
|
||||
desc oceanbase.__all_virtual_disk_stat;
|
||||
desc oceanbase.__all_virtual_election_group_info;
|
||||
desc oceanbase.__all_virtual_election_info;
|
||||
desc oceanbase.__all_virtual_election_mem_stat;
|
||||
desc oceanbase.__all_virtual_election_priority;
|
||||
desc oceanbase.__all_virtual_engine;
|
||||
desc oceanbase.__all_virtual_freeze_info;
|
||||
desc oceanbase.__all_virtual_io_stat;
|
||||
desc oceanbase.__all_virtual_kvcache_info;
|
||||
desc oceanbase.__all_virtual_latch;
|
||||
desc oceanbase.__all_virtual_leader_stat;
|
||||
desc oceanbase.__all_virtual_lock_wait_stat;
|
||||
desc oceanbase.__all_virtual_long_ops_status;
|
||||
desc oceanbase.__all_virtual_macro_block_marker_status;
|
||||
desc oceanbase.__all_virtual_memory_info;
|
||||
desc oceanbase.__all_virtual_memstore_info;
|
||||
desc oceanbase.__all_virtual_mem_leak_checker_info;
|
||||
desc oceanbase.__all_virtual_meta_table;
|
||||
desc oceanbase.__all_virtual_obrpc_stat;
|
||||
desc oceanbase.__all_virtual_partition_amplification_stat;
|
||||
desc oceanbase.__all_virtual_partition_info;
|
||||
desc oceanbase.__all_virtual_partition_item;
|
||||
desc oceanbase.__all_virtual_partition_migration_status;
|
||||
desc oceanbase.__all_virtual_partition_replay_status;
|
||||
desc oceanbase.__all_virtual_partition_split_info;
|
||||
desc oceanbase.__all_virtual_partition_sstable_image_info;
|
||||
desc oceanbase.__all_virtual_partition_sstable_macro_info;
|
||||
desc oceanbase.__all_virtual_partition_sstable_merge_info;
|
||||
desc oceanbase.__all_virtual_partition_store_info;
|
||||
desc oceanbase.__all_virtual_partition_table;
|
||||
desc oceanbase.__all_virtual_partition_table_store_stat;
|
||||
desc oceanbase.__all_virtual_plan_cache_plan_explain;
|
||||
desc oceanbase.__all_virtual_plan_cache_stat;
|
||||
desc oceanbase.__all_virtual_plan_stat;
|
||||
desc oceanbase.__all_virtual_processlist;
|
||||
desc oceanbase.__all_virtual_proxy_server_stat;
|
||||
desc oceanbase.__all_virtual_proxy_sys_variable;
|
||||
desc oceanbase.__all_virtual_px_worker_stat;
|
||||
desc oceanbase.__all_virtual_rebalance_map_item_stat;
|
||||
desc oceanbase.__all_virtual_rebalance_map_stat;
|
||||
desc oceanbase.__all_virtual_rebalance_replica_stat;
|
||||
desc oceanbase.__all_virtual_rebalance_task_stat;
|
||||
desc oceanbase.__all_virtual_rebalance_tenant_stat;
|
||||
desc oceanbase.__all_virtual_rebalance_unit_distribution_stat;
|
||||
desc oceanbase.__all_virtual_rebalance_unit_migrate_stat;
|
||||
desc oceanbase.__all_virtual_rebalance_unit_stat;
|
||||
desc oceanbase.__all_virtual_replica_task;
|
||||
desc oceanbase.__all_virtual_rootservice_stat;
|
||||
desc oceanbase.__all_virtual_sequence_v2;
|
||||
desc oceanbase.__all_virtual_server_blacklist;
|
||||
desc oceanbase.__all_virtual_server_clog_stat;
|
||||
desc oceanbase.__all_virtual_server_memory_info;
|
||||
desc oceanbase.__all_virtual_server_object_pool;
|
||||
desc oceanbase.__all_virtual_server_stat;
|
||||
desc oceanbase.__all_virtual_session_event;
|
||||
desc oceanbase.__all_virtual_session_wait;
|
||||
desc oceanbase.__all_virtual_session_wait_history;
|
||||
desc oceanbase.__all_virtual_sesstat;
|
||||
desc oceanbase.__all_virtual_sql_audit;
|
||||
desc oceanbase.__all_virtual_sql_monitor;
|
||||
desc oceanbase.__all_virtual_sql_plan_monitor;
|
||||
desc oceanbase.__all_virtual_sql_plan_statistics;
|
||||
desc oceanbase.__all_virtual_storage_stat;
|
||||
desc oceanbase.__all_virtual_sysstat;
|
||||
desc oceanbase.__all_virtual_system_event;
|
||||
desc oceanbase.__all_virtual_sys_parameter_stat;
|
||||
desc oceanbase.__all_virtual_sys_task_status;
|
||||
desc oceanbase.__all_virtual_table_mgr;
|
||||
desc oceanbase.__all_virtual_tenant_disk_stat;
|
||||
desc oceanbase.__all_virtual_tenant_memstore_allocator_info;
|
||||
desc oceanbase.__all_virtual_tenant_memstore_info;
|
||||
desc oceanbase.__all_virtual_tenant_stat;
|
||||
desc oceanbase.__all_virtual_trace_log;
|
||||
desc oceanbase.__all_virtual_trans_audit;
|
||||
desc oceanbase.__all_virtual_trans_lock_stat;
|
||||
desc oceanbase.__all_virtual_trans_mem_stat;
|
||||
desc oceanbase.__all_virtual_trans_mgr_stat;
|
||||
desc oceanbase.__all_virtual_trans_result_info_stat;
|
||||
desc oceanbase.__all_virtual_trans_sql_audit;
|
||||
desc oceanbase.__all_virtual_trans_stat;
|
||||
desc oceanbase.__all_virtual_upgrade_inspection;
|
||||
desc oceanbase.__all_virtual_zone_stat;
|
||||
desc oceanbase.__all_zone;
|
||||
desc oceanbase.__tenant_virtual_charset;
|
||||
desc oceanbase.__tenant_virtual_collation;
|
||||
desc oceanbase.__tenant_virtual_concurrent_limit_sql;
|
||||
desc oceanbase.__tenant_virtual_database_status;
|
||||
desc oceanbase.__tenant_virtual_event_name;
|
||||
desc oceanbase.__tenant_virtual_global_variable;
|
||||
desc oceanbase.__tenant_virtual_interm_result;
|
||||
desc oceanbase.__tenant_virtual_outline;
|
||||
desc oceanbase.__tenant_virtual_partition_stat;
|
||||
desc oceanbase.__tenant_virtual_privilege_grant;
|
||||
desc oceanbase.__tenant_virtual_session_variable;
|
||||
desc oceanbase.__tenant_virtual_statname;
|
||||
desc oceanbase.__tenant_virtual_table_index;
|
||||
desc oceanbase.__tenant_virtual_tenant_status;
|
||||
desc oceanbase.__tenant_virtual_warning;
|
||||
|
||||
--disable_result_log
|
||||
select * from information_schema.CHARACTER_SETS limit 1;
|
||||
select * from information_schema.COLLATIONS limit 1;
|
||||
select * from information_schema.COLLATION_CHARACTER_SET_APPLICABILITY limit 1;
|
||||
select * from information_schema.COLUMNS limit 1;
|
||||
select * from information_schema.DBA_OUTLINES limit 1;
|
||||
select * from information_schema.ENGINES limit 1;
|
||||
select * from information_schema.GLOBAL_STATUS limit 1;
|
||||
select * from information_schema.GLOBAL_VARIABLES limit 1;
|
||||
select * from information_schema.KEY_COLUMN_USAGE limit 1;
|
||||
select * from information_schema.PARAMETERS limit 1;
|
||||
select * from information_schema.PARTITIONS limit 1;
|
||||
select * from information_schema.PROCESSLIST limit 1;
|
||||
select * from information_schema.ROUTINES limit 1;
|
||||
select * from information_schema.SCHEMATA limit 1;
|
||||
select * from information_schema.SCHEMA_PRIVILEGES limit 1;
|
||||
select * from information_schema.SESSION_STATUS limit 1;
|
||||
select * from information_schema.SESSION_VARIABLES limit 1;
|
||||
select * from information_schema.STATISTICS limit 1;
|
||||
select * from information_schema.TABLES limit 1;
|
||||
select * from information_schema.TABLE_CONSTRAINTS limit 1;
|
||||
select * from information_schema.TABLE_PRIVILEGES limit 1;
|
||||
select * from information_schema.USER_PRIVILEGES limit 1;
|
||||
select * from information_schema.USER_RECYCLEBIN limit 1;
|
||||
select * from information_schema.VIEWS limit 1;
|
||||
select * from information_schema.TRIGGERS limit 1;
|
||||
select * from mysql.db limit 1;
|
||||
select * from mysql.proc limit 1;
|
||||
select * from mysql.time_zone limit 1;
|
||||
select * from mysql.time_zone_name limit 1;
|
||||
select * from mysql.time_zone_transition limit 1;
|
||||
select * from mysql.time_zone_transition_type limit 1;
|
||||
select * from mysql.user limit 1;
|
||||
select * from oceanbase.gv$concurrent_limit_sql limit 1;
|
||||
select * from oceanbase.gv$database limit 1;
|
||||
select * from oceanbase.gv$latch limit 1;
|
||||
select * from oceanbase.gv$lock_wait_stat limit 1;
|
||||
select * from oceanbase.gv$memory limit 1;
|
||||
select * from oceanbase.gv$memstore limit 1;
|
||||
select * from oceanbase.gv$memstore_info limit 1;
|
||||
select * from oceanbase.gv$obrpc_incoming limit 1;
|
||||
select * from oceanbase.gv$obrpc_outgoing limit 1;
|
||||
select * from oceanbase.gv$outline limit 1;
|
||||
select * from oceanbase.gv$partition limit 1;
|
||||
select * from oceanbase.gv$plan_cache_plan_explain limit 1;
|
||||
select * from oceanbase.gv$plan_cache_plan_stat limit 1;
|
||||
select * from oceanbase.gv$plan_cache_stat limit 1;
|
||||
select * from oceanbase.gv$server_memstore limit 1;
|
||||
select * from oceanbase.gv$session_event limit 1;
|
||||
select * from oceanbase.gv$session_longops limit 1;
|
||||
select * from oceanbase.gv$session_wait limit 1;
|
||||
select * from oceanbase.gv$session_wait_history limit 1;
|
||||
select * from oceanbase.gv$sql limit 1;
|
||||
select * from oceanbase.gv$sql_audit limit 1;
|
||||
select * from oceanbase.gv$sql_monitor limit 1;
|
||||
select * from oceanbase.gv$sql_plan_monitor limit 1;
|
||||
select * from oceanbase.gv$sql_plan_statistics limit 1;
|
||||
select * from oceanbase.gv$sysstat limit 1;
|
||||
select * from oceanbase.gv$system_event limit 1;
|
||||
select * from oceanbase.gv$table limit 1;
|
||||
select * from oceanbase.gv$tenant limit 1;
|
||||
select * from oceanbase.gv$tenant_memstore_allocator_info limit 1;
|
||||
select * from oceanbase.gv$tenant_sequence_object limit 1;
|
||||
select * from oceanbase.gv$unit limit 1;
|
||||
select * from oceanbase.gv$unit_load_balance_event_history limit 1;
|
||||
select * from oceanbase.gv$tenant_px_worker_stat limit 1;
|
||||
select * from oceanbase.v$tenant_px_worker_stat limit 1;
|
||||
select * from oceanbase.v$event_name limit 1;
|
||||
select * from oceanbase.v$latch limit 1;
|
||||
select * from oceanbase.v$lock_wait_stat limit 1;
|
||||
select * from oceanbase.v$memory limit 1;
|
||||
select * from oceanbase.v$memstore limit 1;
|
||||
select * from oceanbase.v$memstore_info limit 1;
|
||||
select * from oceanbase.v$obrpc_incoming limit 1;
|
||||
select * from oceanbase.v$obrpc_outgoing limit 1;
|
||||
select * from oceanbase.v$partition limit 1;
|
||||
select * from oceanbase.v$plan_cache_plan_explain limit 1;
|
||||
select * from oceanbase.v$plan_cache_plan_stat limit 1;
|
||||
select * from oceanbase.v$plan_cache_stat limit 1;
|
||||
select * from oceanbase.v$session_longops limit 1;
|
||||
select * from oceanbase.v$session_wait limit 1;
|
||||
select * from oceanbase.v$session_wait_history limit 1;
|
||||
select * from oceanbase.v$sql limit 1;
|
||||
select * from oceanbase.v$sql_audit limit 1;
|
||||
select * from oceanbase.v$sql_monitor limit 1;
|
||||
select * from oceanbase.v$sql_plan_monitor limit 1;
|
||||
select * from oceanbase.v$sql_plan_statistics limit 1;
|
||||
select * from oceanbase.v$statname limit 1;
|
||||
select * from oceanbase.v$sysstat limit 1;
|
||||
select * from oceanbase.v$system_event limit 1;
|
||||
select * from oceanbase.v$tenant_memstore_allocator_info limit 1;
|
||||
select * from oceanbase.v$unit limit 1;
|
||||
select * from oceanbase.__all_acquired_snapshot limit 1;
|
||||
select * from oceanbase.__all_build_index_param limit 1;
|
||||
select * from oceanbase.__all_charset limit 1;
|
||||
select * from oceanbase.__all_clog_history_info limit 1;
|
||||
select * from oceanbase.__all_clog_history_info_v2 limit 1;
|
||||
select * from oceanbase.__all_collation limit 1;
|
||||
select * from oceanbase.__all_virtual_column_history limit 1;
|
||||
select * from oceanbase.__all_virtual_column_stat limit 1;
|
||||
select * from oceanbase.__all_virtual_column_statistic limit 1;
|
||||
select * from oceanbase.__all_virtual_constraint limit 1;
|
||||
select * from oceanbase.__all_virtual_constraint_history limit 1;
|
||||
select * from oceanbase.__all_virtual_database limit 1;
|
||||
select * from oceanbase.__all_virtual_database_history limit 1;
|
||||
select * from oceanbase.__all_virtual_database_privilege limit 1;
|
||||
select * from oceanbase.__all_virtual_database_privilege_history limit 1;
|
||||
select * from oceanbase.__all_ddl_id limit 1;
|
||||
select * from oceanbase.__all_virtual_def_sub_part limit 1;
|
||||
select * from oceanbase.__all_virtual_def_sub_part_history limit 1;
|
||||
select * from oceanbase.__all_dummy limit 1;
|
||||
select * from oceanbase.__all_election_event_history limit 1;
|
||||
select * from oceanbase.__all_virtual_foreign_key limit 1;
|
||||
select * from oceanbase.__all_virtual_foreign_key_column limit 1;
|
||||
select * from oceanbase.__all_virtual_foreign_key_column_history limit 1;
|
||||
select * from oceanbase.__all_virtual_foreign_key_history limit 1;
|
||||
select * from oceanbase.__all_frozen_map limit 1;
|
||||
select * from oceanbase.__all_virtual_func limit 1;
|
||||
select * from oceanbase.__all_virtual_func_history limit 1;
|
||||
select * from oceanbase.__all_global_index_data_src limit 1;
|
||||
select * from oceanbase.__all_virtual_histogram_stat limit 1;
|
||||
select * from oceanbase.__all_immediate_effect_index_sstable limit 1;
|
||||
select * from oceanbase.__all_index_build_stat limit 1;
|
||||
select * from oceanbase.__all_index_checksum limit 1;
|
||||
select * from oceanbase.__all_index_schedule_task limit 1;
|
||||
select * from oceanbase.__all_index_wait_transaction_status limit 1;
|
||||
select * from oceanbase.__all_local_index_status limit 1;
|
||||
select * from oceanbase.__all_meta_table limit 1;
|
||||
select * from oceanbase.__all_virtual_ori_schema_version limit 1;
|
||||
select * from oceanbase.__all_virtual_outline limit 1;
|
||||
select * from oceanbase.__all_virtual_outline_history limit 1;
|
||||
select * from oceanbase.__all_virtual_package limit 1;
|
||||
select * from oceanbase.__all_virtual_package_history limit 1;
|
||||
select * from oceanbase.__all_virtual_part limit 1;
|
||||
select * from oceanbase.__all_virtual_part_history limit 1;
|
||||
select * from oceanbase.__all_virtual_part_info limit 1;
|
||||
select * from oceanbase.__all_virtual_part_info_history limit 1;
|
||||
select * from oceanbase.__all_privilege limit 1;
|
||||
select * from oceanbase.__all_virtual_recyclebin limit 1;
|
||||
select * from oceanbase.__all_resource_pool limit 1;
|
||||
select * from oceanbase.__all_restore_job limit 1;
|
||||
select * from oceanbase.__all_restore_job_history limit 1;
|
||||
select * from oceanbase.__all_restore_task limit 1;
|
||||
select * from oceanbase.__all_rootservice_event_history limit 1;
|
||||
select * from oceanbase.__all_rootservice_job limit 1;
|
||||
select * from oceanbase.__all_virtual_routine limit 1;
|
||||
select * from oceanbase.__all_virtual_routine_history limit 1;
|
||||
select * from oceanbase.__all_virtual_routine_param limit 1;
|
||||
select * from oceanbase.__all_virtual_routine_param_history limit 1;
|
||||
select * from oceanbase.__all_sequence limit 1;
|
||||
select * from oceanbase.__all_virtual_sequence_object limit 1;
|
||||
select * from oceanbase.__all_virtual_sequence_object_history limit 1;
|
||||
select * from oceanbase.__all_sequence_v2 limit 1;
|
||||
select * from oceanbase.__all_virtual_sequence_value limit 1;
|
||||
select * from oceanbase.__all_server limit 1;
|
||||
select * from oceanbase.__all_server_event_history limit 1;
|
||||
select * from oceanbase.__all_sql_execute_task limit 1;
|
||||
select * from oceanbase.__all_sstable_checksum limit 1;
|
||||
select * from oceanbase.__all_sstable_column_checksum limit 1;
|
||||
select * from oceanbase.__all_virtual_sub_part limit 1;
|
||||
select * from oceanbase.__all_virtual_sub_part_history limit 1;
|
||||
select * from oceanbase.__all_virtual_synonym limit 1;
|
||||
select * from oceanbase.__all_virtual_synonym_history limit 1;
|
||||
select * from oceanbase.__all_sys_parameter limit 1;
|
||||
select * from oceanbase.__all_virtual_sys_stat limit 1;
|
||||
select * from oceanbase.__all_virtual_sys_variable limit 1;
|
||||
select * from oceanbase.__all_virtual_sys_variable_history limit 1;
|
||||
select * from oceanbase.__all_virtual_tablegroup limit 1;
|
||||
select * from oceanbase.__all_virtual_tablegroup_history limit 1;
|
||||
select * from oceanbase.__all_virtual_table_history limit 1;
|
||||
select * from oceanbase.__all_virtual_table_privilege limit 1;
|
||||
select * from oceanbase.__all_virtual_table_privilege_history limit 1;
|
||||
select * from oceanbase.__all_virtual_table_stat limit 1;
|
||||
select * from oceanbase.__all_virtual_temp_table limit 1;
|
||||
select * from oceanbase.__all_tenant limit 1;
|
||||
select * from oceanbase.__all_tenant_gc_partition_info limit 1;
|
||||
select * from oceanbase.__all_tenant_history limit 1;
|
||||
select * from oceanbase.__all_tenant_meta_table limit 1;
|
||||
select * from oceanbase.__all_tenant_resource_usage limit 1;
|
||||
select * from oceanbase.__all_time_zone limit 1;
|
||||
select * from oceanbase.__all_time_zone_name limit 1;
|
||||
select * from oceanbase.__all_time_zone_transition limit 1;
|
||||
select * from oceanbase.__all_time_zone_transition_type limit 1;
|
||||
select * from oceanbase.__all_unit limit 1;
|
||||
select * from oceanbase.__all_unit_config limit 1;
|
||||
select * from oceanbase.__all_unit_load_history limit 1;
|
||||
select * from oceanbase.__all_virtual_user limit 1;
|
||||
select * from oceanbase.__all_virtual_user_history limit 1;
|
||||
select * from oceanbase.__all_virtual_bad_block_table limit 1;
|
||||
select * from oceanbase.__all_virtual_clog_stat limit 1;
|
||||
select * from oceanbase.__all_virtual_concurrency_object_pool limit 1;
|
||||
select * from oceanbase.__all_virtual_core_all_table limit 1;
|
||||
select * from oceanbase.__all_virtual_core_column_table limit 1;
|
||||
select * from oceanbase.__all_virtual_core_meta_table limit 1;
|
||||
select * from oceanbase.__all_virtual_core_root_table limit 1;
|
||||
select * from oceanbase.__all_virtual_data_type limit 1;
|
||||
select * from oceanbase.__all_virtual_data_type_class limit 1;
|
||||
select * from oceanbase.__all_virtual_disk_stat limit 1;
|
||||
select * from oceanbase.__all_virtual_election_group_info limit 1;
|
||||
select * from oceanbase.__all_virtual_election_info limit 1;
|
||||
select * from oceanbase.__all_virtual_election_mem_stat limit 1;
|
||||
select * from oceanbase.__all_virtual_election_priority limit 1;
|
||||
select * from oceanbase.__all_virtual_engine limit 1;
|
||||
select * from oceanbase.__all_virtual_freeze_info limit 1;
|
||||
select * from oceanbase.__all_virtual_io_stat limit 1;
|
||||
select * from oceanbase.__all_virtual_kvcache_info limit 1;
|
||||
select * from oceanbase.__all_virtual_latch limit 1;
|
||||
select * from oceanbase.__all_virtual_leader_stat limit 1;
|
||||
select * from oceanbase.__all_virtual_lock_wait_stat limit 1;
|
||||
select * from oceanbase.__all_virtual_long_ops_status limit 1;
|
||||
select * from oceanbase.__all_virtual_macro_block_marker_status limit 1;
|
||||
select * from oceanbase.__all_virtual_memory_info limit 1;
|
||||
select * from oceanbase.__all_virtual_memstore_info limit 1;
|
||||
select * from oceanbase.__all_virtual_mem_leak_checker_info limit 1;
|
||||
select * from oceanbase.__all_virtual_meta_table limit 1;
|
||||
select * from oceanbase.__all_virtual_obrpc_stat limit 1;
|
||||
select * from oceanbase.__all_virtual_partition_amplification_stat limit 1;
|
||||
select * from oceanbase.__all_virtual_partition_info limit 1;
|
||||
select * from oceanbase.__all_virtual_partition_item limit 1;
|
||||
select * from oceanbase.__all_virtual_partition_migration_status limit 1;
|
||||
select * from oceanbase.__all_virtual_partition_replay_status limit 1;
|
||||
select * from oceanbase.__all_virtual_partition_split_info limit 1;
|
||||
select * from oceanbase.__all_virtual_partition_sstable_image_info limit 1;
|
||||
select * from oceanbase.__all_virtual_partition_sstable_macro_info limit 1;
|
||||
select * from oceanbase.__all_virtual_partition_sstable_merge_info limit 1;
|
||||
select * from oceanbase.__all_virtual_partition_store_info limit 1;
|
||||
select * from oceanbase.__all_virtual_partition_table limit 1;
|
||||
select * from oceanbase.__all_virtual_partition_table_store_stat limit 1;
|
||||
select * from oceanbase.__all_virtual_plan_cache_plan_explain limit 1;
|
||||
select * from oceanbase.__all_virtual_plan_cache_stat limit 1;
|
||||
select * from oceanbase.__all_virtual_plan_stat limit 1;
|
||||
select * from oceanbase.__all_virtual_processlist limit 1;
|
||||
select * from oceanbase.__all_virtual_proxy_server_stat limit 1;
|
||||
select * from oceanbase.__all_virtual_proxy_sys_variable limit 1;
|
||||
select * from oceanbase.__all_virtual_px_worker_stat limit 1;
|
||||
select * from oceanbase.__all_virtual_rebalance_map_item_stat limit 1;
|
||||
select * from oceanbase.__all_virtual_rebalance_map_stat limit 1;
|
||||
select * from oceanbase.__all_virtual_rebalance_replica_stat limit 1;
|
||||
select * from oceanbase.__all_virtual_rebalance_task_stat limit 1;
|
||||
select * from oceanbase.__all_virtual_rebalance_tenant_stat limit 1;
|
||||
select * from oceanbase.__all_virtual_rebalance_unit_distribution_stat limit 1;
|
||||
select * from oceanbase.__all_virtual_rebalance_unit_migrate_stat limit 1;
|
||||
select * from oceanbase.__all_virtual_rebalance_unit_stat limit 1;
|
||||
select * from oceanbase.__all_virtual_replica_task limit 1;
|
||||
select * from oceanbase.__all_virtual_rootservice_stat limit 1;
|
||||
select * from oceanbase.__all_sequence_v2 limit 1;
|
||||
select * from oceanbase.__all_virtual_server_blacklist limit 1;
|
||||
select * from oceanbase.__all_virtual_server_clog_stat limit 1;
|
||||
select * from oceanbase.__all_virtual_server_memory_info limit 1;
|
||||
select * from oceanbase.__all_virtual_server_object_pool limit 1;
|
||||
select * from oceanbase.__all_virtual_server_stat limit 1;
|
||||
select * from oceanbase.__all_virtual_session_event limit 1;
|
||||
select * from oceanbase.__all_virtual_session_wait limit 1;
|
||||
select * from oceanbase.__all_virtual_session_wait_history limit 1;
|
||||
select * from oceanbase.__all_virtual_sesstat limit 1;
|
||||
select * from oceanbase.__all_virtual_sql_audit limit 1;
|
||||
select * from oceanbase.__all_virtual_sql_monitor limit 1;
|
||||
select * from oceanbase.__all_virtual_sql_plan_monitor limit 1;
|
||||
select * from oceanbase.__all_virtual_sql_plan_statistics limit 1;
|
||||
select * from oceanbase.__all_virtual_storage_stat limit 1;
|
||||
select * from oceanbase.__all_virtual_sysstat limit 1;
|
||||
select * from oceanbase.__all_virtual_system_event limit 1;
|
||||
select * from oceanbase.__all_virtual_sys_parameter_stat limit 1;
|
||||
select * from oceanbase.__all_virtual_sys_task_status limit 1;
|
||||
select * from oceanbase.__all_virtual_table_mgr limit 1;
|
||||
select * from oceanbase.__all_virtual_tenant_disk_stat limit 1;
|
||||
select * from oceanbase.__all_virtual_tenant_memstore_allocator_info limit 1;
|
||||
select * from oceanbase.__all_virtual_tenant_memstore_info limit 1;
|
||||
select * from oceanbase.__all_virtual_tenant_stat limit 1;
|
||||
#bug: https://work.aone.alibaba-inc.com/issue/27146409
|
||||
#select * from oceanbase.__all_virtual_trace_log limit 1;
|
||||
select * from oceanbase.__all_virtual_trans_audit limit 1;
|
||||
select * from oceanbase.__all_virtual_trans_lock_stat limit 1;
|
||||
select * from oceanbase.__all_virtual_trans_mem_stat limit 1;
|
||||
select * from oceanbase.__all_virtual_trans_mgr_stat limit 1;
|
||||
select * from oceanbase.__all_virtual_trans_result_info_stat limit 1;
|
||||
select * from oceanbase.__all_virtual_trans_sql_audit limit 1;
|
||||
select * from oceanbase.__all_virtual_trans_stat limit 1;
|
||||
select * from oceanbase.__all_virtual_upgrade_inspection limit 1;
|
||||
select * from oceanbase.__all_virtual_zone_stat limit 1;
|
||||
select * from oceanbase.__all_zone limit 1;
|
||||
select * from oceanbase.__tenant_virtual_charset limit 1;
|
||||
select * from oceanbase.__tenant_virtual_collation limit 1;
|
||||
select * from oceanbase.__tenant_virtual_concurrent_limit_sql limit 1;
|
||||
select * from oceanbase.__tenant_virtual_database_status limit 1;
|
||||
select * from oceanbase.__tenant_virtual_event_name limit 1;
|
||||
select * from oceanbase.__tenant_virtual_global_variable limit 1;
|
||||
select * from oceanbase.__tenant_virtual_interm_result limit 1;
|
||||
select * from oceanbase.__tenant_virtual_outline limit 1;
|
||||
select * from oceanbase.__tenant_virtual_partition_stat limit 1;
|
||||
select * from oceanbase.__tenant_virtual_privilege_grant limit 1;
|
||||
select * from oceanbase.__tenant_virtual_session_variable limit 1;
|
||||
select * from oceanbase.__tenant_virtual_statname limit 1;
|
||||
select * from oceanbase.__tenant_virtual_table_index limit 1;
|
||||
select * from oceanbase.__tenant_virtual_tenant_status limit 1;
|
||||
select * from oceanbase.__tenant_virtual_warning limit 1;
|
||||
--enable_result_log
|
||||
|
||||
## Test all performance built-in views
|
||||
#--enable_query_log
|
||||
#################################
|
||||
# init variables
|
||||
#################################
|
||||
#let $cpu = 1;
|
||||
#let $memory = 1073741824;
|
||||
#let $min_memory = 1073741824;
|
||||
#let $disk = 536870912;
|
||||
#let $iops = 128;
|
||||
#let $session = 64;
|
||||
#let $zone_name=query_get_value(select zone from oceanbase.__all_zone where zone != '' limit 1, zone, 1);
|
||||
|
||||
#################################
|
||||
# clean up
|
||||
#################################
|
||||
#--disable_warnings
|
||||
#drop tenant if exists te1 force;
|
||||
#drop resource pool if exists pool_te1;
|
||||
#drop resource unit if exists box_te1;
|
||||
|
||||
#################################
|
||||
## create resource unit
|
||||
#################################
|
||||
#eval create resource unit box_te1 max_cpu $cpu, max_memory $memory, max_iops $iops, max_disk_size $disk, max_session_num $session, MIN_CPU=1, MIN_MEMORY=$min_memory, MIN_IOPS=128;
|
||||
|
||||
#################################
|
||||
## create resource pool
|
||||
#################################
|
||||
#--disable_query_log
|
||||
#eval create resource pool pool_te1 unit = 'box_te1', unit_num = 1, zone_list = ('$zone_name');
|
||||
#--enable_query_log
|
||||
|
||||
#################################
|
||||
## create tenant
|
||||
#################################
|
||||
#--enable_warnings
|
||||
#--disable_query_log
|
||||
#eval create tenant te1 replica_num = 1, primary_zone='$zone_name', resource_pool_list=('pool_te1') set ob_tcp_invited_nodes='%';
|
||||
#--source mysql_test/include/check_tenant_sync.inc
|
||||
#--enable_query_log
|
||||
#let $__tenant_name__ = 'te1';
|
||||
#--source mysql_test/include/get_tenant_server.inc
|
||||
#connect (conn1,$TE_SERVER_IP,root@te1,,*NO-ONE*,$TE_SERVER_PORT);
|
||||
|
||||
#################################
|
||||
## TEST
|
||||
#################################
|
||||
## expect all '0'
|
||||
#set ob_query_timeout = 100000000;
|
||||
#select count(*) from oceanbase.gv$memory where tenant_id != effective_tenant_id();
|
||||
#select count(*) from oceanbase.gv$memstore where tenant_id != effective_tenant_id();
|
||||
#select count(*) from oceanbase.gv$memstore_info where tenant_id != effective_tenant_id();
|
||||
#select count(*) from oceanbase.gv$sql where CON_ID != effective_tenant_id();
|
||||
#select count(*) from oceanbase.gv$plan_cache_stat where tenant_id != effective_tenant_id();
|
||||
#select count(*) from oceanbase.gv$sysstat where con_id != effective_tenant_id();
|
||||
#select count(*) from oceanbase.gv$system_event where con_id != effective_tenant_id();
|
||||
#select count(*) from oceanbase.v$memory where tenant_id != effective_tenant_id();
|
||||
#select count(*) from oceanbase.v$memstore where tenant_id != effective_tenant_id();
|
||||
#select count(*) from oceanbase.v$memstore_info where tenant_id != effective_tenant_id();
|
||||
#select count(*) from oceanbase.v$sysstat where con_id != effective_tenant_id();
|
||||
#select count(*) from oceanbase.v$system_event where con_id != effective_tenant_id();
|
||||
|
||||
#################################
|
||||
## check dictionary table
|
||||
#################################
|
||||
#select EVENT_ID, NAME, WAIT_CLASS_ID from oceanbase.v$event_name order by EVENT_ID, NAME;
|
||||
#select STAT_ID, NAME, CLASS from oceanbase.v$statname order by STAT_ID, NAME;
|
||||
|
||||
## expect all '1'
|
||||
#connect (conn2,$OBMYSQL_MS0,root@sys,,*NO-ONE*,$OBMYSQL_PORT);
|
||||
#set ob_query_timeout = 100000000;
|
||||
#select count(*) > 0 from oceanbase.gv$memory where tenant_id != effective_tenant_id();
|
||||
#select count(*) > 0 from oceanbase.gv$memory where tenant_id != effective_tenant_id();
|
||||
#select count(*) > 0 from oceanbase.gv$memstore where tenant_id != effective_tenant_id();
|
||||
#select count(*) > 0 from oceanbase.gv$memstore_info where tenant_id != effective_tenant_id();
|
||||
#select count(*) > 0 from oceanbase.gv$sql where CON_ID != effective_tenant_id();
|
||||
#select count(*) > 0 from oceanbase.gv$plan_cache_stat where tenant_id != effective_tenant_id();
|
||||
#select count(*) > 0 from oceanbase.gv$sysstat where con_id != effective_tenant_id();
|
||||
#select count(*) > 0 from oceanbase.gv$system_event where con_id != effective_tenant_id();
|
||||
#select count(*) > 0 from oceanbase.v$memory where tenant_id != effective_tenant_id();
|
||||
|
||||
#################################
|
||||
## check dictionary table
|
||||
#################################
|
||||
#select EVENT_ID, NAME, WAIT_CLASS_ID from oceanbase.v$event_name order by EVENT_ID, NAME;
|
||||
#select STAT_ID, NAME, CLASS from oceanbase.v$statname order by STAT_ID, NAME;
|
||||
|
||||
|
||||
#################################
|
||||
## cleanup
|
||||
#################################
|
||||
|
||||
#--disable_warnings
|
||||
#drop tenant if exists te1 force;
|
||||
#drop resource pool pool_te1;
|
||||
#drop resource unit box_te1;
|
||||
#--enable_warnings
|
||||
#--disable_query_log
|
||||
|
||||
#--disable_query_log
|
||||
#--disable_result_log
|
||||
#sleep 20;
|
||||
#--enable_result_log
|
||||
#--enable_query_log
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner : xiaofeng.lby
|
||||
#owner group : sql2
|
||||
#description : test information_schema.partitions
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists pt1;
|
||||
--enable_warnings
|
||||
create table pt1 (c1 int primary key, c2 int) partition by key(c1) partitions 3;
|
||||
select * from information_schema.partitions where table_name = 'pt1';
|
||||
select table_schema, table_name from information_schema.partitions where table_name = 'pt1';
|
||||
desc information_schema.partitions;
|
||||
drop table pt1;
|
||||
@ -0,0 +1,15 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner : nijia.nj
|
||||
#owner group : sql2
|
||||
#description : test information_schema.schemata
|
||||
|
||||
use information_schema;
|
||||
select * from schemata limit 0;
|
||||
--disable_result_log
|
||||
select schema_name from schemata;
|
||||
--enable_result_log
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create view schemata;
|
||||
desc schemata;
|
||||
@ -0,0 +1,16 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner : nijia.nj
|
||||
#owner group : sql2
|
||||
#description : test information_schema.global_status
|
||||
|
||||
use information_schema;
|
||||
|
||||
#basic
|
||||
select count(*) from global_status;
|
||||
|
||||
#show
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create table global_status;
|
||||
desc global_status;
|
||||
@ -0,0 +1,24 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner : nijia.nj
|
||||
#owner group : sql2
|
||||
#description : test information_schema.session_variables
|
||||
|
||||
use information_schema;
|
||||
|
||||
#basic
|
||||
let $old_global_increment = query_get_value(select variable_value from global_variables where variable_name = 'auto_increment_increment', variable_value, 1);
|
||||
let $old_session_increment = query_get_value(select variable_value from session_variables where variable_name = 'auto_increment_increment', variable_value, 1);
|
||||
select variable_value from session_variables where variable_name = 'auto_increment_increment';
|
||||
set @@session.auto_increment_increment = 10;
|
||||
select variable_value from session_variables where variable_name = 'auto_increment_increment';
|
||||
set @@global.auto_increment_increment = 5;
|
||||
select variable_value from session_variables where variable_name = 'auto_increment_increment';
|
||||
eval set @@global.auto_increment_increment = $old_global_increment;
|
||||
eval set @@session.auto_increment_increment = $old_session_increment;
|
||||
|
||||
#show
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create table session_variables;
|
||||
desc session_variables;
|
||||
@ -0,0 +1,19 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner : xiaofeng.lby
|
||||
#owner group : sql2
|
||||
#description : test information_schema.table_constraints
|
||||
--result_format 4
|
||||
|
||||
--disable_warnings
|
||||
drop database if exists xiaofeng_db;
|
||||
--enable_warnings
|
||||
create database xiaofeng_db;
|
||||
use xiaofeng_db;
|
||||
create table t1(c1 int primary key);
|
||||
create table t2(c1 int unique, c2 int, c3 varchar(10), c4 varchar(10), constraint test_for_table_constraints_check_name check(c3 = substr(c4, 1, 1)),
|
||||
constraint test_for_table_constraints_fk_name_1 foreign key (c1) references t1(c1),
|
||||
constraint test_for_table_constraints_fk_name_2 foreign key (c2) references t2(c1));
|
||||
select * from information_schema.table_constraints where CONSTRAINT_SCHEMA = 'xiaofeng_db';
|
||||
drop database xiaofeng_db;
|
||||
@ -0,0 +1,39 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner : xinqi.zlm
|
||||
#owner group : sql1
|
||||
#description : test information_schema.
|
||||
|
||||
create user tmp_user_test_user_priv identified by '123';
|
||||
create database test_user_priv_db;
|
||||
use test_user_priv_db;
|
||||
create table zhan_t1 (a int primary key, b int);
|
||||
|
||||
#table format
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create table information_schema.table_privileges;
|
||||
desc information_schema.table_privileges;
|
||||
|
||||
#should be empty
|
||||
select * from information_schema.table_privileges where table_name = 'zhan_t1';
|
||||
|
||||
#grant
|
||||
grant select on test_user_priv_db.zhan_t1 to tmp_user_test_user_priv;
|
||||
|
||||
|
||||
#should be one row
|
||||
--real_sleep 3
|
||||
select * from information_schema.table_privileges where table_name = 'zhan_t1';
|
||||
#revoke
|
||||
revoke select on test_user_priv_db.zhan_t1 from tmp_user_test_user_priv;
|
||||
|
||||
#should be empty
|
||||
--real_sleep 3
|
||||
select * from information_schema.table_privileges where table_name = 'zhan_t1';
|
||||
|
||||
#cleanup
|
||||
--disable_warnings
|
||||
drop database test_user_priv_db;
|
||||
drop user tmp_user_test_user_priv;
|
||||
--enable_warnings
|
||||
@ -0,0 +1,24 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: xiaoyi.xy
|
||||
#owner group : storage
|
||||
#description : __tenant_virtual_event_name
|
||||
|
||||
--disable_abort_on_error
|
||||
--disable_warnings
|
||||
|
||||
use oceanbase;
|
||||
desc __tenant_virtual_event_name;
|
||||
desc v$event_name;
|
||||
|
||||
--disable_result_log
|
||||
let $idx1 = query_get_value(select count(*) from oceanbase.__tenant_virtual_event_name,count(*),1);
|
||||
--enable_result_log
|
||||
if($idx1)
|
||||
{
|
||||
--echo succeed
|
||||
}
|
||||
--enable_abort_on_error
|
||||
--enable_warnings
|
||||
|
||||
@ -0,0 +1,22 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner : zhenjiang.xzj
|
||||
#owner group : STORAGE
|
||||
#description : 测试虚拟表__tenant_virtual_partition_stat
|
||||
|
||||
--disable_abort_on_error
|
||||
--disable_warnings
|
||||
#检查表结构
|
||||
desc oceanbase.__tenant_virtual_partition_stat;
|
||||
|
||||
--disable_result_log
|
||||
|
||||
#login into the sys tenant
|
||||
connect (conn_admin,$OBMYSQL_MS0,admin@sys,admin,*NO-ONE*,$OBMYSQL_PORT);
|
||||
|
||||
let $cnt = query_get_value(select count(*) from oceanbase.__tenant_virtual_partition_stat, count(*), 1);
|
||||
if ($cnt != 0)
|
||||
{
|
||||
echo pass;
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner: xiaoyi.xy
|
||||
#owner group : storage
|
||||
#description : __tenant_virtual_statname
|
||||
|
||||
--disable_abort_on_error
|
||||
--disable_warnings
|
||||
|
||||
use oceanbase;
|
||||
desc __tenant_virtual_statname;
|
||||
desc v$statname;
|
||||
|
||||
--disable_result_log
|
||||
let $idx1 = query_get_value(select count(*) from oceanbase.__tenant_virtual_statname,count(*),1);
|
||||
--enable_result_log
|
||||
if($idx1)
|
||||
{
|
||||
--echo succeed
|
||||
}
|
||||
--enable_abort_on_error
|
||||
--enable_warnings
|
||||
|
||||
@ -0,0 +1,63 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner : xinqi.zlm
|
||||
#owner group : sql1
|
||||
#description : test information_schema.user_privileges
|
||||
|
||||
|
||||
#table format
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create table information_schema.user_privileges;
|
||||
desc information_schema.user_privileges;
|
||||
|
||||
#should be empty
|
||||
select * from information_schema.user_privileges where grantee like '%tmp_user_user_privileges%';
|
||||
|
||||
#new user
|
||||
create user tmp_user_user_privileges identified by '123';
|
||||
--real_sleep 3
|
||||
select * from information_schema.user_privileges where grantee like '%tmp_user_user_privileges%';
|
||||
|
||||
|
||||
#grant
|
||||
grant select on *.* to tmp_user_user_privileges;
|
||||
#should be one row
|
||||
--real_sleep 3
|
||||
select * from information_schema.user_privileges where grantee like '%tmp_user_user_privileges%';
|
||||
|
||||
#revoke
|
||||
revoke select on *.* from tmp_user_user_privileges;
|
||||
#should be USAGE only
|
||||
--real_sleep 3
|
||||
select * from information_schema.user_privileges where grantee like '%tmp_user_user_privileges%';
|
||||
|
||||
|
||||
|
||||
#grant option test
|
||||
grant select on *.* to tmp_user_user_privileges with grant option;
|
||||
--real_sleep 3
|
||||
select * from information_schema.user_privileges where grantee like '%tmp_user_user_privileges%';
|
||||
|
||||
revoke grant option on *.* from tmp_user_user_privileges;
|
||||
--real_sleep 3
|
||||
select * from information_schema.user_privileges where grantee like '%tmp_user_user_privileges%';
|
||||
revoke all on *.* from tmp_user_user_privileges;
|
||||
--real_sleep 3
|
||||
select * from information_schema.user_privileges where grantee like '%tmp_user_user_privileges%';
|
||||
|
||||
#clean up
|
||||
--disable_warnings
|
||||
drop user tmp_user_user_privileges;
|
||||
--enable_warnings
|
||||
|
||||
#should be empty
|
||||
--real_sleep 3
|
||||
select * from information_schema.user_privileges where grantee like '%tmp_user_user_privileges%';
|
||||
|
||||
#test root & admin
|
||||
--real_sleep 3
|
||||
select * from information_schema.user_privileges where grantee like '%root%' or grantee like '%admin%';
|
||||
|
||||
|
||||
|
||||
17
tools/deploy/mysql_test/test_suite/inner_table/t/views.test
Normal file
17
tools/deploy/mysql_test/test_suite/inner_table/t/views.test
Normal file
@ -0,0 +1,17 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
#owner : xiaofeng.lby
|
||||
#owner group : sql2
|
||||
#description : test information_schema.views
|
||||
|
||||
connect (obsys,$OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connection obsys;
|
||||
use information_schema;
|
||||
select * from views order by table_name desc;
|
||||
select table_schema, table_name from views order by table_name desc;
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create view views;
|
||||
desc views;
|
||||
disconnect obsys;
|
||||
connection default;
|
||||
File diff suppressed because it is too large
Load Diff
1696
tools/deploy/mysql_test/test_suite/join/r/mysql/join_merge.result
Normal file
1696
tools/deploy/mysql_test/test_suite/join/r/mysql/join_merge.result
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,120 @@
|
||||
result_format: 4
|
||||
explain_protocol: 2
|
||||
drop table if exists t1,t2;
|
||||
create table t1 (id int primary key, i2 int);
|
||||
create table t2 (id int primary key, i2 int);
|
||||
insert/*trace*/ into t1(id) values (75);
|
||||
insert/*trace*/ into t1(id) values (79);
|
||||
insert/*trace*/ into t1(id) values (78);
|
||||
insert/*trace*/ into t1(id) values (77);
|
||||
insert/*trace*/ into t1(id) values (104);
|
||||
insert/*trace*/ into t1(id) values (103);
|
||||
insert/*trace*/ into t1(id) values (102);
|
||||
insert/*trace*/ into t1(id) values (101);
|
||||
insert/*trace*/ into t1(id) values (105);
|
||||
insert/*trace*/ into t1(id) values (106);
|
||||
insert/*trace*/ into t1(id) values (107);
|
||||
insert/*trace*/ into t2(id) values (107),(75),(1000);
|
||||
EXPLAIN select t1.id, t2.id from t1, t2 where t2.id = t1.id and t1.id>200;
|
||||
Query Plan
|
||||
=========================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------------
|
||||
|0 |NESTED-LOOP JOIN| |1 |73 |
|
||||
|1 | TABLE SCAN |t1 |1 |36 |
|
||||
|2 | TABLE GET |t2 |1 |36 |
|
||||
=========================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.id], [t2.id]), filter(nil),
|
||||
conds(nil), nl_params_([t1.id])
|
||||
1 - output([t1.id]), filter(nil),
|
||||
access([t1.id]), partitions(p0)
|
||||
2 - output([t2.id]), filter(nil),
|
||||
access([t2.id]), partitions(p0)
|
||||
|
||||
select t1.id, t2.id from t1, t2 where t2.id = t1.id and t1.id>200;
|
||||
+----+----+
|
||||
| id | id |
|
||||
+----+----+
|
||||
+----+----+
|
||||
|
||||
EXPLAIN select t1.id, t2.id from t1, t2 where t2.id = t1.id and t1.id>200 and t1.id<200;
|
||||
Query Plan
|
||||
=========================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------------
|
||||
|0 |NESTED-LOOP JOIN| |1 |73 |
|
||||
|1 | TABLE SCAN |t1 |1 |36 |
|
||||
|2 | TABLE GET |t2 |1 |36 |
|
||||
=========================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.id], [t2.id]), filter(nil),
|
||||
conds(nil), nl_params_([t1.id])
|
||||
1 - output([t1.id]), filter(nil),
|
||||
access([t1.id]), partitions(p0)
|
||||
2 - output([t2.id]), filter(nil),
|
||||
access([t2.id]), partitions(p0)
|
||||
|
||||
select t1.id, t2.id from t1, t2 where t2.id = t1.id and t1.id>200 and t1.id<200;
|
||||
+----+----+
|
||||
| id | id |
|
||||
+----+----+
|
||||
+----+----+
|
||||
|
||||
EXPLAIN select a.id , b.id from t1 a, t2 b where a.id = b.id and a.id>200 and a.id<200;
|
||||
Query Plan
|
||||
=========================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------------
|
||||
|0 |NESTED-LOOP JOIN| |1 |73 |
|
||||
|1 | TABLE SCAN |a |1 |36 |
|
||||
|2 | TABLE GET |b |1 |36 |
|
||||
=========================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([a.id], [b.id]), filter(nil),
|
||||
conds(nil), nl_params_([a.id])
|
||||
1 - output([a.id]), filter(nil),
|
||||
access([a.id]), partitions(p0)
|
||||
2 - output([b.id]), filter(nil),
|
||||
access([b.id]), partitions(p0)
|
||||
|
||||
select a.id , b.id from t1 a, t2 b where a.id = b.id and a.id>200 and a.id<200;
|
||||
+----+----+
|
||||
| id | id |
|
||||
+----+----+
|
||||
+----+----+
|
||||
|
||||
EXPLAIN select a.id, b.id from t1 a, t2 b where a.id = a.id and a.id>200 and a.id<200;
|
||||
Query Plan
|
||||
===================================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
---------------------------------------------------
|
||||
|0 |NESTED-LOOP JOIN CARTESIAN| |3 |75 |
|
||||
|1 | TABLE SCAN |b |3 |37 |
|
||||
|2 | MATERIAL | |1 |37 |
|
||||
|3 | TABLE SCAN |a |1 |36 |
|
||||
===================================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([a.id], [b.id]), filter(nil),
|
||||
conds(nil), nl_params_(nil)
|
||||
1 - output([b.id]), filter(nil),
|
||||
access([b.id]), partitions(p0)
|
||||
2 - output([a.id]), filter(nil)
|
||||
3 - output([a.id]), filter([a.id = a.id]),
|
||||
access([a.id]), partitions(p0)
|
||||
|
||||
select a.id, b.id from t1 a, t2 b where a.id = a.id and a.id>200 and a.id<200;
|
||||
+----+----+
|
||||
| id | id |
|
||||
+----+----+
|
||||
+----+----+
|
||||
|
||||
drop table t1, t2;
|
||||
@ -0,0 +1,121 @@
|
||||
result_format: 4
|
||||
explain_protocol: 2
|
||||
drop table if exists t1,t2;
|
||||
create table t1 (id int primary key, i2 int);
|
||||
create table t2 (id int primary key, i2 int);
|
||||
insert/*trace*/ into t1(id) values (75);
|
||||
insert/*trace*/ into t1(id) values (79);
|
||||
insert/*trace*/ into t1(id) values (78);
|
||||
insert/*trace*/ into t1(id) values (77);
|
||||
insert/*trace*/ into t1(id) values (104);
|
||||
insert/*trace*/ into t1(id) values (103);
|
||||
insert/*trace*/ into t1(id) values (102);
|
||||
insert/*trace*/ into t1(id) values (101);
|
||||
insert/*trace*/ into t1(id) values (105);
|
||||
insert/*trace*/ into t1(id) values (106);
|
||||
insert/*trace*/ into t1(id) values (107);
|
||||
insert/*trace*/ into t2(id) values (107),(75),(1000);
|
||||
|
||||
|
||||
EXPLAIN select t1.id, t2.id from t1 join t2 on t2.id = t1.id and t1.id>200;
|
||||
Query Plan
|
||||
=========================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------------
|
||||
|0 |NESTED-LOOP JOIN| |1 |73 |
|
||||
|1 | TABLE SCAN |t1 |1 |36 |
|
||||
|2 | TABLE GET |t2 |1 |36 |
|
||||
=========================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.id], [t2.id]), filter(nil),
|
||||
conds(nil), nl_params_([t1.id])
|
||||
1 - output([t1.id]), filter(nil),
|
||||
access([t1.id]), partitions(p0)
|
||||
2 - output([t2.id]), filter(nil),
|
||||
access([t2.id]), partitions(p0)
|
||||
|
||||
select t1.id, t2.id from t1 join t2 on t2.id = t1.id and t1.id>200;
|
||||
+----+----+
|
||||
| id | id |
|
||||
+----+----+
|
||||
+----+----+
|
||||
|
||||
EXPLAIN select t1.id, t2.id from t1 join t2 on t2.id = t1.id and t1.id>200 and t1.id<200;
|
||||
Query Plan
|
||||
=========================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------------
|
||||
|0 |NESTED-LOOP JOIN| |1 |73 |
|
||||
|1 | TABLE SCAN |t1 |1 |36 |
|
||||
|2 | TABLE GET |t2 |1 |36 |
|
||||
=========================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.id], [t2.id]), filter(nil),
|
||||
conds(nil), nl_params_([t1.id])
|
||||
1 - output([t1.id]), filter(nil),
|
||||
access([t1.id]), partitions(p0)
|
||||
2 - output([t2.id]), filter(nil),
|
||||
access([t2.id]), partitions(p0)
|
||||
|
||||
select t1.id, t2.id from t1 join t2 on t2.id = t1.id and t1.id>200 and t1.id<200;
|
||||
+----+----+
|
||||
| id | id |
|
||||
+----+----+
|
||||
+----+----+
|
||||
|
||||
EXPLAIN select a.id , b.id from t1 a join t2 b on a.id = b.id and a.id>200 and a.id<200;
|
||||
Query Plan
|
||||
=========================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------------
|
||||
|0 |NESTED-LOOP JOIN| |1 |73 |
|
||||
|1 | TABLE SCAN |a |1 |36 |
|
||||
|2 | TABLE GET |b |1 |36 |
|
||||
=========================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([a.id], [b.id]), filter(nil),
|
||||
conds(nil), nl_params_([a.id])
|
||||
1 - output([a.id]), filter(nil),
|
||||
access([a.id]), partitions(p0)
|
||||
2 - output([b.id]), filter(nil),
|
||||
access([b.id]), partitions(p0)
|
||||
|
||||
select a.id , b.id from t1 a join t2 b on a.id = b.id and a.id>200 and a.id<200;
|
||||
+----+----+
|
||||
| id | id |
|
||||
+----+----+
|
||||
+----+----+
|
||||
|
||||
EXPLAIN select a.id, b.id from t1 a join t2 b on a.id = a.id and a.id>200 and a.id<200;
|
||||
Query Plan
|
||||
===================================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
---------------------------------------------------
|
||||
|0 |NESTED-LOOP JOIN CARTESIAN| |3 |75 |
|
||||
|1 | TABLE SCAN |b |3 |37 |
|
||||
|2 | MATERIAL | |1 |37 |
|
||||
|3 | TABLE SCAN |a |1 |36 |
|
||||
===================================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([a.id], [b.id]), filter(nil),
|
||||
conds(nil), nl_params_(nil)
|
||||
1 - output([b.id]), filter(nil),
|
||||
access([b.id]), partitions(p0)
|
||||
2 - output([a.id]), filter(nil)
|
||||
3 - output([a.id]), filter([a.id = a.id]),
|
||||
access([a.id]), partitions(p0)
|
||||
|
||||
select a.id, b.id from t1 a join t2 b on a.id = a.id and a.id>200 and a.id<200;
|
||||
+----+----+
|
||||
| id | id |
|
||||
+----+----+
|
||||
+----+----+
|
||||
drop table t1, t2;
|
||||
@ -0,0 +1,121 @@
|
||||
result_format: 4
|
||||
explain_protocol: 2
|
||||
drop table if exists t1,t2;
|
||||
create table t1 (id int primary key, i2 int);
|
||||
create table t2 (id int primary key, i2 int);
|
||||
insert/*trace*/ into t1(id) values (75);
|
||||
insert/*trace*/ into t1(id) values (79);
|
||||
insert/*trace*/ into t1(id) values (78);
|
||||
insert/*trace*/ into t1(id) values (77);
|
||||
insert/*trace*/ into t1(id) values (104);
|
||||
insert/*trace*/ into t1(id) values (103);
|
||||
insert/*trace*/ into t1(id) values (102);
|
||||
insert/*trace*/ into t1(id) values (101);
|
||||
insert/*trace*/ into t1(id) values (105);
|
||||
insert/*trace*/ into t1(id) values (106);
|
||||
insert/*trace*/ into t1(id) values (107);
|
||||
insert/*trace*/ into t2(id) values (107),(75),(1000);
|
||||
|
||||
|
||||
EXPLAIN select t1.id, t2.id from t1 join t2 on t2.id = t1.id where t1.id>200;
|
||||
Query Plan
|
||||
=========================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------------
|
||||
|0 |NESTED-LOOP JOIN| |1 |73 |
|
||||
|1 | TABLE SCAN |t1 |1 |36 |
|
||||
|2 | TABLE GET |t2 |1 |36 |
|
||||
=========================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.id], [t2.id]), filter(nil),
|
||||
conds(nil), nl_params_([t1.id])
|
||||
1 - output([t1.id]), filter(nil),
|
||||
access([t1.id]), partitions(p0)
|
||||
2 - output([t2.id]), filter(nil),
|
||||
access([t2.id]), partitions(p0)
|
||||
|
||||
select t1.id, t2.id from t1 join t2 on t2.id = t1.id where t1.id>200;
|
||||
+----+----+
|
||||
| id | id |
|
||||
+----+----+
|
||||
+----+----+
|
||||
|
||||
EXPLAIN select t1.id, t2.id from t1 join t2 on t2.id = t1.id where t1.id>200 and t1.id<200;
|
||||
Query Plan
|
||||
=========================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------------
|
||||
|0 |NESTED-LOOP JOIN| |1 |73 |
|
||||
|1 | TABLE SCAN |t1 |1 |36 |
|
||||
|2 | TABLE GET |t2 |1 |36 |
|
||||
=========================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.id], [t2.id]), filter(nil),
|
||||
conds(nil), nl_params_([t1.id])
|
||||
1 - output([t1.id]), filter(nil),
|
||||
access([t1.id]), partitions(p0)
|
||||
2 - output([t2.id]), filter(nil),
|
||||
access([t2.id]), partitions(p0)
|
||||
|
||||
select t1.id, t2.id from t1 join t2 on t2.id = t1.id where t1.id>200 and t1.id<200;
|
||||
+----+----+
|
||||
| id | id |
|
||||
+----+----+
|
||||
+----+----+
|
||||
|
||||
EXPLAIN select a.id , b.id from t1 a join t2 b on a.id = b.id where a.id>200 and a.id<200;
|
||||
Query Plan
|
||||
=========================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------------
|
||||
|0 |NESTED-LOOP JOIN| |1 |73 |
|
||||
|1 | TABLE SCAN |a |1 |36 |
|
||||
|2 | TABLE GET |b |1 |36 |
|
||||
=========================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([a.id], [b.id]), filter(nil),
|
||||
conds(nil), nl_params_([a.id])
|
||||
1 - output([a.id]), filter(nil),
|
||||
access([a.id]), partitions(p0)
|
||||
2 - output([b.id]), filter(nil),
|
||||
access([b.id]), partitions(p0)
|
||||
|
||||
select a.id , b.id from t1 a join t2 b on a.id = b.id where a.id>200 and a.id<200;
|
||||
+----+----+
|
||||
| id | id |
|
||||
+----+----+
|
||||
+----+----+
|
||||
|
||||
EXPLAIN select a.id , b.id from t1 a join t2 b on a.id = a.id where a.id>200 and a.id<200;
|
||||
Query Plan
|
||||
===================================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
---------------------------------------------------
|
||||
|0 |NESTED-LOOP JOIN CARTESIAN| |3 |75 |
|
||||
|1 | TABLE SCAN |b |3 |37 |
|
||||
|2 | MATERIAL | |1 |37 |
|
||||
|3 | TABLE SCAN |a |1 |36 |
|
||||
===================================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([a.id], [b.id]), filter(nil),
|
||||
conds(nil), nl_params_(nil)
|
||||
1 - output([b.id]), filter(nil),
|
||||
access([b.id]), partitions(p0)
|
||||
2 - output([a.id]), filter(nil)
|
||||
3 - output([a.id]), filter([a.id = a.id]),
|
||||
access([a.id]), partitions(p0)
|
||||
|
||||
select a.id , b.id from t1 a join t2 b on a.id = a.id where a.id>200 and a.id<200;
|
||||
+----+----+
|
||||
| id | id |
|
||||
+----+----+
|
||||
+----+----+
|
||||
drop table t1, t2;
|
||||
289
tools/deploy/mysql_test/test_suite/join/t/anti_semi_join.test
Normal file
289
tools/deploy/mysql_test/test_suite/join/t/anti_semi_join.test
Normal file
@ -0,0 +1,289 @@
|
||||
#owner: xiaoyi.xy
|
||||
#owner group: sql1
|
||||
# tags: optimizer
|
||||
##
|
||||
## Test Name: anti_join.test
|
||||
## Date: 2017-12-28
|
||||
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
|
||||
--result_format 4
|
||||
--explain_protocol 2
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists xy_t1, xy_t2;
|
||||
--enable_warnings
|
||||
|
||||
create table xy_t1(c1 int, c2 int);
|
||||
create table xy_t2(c1 int, c2 int);
|
||||
--sleep 3
|
||||
|
||||
insert/*insert trace*/ into xy_t1 values(0, 0), (1,1), (2,2), (5,5), (5,5), (6,7), (6,6), (7,7);
|
||||
insert/*insert trace*/ into xy_t2 values(1,1), (3,3), (5,5), (5,5), (6,6);
|
||||
|
||||
--echo
|
||||
--echo # ************** 测试anti仅含equal condition的情况 *******
|
||||
select /*+ USE_NL(xy_t1, xy_t2)*/ * from xy_t1 where not exists (select 1 from xy_t2 where xy_t1.c1 = xy_t2.c1);
|
||||
--echo
|
||||
select /*+ USE_MERGE(xy_t1, xy_t2)*/ * from xy_t1 where not exists (select 1 from xy_t2 where xy_t1.c1 = xy_t2.c1);
|
||||
--echo
|
||||
select /*+ USE_HASH(xy_t1, xy_t2)*/ * from xy_t1 where not exists (select 1 from xy_t2 where xy_t1.c1 = xy_t2.c1);
|
||||
--echo # ************* end *******************
|
||||
|
||||
--echo
|
||||
--echo # ************** 测试anti含other condition的情况 *******
|
||||
select /*+ USE_NL(xy_t1, xy_t2)*/ * from xy_t1 where not exists (select 1 from xy_t2 where xy_t1.c1 = xy_t2.c1 and xy_t1.c2 > xy_t2.c2);
|
||||
--echo
|
||||
select /*+ USE_MERGE(xy_t1, xy_t2)*/ * from xy_t1 where not exists (select 1 from xy_t2 where xy_t1.c1 = xy_t2.c1 and xy_t1.c2 > xy_t2.c2);
|
||||
--echo
|
||||
select /*+ USE_HASH(xy_t1, xy_t2)*/ * from xy_t1 where not exists (select 1 from xy_t2 where xy_t1.c1 = xy_t2.c1 and xy_t1.c2 > xy_t2.c2);
|
||||
--echo # ************** end *********
|
||||
|
||||
--echo
|
||||
--echo # ************** 测试semi仅含equal condition的情况 *******
|
||||
select /*+ USE_NL(xy_t1, xy_t2)*/ * from xy_t1 where exists (select 1 from xy_t2 where xy_t1.c1 = xy_t2.c1);
|
||||
--echo
|
||||
select /*+ USE_MERGE(xy_t1, xy_t2)*/ * from xy_t1 where exists (select 1 from xy_t2 where xy_t1.c1 = xy_t2.c1);
|
||||
--echo
|
||||
select /*+ USE_HASH(xy_t1, xy_t2)*/ * from xy_t1 where exists (select 1 from xy_t2 where xy_t1.c1 = xy_t2.c1);
|
||||
--echo # ************* end *******************
|
||||
|
||||
--echo
|
||||
--echo # ************** 测试semi join含other condition的情况 *******
|
||||
select /*+ USE_NL(xy_t1, xy_t2)*/ * from xy_t1 where exists (select 1 from xy_t2 where xy_t1.c1 = xy_t2.c1 and xy_t1.c2 > xy_t2.c2);
|
||||
--echo
|
||||
select /*+ USE_MERGE(xy_t1, xy_t2)*/ * from xy_t1 where exists (select 1 from xy_t2 where xy_t1.c1 = xy_t2.c1 and xy_t1.c2 > xy_t2.c2);
|
||||
--echo
|
||||
select /*+ USE_HASH(xy_t1, xy_t2)*/ * from xy_t1 where exists (select 1 from xy_t2 where xy_t1.c1 = xy_t2.c1 and xy_t1.c2 > xy_t2.c2);
|
||||
--echo # ************** end *********
|
||||
|
||||
--echo
|
||||
--echo # ************** 测试上层算子需要投影的情况 ********
|
||||
select /*+ USE_NL(xy_t1, xy_t2)*/ c1, c2, c1, c2 from xy_t1 where not exists (select 1 from xy_t2 where xy_t1.c1 = xy_t2.c1 and xy_t1.c2 > xy_t2.c2);
|
||||
--echo
|
||||
select /*+ USE_MERGE(xy_t1, xy_t2)*/ c1, c2, c1, c2 from xy_t1 where not exists (select 1 from xy_t2 where xy_t1.c1 = xy_t2.c1 and xy_t1.c2 > xy_t2.c2);
|
||||
--echo
|
||||
select /*+ USE_HASH(xy_t1, xy_t2)*/ c1, c2, c1, c2 from xy_t1 where not exists (select 1 from xy_t2 where xy_t1.c1 = xy_t2.c1 and xy_t1.c2 > xy_t2.c2);
|
||||
--echo
|
||||
select /*+ USE_NL(xy_t1, xy_t2)*/ c1, c2, c1, c2 from xy_t1 where exists (select 1 from xy_t2 where xy_t1.c1 = xy_t2.c1 and xy_t1.c2 > xy_t2.c2);
|
||||
--echo
|
||||
select /*+ USE_MERGE(xy_t1, xy_t2)*/ c1, c2, c1, c2 from xy_t1 where exists (select 1 from xy_t2 where xy_t1.c1 = xy_t2.c1 and xy_t1.c2 > xy_t2.c2);
|
||||
--echo
|
||||
select /*+ USE_HASH(xy_t1, xy_t2)*/ c1, c2, c1, c2 from xy_t1 where exists (select 1 from xy_t2 where xy_t1.c1 = xy_t2.c1 and xy_t1.c2 > xy_t2.c2);
|
||||
--echo # ************** end ********
|
||||
|
||||
drop table xy_t1, xy_t2;
|
||||
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists xy_x_t, xy_y_t;
|
||||
--enable_warnings
|
||||
create table xy_x_t(x1 int, x2 varchar(100));
|
||||
create table xy_y_t(y1 int, y2 varchar(100));
|
||||
--sleep 3
|
||||
insert/*insert trace*/ into xy_x_t values(NULL,"VECPQ"),(NULL,"bdarkyzh"),(NULL,"it"),(NULL,"tgn"),(NULL,"had"),(NULL,"b"),(NULL,"g"),(NULL,"it's"),(NULL,"r"),(NULL,"KSZCK"),(NULL,"s"),(NULL,"UJRXI"),(NULL,"HLKDP"),(NULL,"about"),(NULL,"ROITX"),(NULL,"OEJAP"),(NULL,"u"),(NULL,"egisjnib"),(NULL,"ozkegisjn"),(NULL,"oh"),(NULL,"lrlmds"),(NULL,"r"),(NULL,"a"),(NULL,"here"),(NULL,"ihrad"),(NULL,"good"),(-2139029504,"eyqjoq"),(-2061369344,"GSUGA"),(-1882128384,"there"),(-1552613376,"d"),(-1511981056,"and"),(-1504706560,"and"),(-1259929600,"o"),(-973340672,"at"),(-918945792,"DNMFW"),(-778960896,"r"),(-753336320,"PKGAE"),(-593821696,"UGSPN"),(-457179136,"got"),(-314638336,"will"),(-233701376,"o"),(-104202240,"SUEUH"),(0,"yzh"),(0,"i"),(1,"TQOYB"),(1,"FFHTJ"),(2,"it's"),(2,"ezcuilyxac"),(2,"VZLUW"),(2,"want"),(2,"think"),(3,"prsazev"),(3,"get"),(3,"out"),(4,"a"),(4,"PVYPZ"),(4,"k"),(4,"bpqswbeyqj"),(4,"isjn"),(4,"that's"),(4,"well"),(5,"arkyz"),(5,"w"),(5,"with"),(5,"just"),(5,"PFBCU"),(6,"uyslpcybda"),(6,"co"),(6,"u"),(6,"j"),(6,"g"),(7,"cybdark"),(7,"BKWPE"),(8,"lmdsl"),(8,"NNIGT"),(8,"of"),(9,"etu"),(9,"TBMEI"),(9,"QPPLC"),(9,"mdsl"),(27262976,"n"),(162267136,"to"),(199884800,"y"),(334364672,"h"),(597295104,"did"),(748814336,"rhljip"),(769916928,"OQKEV"),(839778304,"USTRY"),(947585024,"hey"),(1210777600,"want"),(1232601088,"azev"),(1250689024,"a"),(1329463296,"QAMOL"),(1573126144,"zcuilyx"),(1594753024,"yeah"),(1730215936,"PMUMX"),(1925709824,"g"),(2048262144,"b"),(2082275328,"k"),(2131492864,"was");
|
||||
insert/*insert trace*/ into xy_y_t values(NULL,"mmkfu"),(NULL,"c"),(NULL,"know"),(NULL,"ZYTQH"),(NULL,"j"),(NULL,"y"),(NULL,"what"),(NULL,"SXXNL"),(NULL,"b"),(NULL,"NFZFZ"),(-1992359936,"not"),(-1711210496,"uoorvy"),(-1150287872,"BKNFS"),(-926613504,"was"),(-858128384,"y"),(-549126144,"v"),(-537198592,"now"),(-491651072,"t"),(-66125824,"here"),(0,"XCYGJ"),(1,"YGHBI"),(2,"g"),(6,"kfuoorvyvn"),(7,"EGBLS"),(9,"jsnsdfm"),(1584463872,"face");
|
||||
|
||||
--echo
|
||||
select /*+use_hash(xy_x_t xy_y_t)*/ * from xy_x_t where x1 in (select y1 from xy_y_t where y2 < xy_x_t.x2);
|
||||
select /*+use_merge(xy_x_t xy_y_t)*/ * from xy_x_t where x1 in (select y1 from xy_y_t where y2 < xy_x_t.x2);
|
||||
select /*+use_nl(xy_x_t xy_y_t)*/ * from xy_x_t where x1 in (select y1 from xy_y_t where y2 < xy_x_t.x2);
|
||||
--echo
|
||||
|
||||
drop table xy_x_t, xy_y_t;
|
||||
create table xy_x_t(x1 int not null, x2 varchar(100) not null);
|
||||
create table xy_y_t(y1 int not null, y2 varchar(100) not null);
|
||||
--sleep 3
|
||||
insert/*insert trace*/ into xy_x_t values(-2139029504,"eyqjoq"),(-2061369344,"GSUGA"),(-1882128384,"there"),(-1552613376,"d"),(-1511981056,"and"),(-1504706560,"and"),(-1259929600,"o"),(-973340672,"at"),(-918945792,"DNMFW"),(-778960896,"r"),(-753336320,"PKGAE"),(-593821696,"UGSPN"),(-457179136,"got"),(-314638336,"will"),(-233701376,"o"),(-104202240,"SUEUH"),(0,"yzh"),(0,"i"),(1,"TQOYB"),(1,"FFHTJ"),(2,"it's"),(2,"ezcuilyxac"),(2,"VZLUW"),(2,"want"),(2,"think"),(3,"prsazev"),(3,"get"),(3,"out"),(4,"a"),(4,"PVYPZ"),(4,"k"),(4,"bpqswbeyqj"),(4,"isjn"),(4,"that's"),(4,"well"),(5,"arkyz"),(5,"w"),(5,"with"),(5,"just"),(5,"PFBCU"),(6,"uyslpcybda"),(6,"co"),(6,"u"),(6,"j"),(6,"g"),(7,"cybdark"),(7,"BKWPE"),(8,"lmdsl"),(8,"NNIGT"),(8,"of"),(9,"etu"),(9,"TBMEI"),(9,"QPPLC"),(9,"mdsl"),(27262976,"n"),(162267136,"to"),(199884800,"y"),(334364672,"h"),(597295104,"did"),(748814336,"rhljip"),(769916928,"OQKEV"),(839778304,"USTRY"),(947585024,"hey"),(1210777600,"want"),(1232601088,"azev"),(1250689024,"a"),(1329463296,"QAMOL"),(1573126144,"zcuilyx"),(1594753024,"yeah"),(1730215936,"PMUMX"),(1925709824,"g"),(2048262144,"b"),(2082275328,"k"),(2131492864,"was");
|
||||
insert/*insert trace*/ into xy_y_t values(-1992359936,"not"),(-1711210496,"uoorvy"),(-1150287872,"BKNFS"),(-926613504,"was"),(-858128384,"y"),(-549126144,"v"),(-537198592,"now"),(-491651072,"t"),(-66125824,"here"),(0,"XCYGJ"),(1,"YGHBI"),(2,"g"),(6,"kfuoorvyvn"),(7,"EGBLS"),(9,"jsnsdfm"),(1584463872,"face");
|
||||
|
||||
select /*+use_hash(xy_x_t xy_y_t)*/ * from xy_x_t where x1 not in (select y1 from xy_y_t where y2 < xy_x_t.x2);
|
||||
select /*+use_merge(xy_x_t xy_y_t)*/ * from xy_x_t where x1 not in (select y1 from xy_y_t where y2 < xy_x_t.x2);
|
||||
select /*+use_nl(xy_x_t xy_y_t)*/ * from xy_x_t where x1 not in (select y1 from xy_y_t where y2 < xy_x_t.x2);
|
||||
|
||||
drop table xy_x_t, xy_y_t;
|
||||
|
||||
|
||||
### ********************* test right semi/anti join
|
||||
--disable_warnings
|
||||
drop table if exists xy_t1, xy_t2, xy_t3, xy_t4;
|
||||
--enable_warnings
|
||||
create table xy_t1(c1 int, c2 int, key idx_c2(c2, c1));
|
||||
create table xy_t2(c1 int, c2 int, key idx_c2(c2, c1));
|
||||
create table xy_t3(c1 int, c2 int, key idx_c2(c2, c1));
|
||||
create table xy_t4(c1 int, c2 int, key idx_c2(c2, c1));
|
||||
--sleep 3
|
||||
|
||||
insert/*insert trace*/ into xy_t1 values(0, 0), (1,1), (2, null),(2,2), (5,5), (5,5), (5,7),(6,7), (6,6), (6, null),(7,7), (7, 0), (8,0), (8,8), (8, 5), (9, 0), (9, 7), (10,10), (null, 1), (1,1), (3,3), (20,1), (20,1), (20,1), (20,1), (20,1), (20,1), (20,1), (20,1), (0, 0), (1,1), (2, null),(2,2), (5,5), (5,5), (5,7),(6,7), (6,6), (6, null),(7,7), (7, 0), (8,0), (8,8), (8, 5), (9, 0), (9, 7), (10,10), (null, 1), (1,1), (3,3), (20,1), (20,1), (20,1), (20,1), (20,1), (20,1), (20,1), (20,1), (0, 0), (1,1), (2, null),(2,2), (5,5), (5,5), (5,7),(6,7), (6,6), (6, null),(7,7), (7, 0), (8,0), (8,8), (8, 5), (9, 0), (9, 7), (10,10), (null, 1), (1,1), (3,3), (20,1), (20,1), (20,1), (20,1), (20,1), (20,1), (20,1), (20,1), (0, 0), (1,1), (2, null),(2,2), (5,5), (5,5), (5,7),(6,7), (6,6), (6, null),(7,7), (7, 0), (8,0), (8,8), (8, 5), (9, 0), (9, 7), (10,10), (null, 1), (1,1), (3,3), (20,1), (20,1), (20,1), (20,1), (20,1), (20,1), (20,1), (20,1);
|
||||
insert/*insert trace*/ into xy_t2 values(null, 1), (1,1), (3,3), (5,5), (5,6), (5,4), (6,6), (9,9);
|
||||
insert/*insert trace*/ into xy_t3 values(1,1), (3,3), (5,5), (5,6), (5,4), (6,6), (9,9), (5,7),(6,7), (6,6), (6, null),(7,7);
|
||||
insert/*insert trace*/ into xy_t4 values(1,1), (3,3);
|
||||
|
||||
--echo
|
||||
--echo ***************** RIGHT HASH SEMI 最优
|
||||
select * from xy_t1 where exists (select 1 from xy_t2 where xy_t2.c1 = xy_t1.c1);
|
||||
select /*+ use_nl(xy_t1 xy_t2)*/ * from xy_t1 where exists (select 1 from xy_t2 where xy_t2.c1 = xy_t1.c1);
|
||||
select /*+ use_hash(xy_t1 xy_t2)*/ * from xy_t1 where exists (select 1 from xy_t2 where xy_t2.c1 = xy_t1.c1);
|
||||
select /*+ use_merge(xy_t1 xy_t2)*/ * from xy_t1 where exists (select 1 from xy_t2 where xy_t2.c1 = xy_t1.c1);
|
||||
select /*+ no_rewrite */ * from xy_t1 where exists (select 1 from xy_t2 where xy_t2.c1 = xy_t1.c1);
|
||||
|
||||
--echo
|
||||
--echo ***************** HASH SEMI 最优
|
||||
select * from xy_t2 where exists (select 1 from xy_t1 where xy_t2.c1 = xy_t1.c1);
|
||||
select /*+ use_nl(xy_t2 xy_t1)*/ * from xy_t2 where exists (select 1 from xy_t1 where xy_t2.c1 = xy_t1.c1);
|
||||
select /*+ use_hash(xy_t2 xy_t1)*/ * from xy_t2 where exists (select 1 from xy_t1 where xy_t2.c1 = xy_t1.c1);
|
||||
select /*+ use_merge(xy_t2 xy_t1)*/ * from xy_t2 where exists (select 1 from xy_t1 where xy_t2.c1 = xy_t1.c1);
|
||||
|
||||
--echo
|
||||
--echo **************** NL SEMI 最优
|
||||
select * from xy_t4 where exists (select 1 from xy_t1 where xy_t4.c1 = xy_t1.c2);
|
||||
select /*+ use_nl(xy_t4 xy_t1)*/ * from xy_t4 where exists (select 1 from xy_t1 where xy_t4.c1 = xy_t1.c2);
|
||||
select /*+ use_hash(xy_t4 xy_t1)*/ * from xy_t4 where exists (select 1 from xy_t1 where xy_t4.c1 = xy_t1.c2);
|
||||
select /*+ use_merge(xy_t4 xy_t1)*/ * from xy_t4 where exists (select 1 from xy_t1 where xy_t4.c1 = xy_t1.c2);
|
||||
|
||||
|
||||
--echo
|
||||
--echo **************** MERGE SEMI 最优
|
||||
select * from xy_t2 where exists (select 1 from xy_t1 where xy_t2.c2 = xy_t1.c2);
|
||||
select /*+ use_nl(xy_t2 xy_t1)*/ * from xy_t2 where exists (select 1 from xy_t1 where xy_t2.c2 = xy_t1.c2);
|
||||
select /*+ use_hash(xy_t2 xy_t1)*/ * from xy_t2 where exists (select 1 from xy_t1 where xy_t2.c2 = xy_t1.c2);
|
||||
select /*+ use_merge(xy_t2 xy_t1)*/ * from xy_t2 where exists (select 1 from xy_t1 where xy_t2.c2 = xy_t1.c2);
|
||||
|
||||
|
||||
--echo
|
||||
--echo ***************** RIGHT HASH ANTI 最优
|
||||
select * from xy_t1 where not exists (select 1 from xy_t2 where xy_t2.c1 = xy_t1.c1);
|
||||
select /*+ use_nl(xy_t1 xy_t2)*/ * from xy_t1 where not exists (select 1 from xy_t2 where xy_t2.c1 = xy_t1.c1);
|
||||
select /*+ use_hash(xy_t1 xy_t2)*/ * from xy_t1 where not exists (select 1 from xy_t2 where xy_t2.c1 = xy_t1.c1);
|
||||
select /*+ use_merge(xy_t1 xy_t2)*/ * from xy_t1 where not exists (select 1 from xy_t2 where xy_t2.c1 = xy_t1.c1);
|
||||
select /*+ no_rewrite */ * from xy_t1 where not exists (select 1 from xy_t2 where xy_t2.c1 = xy_t1.c1);
|
||||
|
||||
--echo
|
||||
--echo ***************** HASH ANTI 最优
|
||||
select * from xy_t2 where not exists (select 1 from xy_t1 where xy_t2.c1 = xy_t1.c1);
|
||||
select /*+ use_nl(xy_t2 xy_t1)*/ * from xy_t2 where not exists (select 1 from xy_t1 where xy_t2.c1 = xy_t1.c1);
|
||||
select /*+ use_hash(xy_t2 xy_t1)*/ * from xy_t2 where not exists (select 1 from xy_t1 where xy_t2.c1 = xy_t1.c1);
|
||||
select /*+ use_merge(xy_t2 xy_t1)*/ * from xy_t2 where not exists (select 1 from xy_t1 where xy_t2.c1 = xy_t1.c1);
|
||||
|
||||
--echo
|
||||
--echo **************** NL ANTI 最优
|
||||
select * from xy_t4 where not exists (select 1 from xy_t1 where xy_t4.c1 = xy_t1.c2);
|
||||
select /*+ use_nl(xy_t4 xy_t1)*/ * from xy_t4 where not exists (select 1 from xy_t1 where xy_t4.c1 = xy_t1.c2);
|
||||
select /*+ use_hash(xy_t4 xy_t1)*/ * from xy_t4 where not exists (select 1 from xy_t1 where xy_t4.c1 = xy_t1.c2);
|
||||
select /*+ use_merge(xy_t4 xy_t1)*/ * from xy_t4 where not exists (select 1 from xy_t1 where xy_t4.c1 = xy_t1.c2);
|
||||
|
||||
--echo
|
||||
--echo **************** MERGE ANTI 最优
|
||||
select * from xy_t2 where not exists (select 1 from xy_t1 where xy_t2.c2 = xy_t1.c2);
|
||||
select /*+ use_nl(xy_t2 xy_t1)*/ * from xy_t2 where not exists (select 1 from xy_t1 where xy_t2.c2 = xy_t1.c2);
|
||||
select /*+ use_hash(xy_t2 xy_t1)*/ * from xy_t2 where not exists (select 1 from xy_t1 where xy_t2.c2 = xy_t1.c2);
|
||||
select /*+ use_merge(xy_t2 xy_t1)*/ * from xy_t2 where not exists (select 1 from xy_t1 where xy_t2.c2 = xy_t1.c2);
|
||||
|
||||
--echo
|
||||
--echo *************** 测试3表情况
|
||||
select sum(c1), sum(c2) from xy_t1 where exists (select 1 from xy_t3 where c1 = xy_t1.c1) and exists (select 1 from xy_t2 where c1 = xy_t1.c1);
|
||||
select /*+ use_hash(xy_t3, xy_t1) use_hash(xy_t2, xy_t1)*/ sum(c1), sum(c2) from xy_t1 where exists (select 1 from xy_t3 where c1 = xy_t1.c1) and exists (select 1 from xy_t2 where c1 = xy_t1.c1);
|
||||
select /*+ no_rewrite*/ sum(c1), sum(c2) from xy_t1 where exists (select 1 from xy_t3 where c1 = xy_t1.c1) and exists (select 1 from xy_t2 where c1 = xy_t1.c1);
|
||||
|
||||
--echo
|
||||
select sum(c1), sum(c2) from xy_t1 where not exists (select 1 from xy_t3 where c2 = xy_t1.c2) and exists (select 1 from xy_t2 where c2 = xy_t1.c2);
|
||||
select /*+ no_rewrite*/ sum(c1), sum(c2) from xy_t1 where not exists (select 1 from xy_t3 where c2 = xy_t1.c2) and exists (select 1 from xy_t2 where c2 = xy_t1.c2);
|
||||
|
||||
--echo
|
||||
--echo *************** 测试limit下压 HASH RIGHT SEMI加limit后情况, limit 小时, SEMI代价会小, limit 太大后代价不影响
|
||||
select * from xy_t1 where exists (select 1 from xy_t2 where xy_t2.c1 = xy_t1.c1);
|
||||
select * from xy_t1 where exists (select 1 from xy_t2 where xy_t2.c1 = xy_t1.c1) limit 3;
|
||||
select * from xy_t1 where exists (select 1 from xy_t2 where xy_t2.c1 = xy_t1.c1) limit 1000;
|
||||
|
||||
--echo
|
||||
--echo *************** 测试limit下压 HASH LEFT SEMI加limit后情况, limit不影响SEMI代价
|
||||
select * from xy_t2 where exists (select 1 from xy_t1 where xy_t2.c1 = xy_t1.c1);
|
||||
select * from xy_t2 where exists (select 1 from xy_t1 where xy_t2.c1 = xy_t1.c1) limit 3;
|
||||
select * from xy_t2 where exists (select 1 from xy_t1 where xy_t2.c1 = xy_t1.c1) limit 1000;
|
||||
|
||||
|
||||
--echo
|
||||
--echo *************** 测试limit下压 HASH RIGHT ANTI加limit后情况, limit 小时, ANTI代价会小, limit 太大后代价不影响
|
||||
select * from xy_t1 where not exists (select 1 from xy_t2 where xy_t2.c1 = xy_t1.c1);
|
||||
select * from xy_t1 where not exists (select 1 from xy_t2 where xy_t2.c1 = xy_t1.c1) limit 3;
|
||||
select * from xy_t1 where not exists (select 1 from xy_t2 where xy_t2.c1 = xy_t1.c1) limit 1000;
|
||||
|
||||
--echo
|
||||
--echo *************** 测试limit下压 HASH LEFT ANTI加limit后情况, limit 不影响ANTI代价
|
||||
select * from xy_t2 where not exists (select 1 from xy_t1 where xy_t2.c1 = xy_t1.c1);
|
||||
select * from xy_t2 where not exists (select 1 from xy_t1 where xy_t2.c1 = xy_t1.c1) limit 3;
|
||||
select * from xy_t2 where not exists (select 1 from xy_t1 where xy_t2.c1 = xy_t1.c1) limit 1000;
|
||||
|
||||
drop table xy_t1, xy_t2, xy_t3;
|
||||
|
||||
--echo
|
||||
--echo ************** 测试SEMI/ANTI 含unique order的场景
|
||||
create table xy_t1(c1 int primary key, c2 int, c3 int);
|
||||
create table xy_t2(c1 int primary key, c2 int, c3 int);
|
||||
--sleep 3
|
||||
insert/*insert trace*/ into xy_t1 values(0, 0, 0), (1,1, 1), (2,2, 2), (3,5, 5), (5,5, 5), (6,7,7), (7,6, 6), (8, 7,8);
|
||||
insert/*insert trace*/ into xy_t2 values(1,1, 1), (3,3,3), (4,5,5), (5,5, 5), (6,6,7);
|
||||
|
||||
--echo
|
||||
--echo //两边都无序hash right
|
||||
select /*+ use_hash(xy_t1 xy_t2)*/ c2, c3 from xy_t1 where c2 in (select c2 from xy_t2 where xy_t1.c3 < xy_t2.c3) order by 1,2;
|
||||
select /*+ use_merge(xy_t1 xy_t2)*/ c2, c3 from xy_t1 where c2 in (select c2 from xy_t2 where xy_t1.c3 < xy_t2.c3) order by 1,2;
|
||||
select /*+ use_nl(xy_t1 xy_t2)*/ c2, c3 from xy_t1 where c2 in (select c2 from xy_t2 where xy_t1.c3 < xy_t2.c3) order by 1,2;
|
||||
select /*+ no_rewrite*/ c2, c3 from xy_t1 where c2 in (select c2 from xy_t2 where xy_t1.c3 < xy_t2.c3) order by 1,2;
|
||||
|
||||
--echo
|
||||
--echo //两边都无序hash left
|
||||
select /*+ use_hash(xy_t1 xy_t2)*/ c2, c3 from xy_t2 where c2 in (select c2 from xy_t1 where xy_t1.c3 < xy_t2.c3) order by 1,2;
|
||||
select /*+ use_merge(xy_t1 xy_t2)*/ c2, c3 from xy_t2 where c2 in (select c2 from xy_t1 where xy_t1.c3 < xy_t2.c3) order by 1,2;
|
||||
select /*+ use_nl(xy_t1 xy_t2)*/ c2, c3 from xy_t2 where c2 in (select c2 from xy_t1 where xy_t1.c3 < xy_t2.c3) order by 1,2;
|
||||
select /*+ no_rewrite*/ c2, c3 from xy_t2 where c2 in (select c2 from xy_t1 where xy_t1.c3 < xy_t2.c3) order by 1,2;
|
||||
|
||||
--echo
|
||||
--echo //两边唯一有序, 改写为inner join
|
||||
select /*+ use_hash(xy_t1 xy_t2)*/ c1, c2 from xy_t2 where c1 in (select c1 from xy_t1 where xy_t1.c2 < xy_t2.c2) order by 1,2;
|
||||
select /*+ use_merge(xy_t1 xy_t2)*/ c1, c2 from xy_t2 where c1 in (select c1 from xy_t1 where xy_t1.c2 < xy_t2.c2) order by 1,2;
|
||||
# bug: https://work.aone.alibaba-inc.com/issue/27311279
|
||||
# select /*+ use_nl(xy_t1 xy_t2)*/ c1, c2 from xy_t2 where c1 in (select c1 from xy_t1 where xy_t1.c2 < xy_t2.c2) order by 1,2;
|
||||
select /*+ no_rewrite*/ c1, c2 from xy_t2 where c1 in (select c1 from xy_t1 where xy_t1.c2 < xy_t2.c2) order by 1,2;
|
||||
|
||||
--echo
|
||||
--echo // 一边唯一有序
|
||||
select /*+ use_hash(xy_t1 xy_t2)*/ c1, c2 from xy_t2 where c1 in (select c2 from xy_t1 where xy_t1.c3 < xy_t2.c3) order by 1,2;
|
||||
select /*+ use_merge(xy_t1 xy_t2)*/ c1, c2 from xy_t2 where c1 in (select c2 from xy_t1 where xy_t1.c3 < xy_t2.c3) order by 1,2;
|
||||
select /*+ use_nl(xy_t1 xy_t2)*/ c1, c2 from xy_t2 where c1 in (select c2 from xy_t1 where xy_t1.c3 < xy_t2.c3) order by 1,2;
|
||||
select /*+ no_rewrite*/ c1, c2 from xy_t2 where c1 in (select c2 from xy_t1 where xy_t1.c3 < xy_t2.c3) order by 1,2;
|
||||
|
||||
--echo
|
||||
--echo //两边都无序hash right
|
||||
select /*+ use_hash(xy_t1 xy_t2)*/ c2, c3 from xy_t1 where not exists (select 1 from xy_t2 where xy_t1.c2 = xy_t2.c2 and xy_t1.c3 < xy_t2.c3) order by 1,2;
|
||||
select /*+ use_merge(xy_t1 xy_t2)*/ c2, c3 from xy_t1 where not exists (select 1 from xy_t2 where xy_t1.c2 = xy_t2.c2 and xy_t1.c3 < xy_t2.c3) order by 1,2;
|
||||
select /*+ use_nl(xy_t1 xy_t2)*/ c2, c3 from xy_t1 where not exists (select 1 from xy_t2 where xy_t1.c2 = xy_t2.c2 and xy_t1.c3 < xy_t2.c3) order by 1,2;
|
||||
select /*+ no_rewrite*/ c2, c3 from xy_t1 where not exists (select 1 from xy_t2 where xy_t1.c2 = xy_t2.c2 and xy_t1.c3 < xy_t2.c3) order by 1,2;
|
||||
|
||||
--echo
|
||||
--echo //两边都无序hash left
|
||||
select /*+ use_hash(xy_t1 xy_t2)*/ c2, c3 from xy_t2 where not exists (select 1 from xy_t1 where xy_t1.c2 = xy_t2.c2 and xy_t1.c3 < xy_t2.c3) order by 1,2;
|
||||
select /*+ use_merge(xy_t1 xy_t2)*/ c2, c3 from xy_t2 where not exists (select 1 from xy_t1 where xy_t1.c2 = xy_t2.c2 and xy_t1.c3 < xy_t2.c3) order by 1,2;
|
||||
select /*+ use_nl(xy_t1 xy_t2)*/ c2, c3 from xy_t2 where not exists (select 1 from xy_t1 where xy_t1.c2 = xy_t2.c2 and xy_t1.c3 < xy_t2.c3) order by 1,2;
|
||||
select /*+ no_rewrite*/ c2, c3 from xy_t2 where not exists (select 1 from xy_t1 where xy_t1.c2 = xy_t2.c2 and xy_t1.c3 < xy_t2.c3) order by 1,2;
|
||||
|
||||
--echo
|
||||
--echo // 两边唯一有序
|
||||
select /*+ use_hash(xy_t1 xy_t2)*/ c1, c2 from xy_t2 where not exists (select 1 from xy_t1 where xy_t1.c1 = xy_t2.c1 and xy_t1.c3 < xy_t2.c3) order by 1,2;
|
||||
select /*+ use_merge(xy_t1 xy_t2)*/ c1, c2 from xy_t2 where not exists (select 1 from xy_t1 where xy_t1.c1 = xy_t2.c1 and xy_t1.c3 < xy_t2.c3) order by 1,2;
|
||||
select /*+ use_nl(xy_t1 xy_t2)*/ c1, c2 from xy_t2 where not exists (select 1 from xy_t1 where xy_t1.c1 = xy_t2.c1 and xy_t1.c3 < xy_t2.c3) order by 1,2;
|
||||
select /*+ no_rewrite*/ c1, c2 from xy_t2 where not exists (select 1 from xy_t1 where xy_t1.c1 = xy_t2.c1 and xy_t1.c3 < xy_t2.c3) order by 1,2;
|
||||
|
||||
--echo
|
||||
--echo //一边唯一有序
|
||||
select /*+ use_hash(xy_t1 xy_t2)*/ c1, c2 from xy_t2 where not exists (select 1 from xy_t1 where xy_t1.c1 = xy_t2.c2 and xy_t1.c2 < xy_t2.c2) order by 1,2;
|
||||
select /*+ use_merge(xy_t1 xy_t2)*/ c1, c2 from xy_t2 where not exists (select 1 from xy_t1 where xy_t1.c1 = xy_t2.c2 and xy_t1.c2 < xy_t2.c2) order by 1,2;
|
||||
select /*+ use_nl(xy_t1 xy_t2)*/ c1, c2 from xy_t2 where not exists (select 1 from xy_t1 where xy_t1.c1 = xy_t2.c2 and xy_t1.c2 < xy_t2.c2) order by 1,2;
|
||||
select /*+ no_rewrite*/ c1, c2 from xy_t2 where not exists (select 1 from xy_t1 where xy_t1.c1 = xy_t2.c2 and xy_t1.c2 < xy_t2.c2) order by 1,2;
|
||||
|
||||
drop table xy_t1, xy_t2;
|
||||
|
||||
|
||||
|
||||
295
tools/deploy/mysql_test/test_suite/join/t/join_merge.test
Normal file
295
tools/deploy/mysql_test/test_suite/join/t/join_merge.test
Normal file
@ -0,0 +1,295 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: yibo.tyf
|
||||
# owner group: SQL3
|
||||
# tags: optimizer
|
||||
# description:
|
||||
# 1. test desc for merge join.
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists aa;
|
||||
drop table if exists bb;
|
||||
drop table if exists cc;
|
||||
--enable_warnings
|
||||
create table aa(a1 int primary key auto_increment, a2 int, a3 int);
|
||||
create table bb(b1 int primary key auto_increment, b2 int, b3 int);
|
||||
create table cc(c1 int primary key auto_increment, c2 int, c3 int);
|
||||
#single layer merge join.
|
||||
delete from aa;
|
||||
insert into aa(a2, a3) values (10, 15), (10, 14), (10, 12), (11, 13), (12, 12), (12, 10);
|
||||
delete from bb;
|
||||
insert into bb(b2, b3) values (10, 14), (11, 14), (11, 13), (12, 11), (12, 10);
|
||||
--sleep 1
|
||||
select /*+ use_merge(aa, bb) */ a2, b3 from aa, bb where a2 = b2 and a3 = b3 order by a2, a3;
|
||||
explain select /*+ use_merge(aa, bb) */ a2, b3 from aa, bb where a2 = b2 and a3 = b3 order by a2, a3;
|
||||
select /*+ use_merge(aa, bb) */ a2, b3 from aa, bb where a2 = b2 and a3 = b3 order by a2, a3 desc;
|
||||
explain select /*+ use_merge(aa, bb) */ a2, b3 from aa, bb where a2 = b2 and a3 = b3 order by a2, a3 desc;
|
||||
select /*+ use_merge(aa, bb) */ a2, b3 from aa, bb where a2 = b2 and a3 = b3 order by a2 desc, a3;
|
||||
explain select /*+ use_merge(aa, bb) */ a2, b3 from aa, bb where a2 = b2 and a3 = b3 order by a2 desc, a3;
|
||||
select /*+ use_merge(aa, bb) */ a2, b3 from aa, bb where a2 = b2 and a3 = b3 order by a2 desc, a3 desc;
|
||||
explain select /*+ use_merge(aa, bb) */ a2, b3 from aa, bb where a2 = b2 and a3 = b3 order by a2 desc, a3 desc;
|
||||
delete from aa;
|
||||
insert into aa(a2, a3) values (10, 15), (10, 14), (10, 12), (11, 13), (12, 12), (12, 10);
|
||||
delete from bb;
|
||||
insert into bb(b2, b3) values (10, 14), (11, 14), (11, 13), (12, 11), (12, 10);
|
||||
--sleep 1
|
||||
select /*+ use_merge(aa, bb) */ a2, b3 from aa, bb where a2 = b2 and a3 = b3 order by a2, a3;
|
||||
explain select /*+ use_merge(aa, bb) */ a2, b3 from aa, bb where a2 = b2 and a3 = b3 order by a2, a3;
|
||||
select /*+ use_merge(aa, bb) */ a2, b3 from aa, bb where a2 = b2 and a3 = b3 order by a2, a3 desc;
|
||||
explain select /*+ use_merge(aa, bb) */ a2, b3 from aa, bb where a2 = b2 and a3 = b3 order by a2, a3 desc;
|
||||
select /*+ use_merge(aa, bb) */ a2, b3 from aa, bb where a2 = b2 and a3 = b3 order by a2 desc, a3;
|
||||
explain select /*+ use_merge(aa, bb) */ a2, b3 from aa, bb where a2 = b2 and a3 = b3 order by a2 desc, a3;
|
||||
select /*+ use_merge(aa, bb) */ a2, b3 from aa, bb where a2 = b2 and a3 = b3 order by a2 desc, a3 desc;
|
||||
explain select /*+ use_merge(aa, bb) */ a2, b3 from aa, bb where a2 = b2 and a3 = b3 order by a2 desc, a3 desc;
|
||||
#double layers merge join.
|
||||
delete from cc;
|
||||
insert into cc(c2, c3) values (10, 15), (10, 14), (10, 12), (12, 10);
|
||||
--sleep 1
|
||||
select /*+ leading(aa bb cc) use_merge(aa, bb, cc) */ c2, a3 from aa, bb, cc where a2 = b2 and a3 = b3 and b2 = c2 and b3 = c3 order by c2, c3 desc;
|
||||
explain select /*+ leading(aa bb cc) use_merge(aa, bb, cc) */ c2, a3 from aa, bb, cc where a2 = b2 and a3 = b3 and b2 = c2 and b3 = c3 order by c2, c3 desc;
|
||||
select /*+ leading(aa bb cc) use_merge(aa, bb, cc) */ c2, a3 from aa, bb, cc where a2 = b2 and a3 = b3 and a2 = c2 and b3 = c3 order by c2, c3 desc;
|
||||
explain select /*+ leading(aa bb cc) use_merge(aa, bb, cc) */ c2, a3 from aa, bb, cc where a2 = b2 and a3 = b3 and a2 = c2 and b3 = c3 order by c2, c3 desc;
|
||||
--disable_warnings
|
||||
drop table if exists tt1,tt2;
|
||||
--enable_warnings
|
||||
CREATE TABLE `tt1` (
|
||||
`a` int(11) NOT NULL,
|
||||
`b` int(11) DEFAULT NULL,
|
||||
`c` varchar(20) DEFAULT NULL,
|
||||
`d` datetime NOT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
);
|
||||
CREATE TABLE `tt2` (
|
||||
`a` int(11) NOT NULL,
|
||||
`b` int(11) DEFAULT NULL,
|
||||
`c` varchar(20) DEFAULT NULL,
|
||||
`d` datetime NOT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
);
|
||||
explain basic select /*+ use_merge(tt1, tt2) */ * from tt1,tt2 where tt1.a=tt2.a order by tt1.d desc;
|
||||
explain basic select /*+ use_merge(tt1, tt2) */ * from tt1,tt2 where tt1.a=tt2.a order by tt1.a desc;
|
||||
explain basic select /*+ use_merge(tt1, tt2) */ * from tt1,tt2 where tt1.a=tt2.a order by tt1.c desc;
|
||||
--disable_warnings
|
||||
drop table if exists tt1,tt2;
|
||||
--enable_warnings
|
||||
--disable_warnings
|
||||
|
||||
--echo == test partitioned table merge join ==
|
||||
--disable_warnings
|
||||
drop table if exists aa;
|
||||
drop table if exists bb;
|
||||
drop table if exists cc;
|
||||
--enable_warnings
|
||||
create table aa(a1 int, a2 int, a3 int) partition by hash(a1) partitions 5;
|
||||
create table bb(b1 int, b2 int, b3 int) partition by hash(b1) partitions 5;
|
||||
create table cc(c1 int, c2 int, c3 int) partition by hash(c1) partitions 5;
|
||||
#single layer merge join.
|
||||
delete from aa;
|
||||
insert into aa values (1, 10, 15), (2, 10, 14), (3, 10, 12), (4, 11, 13), (5, 12, 12), (6, 12, 10);
|
||||
delete from bb;
|
||||
insert into bb values (1, 10, 14), (2, 11, 14), (3, 11, 13), (4, 12, 11), (5, 12, 10);
|
||||
--sleep 1
|
||||
select /*+ use_merge(aa, bb) */ a2, b3 from aa, bb where a2 = b2 and a3 = b3 order by a2, a3;
|
||||
explain select /*+ use_merge(aa, bb) */ a2, b3 from aa, bb where a2 = b2 and a3 = b3 order by a2, a3;
|
||||
select /*+ use_merge(aa, bb) */ a2, b3 from aa, bb where a2 = b2 and a3 = b3 order by a2, a3 desc;
|
||||
explain select /*+ use_merge(aa, bb) */ a2, b3 from aa, bb where a2 = b2 and a3 = b3 order by a2, a3 desc;
|
||||
select /*+ use_merge(aa, bb) */ a2, b3 from aa, bb where a2 = b2 and a3 = b3 order by a2 desc, a3;
|
||||
explain select /*+ use_merge(aa, bb) */ a2, b3 from aa, bb where a2 = b2 and a3 = b3 order by a2 desc, a3;
|
||||
select /*+ use_merge(aa, bb) */ a2, b3 from aa, bb where a2 = b2 and a3 = b3 order by a2 desc, a3 desc;
|
||||
explain select /*+ use_merge(aa, bb) */ a2, b3 from aa, bb where a2 = b2 and a3 = b3 order by a2 desc, a3 desc;
|
||||
delete from aa;
|
||||
insert into aa values (1, 10, 15), (2, 10, 14), (3, 10, 12), (4, 11, 13), (5, 12, 12), (6, 12, 10);
|
||||
delete from bb;
|
||||
insert into bb values (1, 10, 14), (2, 11, 14), (3, 11, 13), (4, 12, 11), (5, 12, 10);
|
||||
--sleep 1
|
||||
select /*+ use_merge(aa, bb) */ a2, b3 from aa, bb where a2 = b2 and a3 = b3 order by a2, a3;
|
||||
explain select /*+ use_merge(aa, bb) */ a2, b3 from aa, bb where a2 = b2 and a3 = b3 order by a2, a3;
|
||||
select /*+ use_merge(aa, bb) */ a2, b3 from aa, bb where a2 = b2 and a3 = b3 order by a2, a3 desc;
|
||||
explain select /*+ use_merge(aa, bb) */ a2, b3 from aa, bb where a2 = b2 and a3 = b3 order by a2, a3 desc;
|
||||
select /*+ use_merge(aa, bb) */ a2, b3 from aa, bb where a2 = b2 and a3 = b3 order by a2 desc, a3;
|
||||
explain select /*+ use_merge(aa, bb) */ a2, b3 from aa, bb where a2 = b2 and a3 = b3 order by a2 desc, a3;
|
||||
select /*+ use_merge(aa, bb) */ a2, b3 from aa, bb where a2 = b2 and a3 = b3 order by a2 desc, a3 desc;
|
||||
explain select /*+ use_merge(aa, bb) */ a2, b3 from aa, bb where a2 = b2 and a3 = b3 order by a2 desc, a3 desc;
|
||||
#double layers merge join.
|
||||
delete from cc;
|
||||
insert into cc values (1, 10, 15), (2, 10, 14), (3, 10, 12), (4, 12, 10);
|
||||
--sleep 1
|
||||
select /*+ leading(aa bb cc) use_merge(aa, bb, cc) */ c2, a3 from aa, bb, cc where a2 = b2 and a3 = b3 and b2 = c2 and b3 = c3 order by c2, c3 desc;
|
||||
explain select /*+ leading(aa bb cc) use_merge(aa, bb, cc) */ c2, a3 from aa, bb, cc where a2 = b2 and a3 = b3 and b2 = c2 and b3 = c3 order by c2, c3 desc;
|
||||
select /*+ leading(aa bb cc) use_merge(aa, bb, cc) */ c2, a3 from aa, bb, cc where a2 = b2 and a3 = b3 and a2 = c2 and b3 = c3 order by c2, c3 desc;
|
||||
explain select /*+ leading(aa bb cc) use_merge(aa, bb, cc) */ c2, a3 from aa, bb, cc where a2 = b2 and a3 = b3 and a2 = c2 and b3 = c3 order by c2, c3 desc;
|
||||
--disable_warnings
|
||||
drop table if exists tt1,tt2;
|
||||
--enable_warnings
|
||||
CREATE TABLE `tt1` (
|
||||
`a` int(11) NOT NULL,
|
||||
`b` int(11) DEFAULT NULL,
|
||||
`c` varchar(20) DEFAULT NULL,
|
||||
`d` datetime NOT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) partition by hash(a) partitions 5;
|
||||
CREATE TABLE `tt2` (
|
||||
`a` int(11) NOT NULL,
|
||||
`b` int(11) DEFAULT NULL,
|
||||
`c` varchar(20) DEFAULT NULL,
|
||||
`d` datetime NOT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) partition by hash(a) partitions 5;
|
||||
explain basic select /*+ use_merge(tt1, tt2) */ * from tt1,tt2 where tt1.a=tt2.a order by tt1.d desc;
|
||||
explain basic select /*+ use_merge(tt1, tt2) */ * from tt1,tt2 where tt1.a=tt2.a order by tt1.a desc;
|
||||
explain basic select /*+ use_merge(tt1, tt2) */ * from tt1,tt2 where tt1.a=tt2.a order by tt1.c desc;
|
||||
--disable_warnings
|
||||
drop table if exists tt1,tt2;
|
||||
--enable_warnings
|
||||
--disable_warnings
|
||||
drop table if exists aa;
|
||||
drop table if exists bb;
|
||||
drop table if exists cc;
|
||||
--enable_warnings
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t_r4_01_20;
|
||||
--enable_warnings
|
||||
|
||||
create table t_r4_01_20(a int, b int, c datetime, primary key (a,b))
|
||||
partition by range columns(a)
|
||||
(
|
||||
partition p6 values less than (6),
|
||||
partition p11 values less than (11),
|
||||
partition p16 values less than (16),
|
||||
partition pm values less than (MAXVALUE)
|
||||
);
|
||||
insert into t_r4_01_20 values ( 1, 1, 20161101), ( 2, 2, 20161102), ( 3, 3, 20161103), ( 4, 4, 20161104),
|
||||
( 5, 5, 20161105), ( 6, 6, 20161106), ( 7, 7, 20161107), ( 8, 8, 20161108),
|
||||
( 9, 9, 20161109), (10, 10, 20161110), (11, 11, 20161111), (12, 12, 20161112),
|
||||
(13, 13, 20161113), (14, 14, 20161114), (15, 15, 20161115), (16, 16, 20161116),
|
||||
(17, 17, 20161117), (18, 18, 20161118), (19, 19, 20161119), (20, 20, 20161120);
|
||||
--sleep 1
|
||||
|
||||
|
||||
select /*+use_merge(t1 t2)*/ t1.a, t2.a from t_r4_01_20 t1 inner join t_r4_01_20 t2 on t1.a = t2.a order by t1.a desc, t2.a desc;
|
||||
explain basic select /*+use_merge(t1 t2)*/ t1.a, t2.a from t_r4_01_20 t1 inner join t_r4_01_20 t2 on t1.a = t2.a order by t1.a desc, t2.a desc;
|
||||
|
||||
explain select /*+use_merge(t1 t2)*/ t1.a, t2.a from t_r4_01_20 t1 inner join t_r4_01_20 t2 on t1.a = t2.a order by t1.a asc, t2.a asc;
|
||||
select /*+use_merge(t1 t2)*/ t1.a, t2.a from t_r4_01_20 t1 inner join t_r4_01_20 t2 on t1.a = t2.a order by t1.a asc, t2.a asc;
|
||||
--disable_warnings
|
||||
drop table if exists t_r4_01_20;
|
||||
--enable_warnings
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t2, t7;
|
||||
--enable_warnings
|
||||
create table t2(a int, b varchar(20), c decimal(20,10));
|
||||
create table t7(a int(10), b varchar(10), c char(20), d decimal(20,10));
|
||||
insert into t2 values(1, "222", 3.33),(2,"222",3.33),(2,"333",2.22),(3,"3333",1.11), (5, "555", 5.55), (6, "6666", 5.5),(1, '1', 1), (1, '2', 2), (2, '2.00', 2.00001), (3, '3.0', 3.00001), (4, "A", 4.33), (5, "B", 5), (6, "AB", 6);
|
||||
insert into t7 values(65, '222', '333', 5), (65, '444', '5.550', 1), (66, '3.0', '555', 3.00001), (66, '2', 'B', 2), (67, 'A', '1', 1);
|
||||
--sleep 1
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t8, t9;
|
||||
--enable_warnings
|
||||
create table t8(a int primary key, b int, c int, index idx(b,c));
|
||||
create table t9(a int primary key, b int, c int, index idx(b,c));
|
||||
--disable_query_log
|
||||
insert into t8 values (1, 2, 1);
|
||||
insert into t8 values (2, 2, 2);
|
||||
insert into t8 values (3, 2, 3);
|
||||
insert into t8 values (4, 4, 1);
|
||||
insert into t8 values (5, 4, 2);
|
||||
insert into t8 values (6, 4, 3);
|
||||
|
||||
insert into t9 values (1, 2, 1);
|
||||
insert into t9 values (2, 2, 2);
|
||||
insert into t9 values (3, 2, 3);
|
||||
insert into t9 values (4, 3, 1);
|
||||
insert into t9 values (5, 4, 1);
|
||||
insert into t9 values (6, 4, 2);
|
||||
insert into t9 values (7, 4, 3);
|
||||
--sleep 1
|
||||
--enable_query_log
|
||||
|
||||
--echo
|
||||
--echo ************ 测试full join
|
||||
explain select /*+use_merge(t2,t7)*/* from t2 full join t7 on t2.b = t7.a and t2.c = t7.d order by t2.a,t2.b,t7.a,t7.b;
|
||||
select /*+use_merge(t2,t7)*/* from t2 full join t7 on t2.b = t7.a and t2.c = t7.d order by t2.a,t2.b,t7.a,t7.b;
|
||||
--echo
|
||||
explain select /*+use_hash(t2,t7)*/* from t2 full join t7 on t2.b = t7.a and t2.c = t7.d order by t2.a,t2.b,t7.a,t7.b;
|
||||
select /*+use_hash(t2,t7)*/* from t2 full join t7 on t2.b = t7.a and t2.c = t7.d order by t2.a,t2.b,t7.a,t7.b;
|
||||
--echo
|
||||
explain select /*+use_nl(t2,t7)*/* from t2 full join t7 on t2.b = t7.a and t2.c = t7.d order by t2.a,t2.b,t7.a,t7.b;
|
||||
select /*+use_nl(t2,t7)*/* from t2 full join t7 on t2.b = t7.a and t2.c = t7.d order by t2.a,t2.b,t7.a,t7.b;
|
||||
|
||||
--echo ************ 测试right join
|
||||
--echo
|
||||
explain select /*+use_merge(t2,t7)*/* from t2 right join t7 on t2.b = t7.a and t2.c = t7.d order by t2.a,t2.b,t7.a,t7.b;
|
||||
select /*+use_merge(t2,t7)*/* from t2 right join t7 on t2.b = t7.a and t2.c = t7.d order by t2.a,t2.b,t7.a,t7.b;
|
||||
--echo
|
||||
explain select /*+use_hash(t2,t7)*/* from t2 right join t7 on t2.b = t7.a and t2.c = t7.d order by t2.a,t2.b,t7.a,t7.b;
|
||||
select /*+use_hash(t2,t7)*/* from t2 right join t7 on t2.b = t7.a and t2.c = t7.d order by t2.a,t2.b,t7.a,t7.b;
|
||||
--echo
|
||||
explain select /*+use_nl(t2,t7)*/* from t2 right join t7 on t2.b = t7.a and t2.c = t7.d order by t2.a,t2.b,t7.a,t7.b;
|
||||
select /*+use_nl(t2,t7)*/* from t2 right join t7 on t2.b = t7.a and t2.c = t7.d order by t2.a,t2.b,t7.a,t7.b;
|
||||
|
||||
explain select /*+leading(t8, t9)*/ t8.b,t8.c,t9.b,t9.c from t8 right join t9 on t8.b = t9.b;
|
||||
select /*+leading(t8, t9)*/ t8.b,t8.c,t9.b,t9.c from t8 right join t9 on t8.b = t9.b;
|
||||
|
||||
--echo ************ 测试left join
|
||||
--echo
|
||||
explain select /*+use_merge(t2,t7)*/* from t2 left join t7 on t2.b = t7.a and t2.c = t7.d order by t2.a,t2.b,t7.a,t7.b;
|
||||
select /*+use_merge(t2,t7)*/* from t2 left join t7 on t2.b = t7.a and t2.c = t7.d order by t2.a,t2.b,t7.a,t7.b;
|
||||
--echo
|
||||
explain select /*+use_hash(t2,t7)*/* from t2 left join t7 on t2.b = t7.a and t2.c = t7.d order by t2.a,t2.b,t7.a,t7.b;
|
||||
select /*+use_hash(t2,t7)*/* from t2 left join t7 on t2.b = t7.a and t2.c = t7.d order by t2.a,t2.b,t7.a,t7.b;
|
||||
--echo
|
||||
explain select /*+use_nl(t2,t7)*/* from t2 left join t7 on t2.b = t7.a and t2.c = t7.d order by t2.a,t2.b,t7.a,t7.b;
|
||||
select /*+use_nl(t2,t7)*/* from t2 left join t7 on t2.b = t7.a and t2.c = t7.d order by t2.a,t2.b,t7.a,t7.b;
|
||||
|
||||
|
||||
|
||||
--echo ********** join condition 必须和 ordering 排序一致
|
||||
explain select /*+use_merge(t8 t9)*/ * from t8 join t9 on t8.c = t9.c and t8.b = t9.b;
|
||||
select /*+use_merge(t8 t9)*/ * from t8 join t9 on t8.c = t9.c and t8.b = t9.b;
|
||||
|
||||
explain select /*+index(t8 idx), index(t9 idx), use_merge(t8 t9)*/ * from t8 join t9 on t8.a = t9.b and t8.b = t9.a;
|
||||
select /*+index(t8 idx), index(t9 idx), use_merge(t8 t9)*/ * from t8 join t9 on t8.a = t9.b and t8.b = t9.a;
|
||||
|
||||
explain select /*+use_merge(t8 t9)*/ * from t8 left join t9 on t8.c = t9.c and t8.b = t9.b;
|
||||
select /*+use_merge(t8 t9)*/ * from t8 left join t9 on t8.c = t9.c and t8.b = t9.b;
|
||||
|
||||
explain select /*+index(t8 idx), index(t9 idx), use_merge(t8 t9)*/ * from t8 left join t9 on t8.a = t9.b and t8.b = t9.a;
|
||||
select /*+index(t8 idx), index(t9 idx), use_merge(t8 t9)*/ * from t8 left join t9 on t8.a = t9.b and t8.b = t9.a;
|
||||
|
||||
explain select /*+use_merge(t8 t9)*/ * from t8 right join t9 on t8.c = t9.c and t8.b = t9.b;
|
||||
select /*+use_merge(t8 t9)*/ * from t8 right join t9 on t8.c = t9.c and t8.b = t9.b;
|
||||
|
||||
explain select /*+index(t8 idx), index(t9 idx), use_merge(t8 t9)*/ * from t8 right join t9 on t8.a = t9.b and t8.b = t9.a;
|
||||
select /*+index(t8 idx), index(t9 idx), use_merge(t8 t9)*/ * from t8 right join t9 on t8.a = t9.b and t8.b = t9.a;
|
||||
|
||||
explain select /*+use_merge(t8 t9)*/ * from t8 right join t9 on t8.c = t9.c and t8.b = t9.b;
|
||||
select /*+use_merge(t8 t9)*/ * from t8 right join t9 on t8.c = t9.c and t8.b = t9.b;
|
||||
|
||||
explain select /*+index(t8 idx), index(t9 idx), use_merge(t8 t9)*/ * from t8 full join t9 on t8.a = t9.b and t8.b = t9.a;
|
||||
select /*+index(t8 idx), index(t9 idx), use_merge(t8 t9)*/ * from t8 full join t9 on t8.a = t9.b and t8.b = t9.a;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists BB,CC;
|
||||
--enable_warnings
|
||||
CREATE TABLE BB ( col_varchar_key varchar (1), col_varchar_10 varchar(10), col_varchar varchar (1), col_int_key int, col_varchar_10_key varchar(10), col_varchar_20_key varchar(20), col_int int, col_varchar_20 varchar(20), pk int, /*Indices*/ key idx3(pk, col_varchar_key ), key idx1(pk, col_int_key ), key idx5(pk, col_varchar_10_key ), key idx7(pk, col_varchar_20_key ), primary key (pk) );
|
||||
|
||||
|
||||
CREATE TABLE CC ( col_varchar_key varchar (1), col_varchar_20_key varchar(20), col_varchar_20 varchar(20), col_int_key int, col_int int, pk int, col_varchar_10 varchar(10), col_varchar_10_key varchar(10), col_varchar varchar (1), /*Indices*/ key idx3(pk, col_varchar_key ), key idx7(pk, col_varchar_20_key ), key idx1(pk, col_int_key ), primary key (pk) , key idx5(pk, col_varchar_10_key )) ;
|
||||
|
||||
--disable_query_log
|
||||
INSERT INTO BB VALUES ('d', 'n', NULL, NULL, 'm', 'p', 2, 'v', 1) , (NULL, 'i', 'w', 6, 'n', 'r', 9, 'f', 2) , ('k', NULL, 'a', 8, 'p', NULL, NULL, 'j', 3) , (NULL, NULL, NULL, 4, 'b', 'b', 4, 'o', 4) , ('b', 'u', 'z', 7, 'k', 'e', 9, 'z', 5) , ('n', 'm', 's', 5, NULL, 'p', 6, 'y', 6) , ('f', 'e', 'f', 9, 'o', 'i', 9, 't', 7) , ('a', 'u', 's', NULL, 'l', 'g', 6, 'k', 8) , ('s', 'd', NULL, 1, 'r', 'g', NULL, 'j', 9) , ('y', NULL, 'j', 8, 'u', 'v', 7, 'b', 10) , ('w', 'i', NULL, 1, 'v', NULL, 1, NULL, 11) , ('t', NULL, NULL, 6, 'v', 'b', 3, NULL, 12) , ('m', 'i', 'd', 6, 'l', NULL, 3, 't', 13) , ('m', 'l', 'z', 6, 'a', 'b', NULL, 'b', 14) , ('d', 'y', 'c', 9, NULL, 'e', 7, 'g', 15) , ('e', 'm', 'w', 4, 'c', 'u', 6, 'a', 16) , ('a', NULL, 'j', 8, 'd', 'z', NULL, 's', 17) , ('h', 'u', NULL, 5, 't', 'p', 4, NULL, 18) , ('p', 'l', 'u', 8, 'e', 's', 6, 'm', 19) , ('l', 'l', 'h', 1, 'b', 'i', 8, 'z', 20) , ('i', 'f', NULL, NULL, 'g', 'e', NULL, 'p', 21) , ('l', 'w', 'p', 9, 'g', 'b', 4, 'k', 22) , ('j', 'd', 'l', 4, 'x', 'z', NULL, 'u', 23) , ('t', 'a', 'y', 8, 'o', 'e', 8, 'a', 24) , (NULL, 'a', 'a', 0, NULL, 'd', 9, 'm', 25) , (NULL, 'b', NULL, 3, 'i', 'r', NULL, 'i', 26) , ('s', 'v', NULL, 4, 'w', NULL, NULL, 'p', 27) , ('m', 'x', 'y', 0, 'n', 'i', 6, 'k', 28) ;
|
||||
|
||||
INSERT INTO CC VALUES ('x', 'r', 'v', 7, 8, 1, 't', 'j', 't') , (NULL, 'b', 'z', 2, 9, 2, 'p', 'u', 'y') , (NULL, 'q', 'e', 6, NULL, 3, 'u', 's', 'j') , ('d', NULL, 'n', 4, 3, 4, 'n', NULL, 'm') , ('y', 'u', 'b', 8, NULL, 5, 'z', NULL, 't') , ('p', 'f', 'm', 7, 1, 6, NULL, 'k', 'w') , ('m', 'w', 'f', 2, 9, 7, 't', 'w', 'g') , ('w', 'n', 'm', 3, 8, 8, NULL, 't', 'z') , ('o', 'g', 'i', 5, 0, 9, 't', 'a', NULL) , ('m', 'v', 'm', NULL, 7, 10, NULL, 'h', NULL) , ('u', 'm', 'j', 3, 4, 11, 'f', NULL, 'q') , ('h', 'y', NULL, 7, 4, 12, 'k', 't', NULL) , (NULL, 'h', 'g', NULL, 6, 13, 'v', 'd', 'u') , (NULL, NULL, NULL, 4, 5, 14, NULL, 'v', 'm') , ('f', 'x', 'm', 4, 8, 15, 'd', NULL, NULL) , ('s', 'f', 'x', 0, 2, 16, 'l', NULL, 'f') , ('t', 'o', 's', NULL, 8, 17, 'r', NULL, 'r') , ('h', 's', NULL, NULL, 3, 18, 'd', 'r', 'k') , ('u', 'w', 'r', 7, NULL, 19, 'w', NULL, 'c') , ('i', 'o', NULL, 8, 0, 20, 'n', 'i', 'y') , (NULL, NULL, NULL, 9, NULL, 21, 'm', NULL, 'm') , ('p', 'g', 'k', 9, NULL, 22, 'g', 'x', 'v') , (NULL, 'q', NULL, NULL, 2, 23, 'f', 'g', 's') , (NULL, NULL, 'p', 9, 0, 24, 'e', NULL, 'v') , (NULL, 'q', 'm', 3, 9, 25, 'w', 'i', 'm') , ('e', NULL, 'e', 5, NULL, 26, NULL, 'k', 'f') , ('i', 'm', 'n', 0, 4, 27, 'g', NULL, 'a') , ('r', 'g', 'o', 2, NULL, 28, 'c', NULL, 'u') , ('y', NULL, 'o', 2, NULL, 29, 'h', 'n', 'o') ;
|
||||
--enable_query_log
|
||||
|
||||
explain SELECT /*+no_rewrite,leading(table1 table2),use_merge(table1 table2)*/ table1 . col_varchar_10_key AS field1 FROM BB AS table1, CC AS table2 WHERE table1 . `col_int_key` = table2 . `pk` and table2 . `col_int_key` = table1 . `pk` ORDER BY table1 . col_int_key DESC;
|
||||
|
||||
SELECT /*+no_rewrite,leading(table1 table2),use_merge(table1 table2)*/ table1 . col_varchar_10_key AS field1 FROM BB AS table1, CC AS table2 WHERE table1 . `col_int_key` = table2 . `pk` and table2 . `col_int_key` = table1 . `pk` ORDER BY table1 . col_int_key DESC;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t2, t7, t8, t9, BB, CC;
|
||||
--enable_warnings
|
||||
@ -0,0 +1,36 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: xiaoyi.xy
|
||||
# owner group: SQL3
|
||||
# tags: optimizer
|
||||
# description: OUR GOAL: Make all this simple and effective!
|
||||
--result_format 4
|
||||
--explain_protocol 2
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
create table t1 (id int primary key, i2 int);
|
||||
create table t2 (id int primary key, i2 int);
|
||||
insert/*trace*/ into t1(id) values (75);
|
||||
insert/*trace*/ into t1(id) values (79);
|
||||
insert/*trace*/ into t1(id) values (78);
|
||||
insert/*trace*/ into t1(id) values (77);
|
||||
insert/*trace*/ into t1(id) values (104);
|
||||
insert/*trace*/ into t1(id) values (103);
|
||||
insert/*trace*/ into t1(id) values (102);
|
||||
insert/*trace*/ into t1(id) values (101);
|
||||
insert/*trace*/ into t1(id) values (105);
|
||||
insert/*trace*/ into t1(id) values (106);
|
||||
insert/*trace*/ into t1(id) values (107);
|
||||
insert/*trace*/ into t2(id) values (107),(75),(1000);
|
||||
select t1.id, t2.id from t1, t2 where t2.id = t1.id and t1.id>200;
|
||||
--echo
|
||||
select t1.id, t2.id from t1, t2 where t2.id = t1.id and t1.id>200 and t1.id<200;
|
||||
--echo
|
||||
select a.id , b.id from t1 a, t2 b where a.id = b.id and a.id>200 and a.id<200;
|
||||
--echo
|
||||
select a.id, b.id from t1 a, t2 b where a.id = a.id and a.id>200 and a.id<200;
|
||||
|
||||
drop table t1, t2;
|
||||
@ -0,0 +1,37 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: xiaoyi.xy
|
||||
# owner group: SQL3
|
||||
# tags: optimizer
|
||||
# description: OUR GOAL: Make all this simple and effective!
|
||||
--result_format 4
|
||||
--explain_protocol 2
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
create table t1 (id int primary key, i2 int);
|
||||
create table t2 (id int primary key, i2 int);
|
||||
insert/*trace*/ into t1(id) values (75);
|
||||
insert/*trace*/ into t1(id) values (79);
|
||||
insert/*trace*/ into t1(id) values (78);
|
||||
insert/*trace*/ into t1(id) values (77);
|
||||
insert/*trace*/ into t1(id) values (104);
|
||||
insert/*trace*/ into t1(id) values (103);
|
||||
insert/*trace*/ into t1(id) values (102);
|
||||
insert/*trace*/ into t1(id) values (101);
|
||||
insert/*trace*/ into t1(id) values (105);
|
||||
insert/*trace*/ into t1(id) values (106);
|
||||
insert/*trace*/ into t1(id) values (107);
|
||||
insert/*trace*/ into t2(id) values (107),(75),(1000);
|
||||
|
||||
--echo
|
||||
select t1.id, t2.id from t1 join t2 on t2.id = t1.id and t1.id>200;
|
||||
--echo
|
||||
select t1.id, t2.id from t1 join t2 on t2.id = t1.id and t1.id>200 and t1.id<200;
|
||||
--echo
|
||||
select a.id , b.id from t1 a join t2 b on a.id = b.id and a.id>200 and a.id<200;
|
||||
--echo
|
||||
select a.id, b.id from t1 a join t2 b on a.id = a.id and a.id>200 and a.id<200;
|
||||
drop table t1, t2;
|
||||
@ -0,0 +1,37 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
# owner: xiaoyi.xy
|
||||
# owner group: SQL3
|
||||
# tags: optimizer
|
||||
# description: OUR GOAL: Make all this simple and effective!
|
||||
--result_format 4
|
||||
--explain_protocol 2
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
create table t1 (id int primary key, i2 int);
|
||||
create table t2 (id int primary key, i2 int);
|
||||
insert/*trace*/ into t1(id) values (75);
|
||||
insert/*trace*/ into t1(id) values (79);
|
||||
insert/*trace*/ into t1(id) values (78);
|
||||
insert/*trace*/ into t1(id) values (77);
|
||||
insert/*trace*/ into t1(id) values (104);
|
||||
insert/*trace*/ into t1(id) values (103);
|
||||
insert/*trace*/ into t1(id) values (102);
|
||||
insert/*trace*/ into t1(id) values (101);
|
||||
insert/*trace*/ into t1(id) values (105);
|
||||
insert/*trace*/ into t1(id) values (106);
|
||||
insert/*trace*/ into t1(id) values (107);
|
||||
insert/*trace*/ into t2(id) values (107),(75),(1000);
|
||||
|
||||
--echo
|
||||
select t1.id, t2.id from t1 join t2 on t2.id = t1.id where t1.id>200;
|
||||
--echo
|
||||
select t1.id, t2.id from t1 join t2 on t2.id = t1.id where t1.id>200 and t1.id<200;
|
||||
--echo
|
||||
select a.id , b.id from t1 a join t2 b on a.id = b.id where a.id>200 and a.id<200;
|
||||
--echo
|
||||
select a.id , b.id from t1 a join t2 b on a.id = a.id where a.id>200 and a.id<200;
|
||||
drop table t1, t2;
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,216 @@
|
||||
alter system flush plan cache global;
|
||||
select 3;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def 3 3 8 1 1 N 32897 0 63
|
||||
3
|
||||
3
|
||||
select 3.4;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def 3.4 3.4 246 4 3 N 32897 1 63
|
||||
3.4
|
||||
3.4
|
||||
select 3.000000000000000000000000001;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def 3.000000000000000000000000001 3.000000000000000000000000001 246 30 29 N 32897 27 63
|
||||
3.000000000000000000000000001
|
||||
3.000000000000000000000000001
|
||||
select -3;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def -3 -3 8 1 2 N 32897 0 63
|
||||
-3
|
||||
-3
|
||||
select -3.4;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def -3.4 -3.4 246 4 4 N 32897 1 63
|
||||
-3.4
|
||||
-3.4
|
||||
select -3.000000000000000000000000001;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def -3.000000000000000000000000001 -3.000000000000000000000000001 246 30 30 N 32897 27 63
|
||||
-3.000000000000000000000000001
|
||||
-3.000000000000000000000000001
|
||||
select 1, 11, 111, 1111, 11111, 111111, 1111111, 11111111, 111111111, 1111111111,11111111111, 111111111111;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def 1 1 8 1 1 N 32897 0 63
|
||||
def 11 11 8 2 2 N 32897 0 63
|
||||
def 111 111 8 3 3 N 32897 0 63
|
||||
def 1111 1111 8 4 4 N 32897 0 63
|
||||
def 11111 11111 8 5 5 N 32897 0 63
|
||||
def 111111 111111 8 6 6 N 32897 0 63
|
||||
def 1111111 1111111 8 7 7 N 32897 0 63
|
||||
def 11111111 11111111 8 8 8 N 32897 0 63
|
||||
def 111111111 111111111 8 9 9 N 32897 0 63
|
||||
def 1111111111 1111111111 8 10 10 N 32897 0 63
|
||||
def 11111111111 11111111111 8 11 11 N 32897 0 63
|
||||
def 111111111111 111111111111 8 12 12 N 32897 0 63
|
||||
1 11 111 1111 11111 111111 1111111 11111111 111111111 1111111111 11111111111 111111111111
|
||||
1 11 111 1111 11111 111111 1111111 11111111 111111111 1111111111 11111111111 111111111111
|
||||
select TIMESTAMP '2012-12-31 11:30:45', TIMESTAMP '2012-12-31 11:30:45.1', TIMESTAMP '2012-12-31 11:30:45.11', TIMESTAMP '2012-12-31 11:30:45.111', TIMESTAMP '2012-12-31 11:30:45.1111', TIMESTAMP '2012-12-31 11:30:45.11111', TIMESTAMP '2012-12-31 11:30:45.111111';
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def TIMESTAMP '2012-12-31 11:30:45' TIMESTAMP '2012-12-31 11:30:45' 12 19 19 N 129 0 63
|
||||
def TIMESTAMP '2012-12-31 11:30:45.1' TIMESTAMP '2012-12-31 11:30:45.1' 12 21 21 N 129 1 63
|
||||
def TIMESTAMP '2012-12-31 11:30:45.11' TIMESTAMP '2012-12-31 11:30:45.11' 12 22 22 N 129 2 63
|
||||
def TIMESTAMP '2012-12-31 11:30:45.111' TIMESTAMP '2012-12-31 11:30:45.111' 12 23 23 N 129 3 63
|
||||
def TIMESTAMP '2012-12-31 11:30:45.1111' TIMESTAMP '2012-12-31 11:30:45.1111' 12 24 24 N 129 4 63
|
||||
def TIMESTAMP '2012-12-31 11:30:45.11111' TIMESTAMP '2012-12-31 11:30:45.11111' 12 25 25 N 129 5 63
|
||||
def TIMESTAMP '2012-12-31 11:30:45.111111' TIMESTAMP '2012-12-31 11:30:45.111111' 12 26 26 N 129 6 63
|
||||
TIMESTAMP '2012-12-31 11:30:45' TIMESTAMP '2012-12-31 11:30:45.1' TIMESTAMP '2012-12-31 11:30:45.11' TIMESTAMP '2012-12-31 11:30:45.111' TIMESTAMP '2012-12-31 11:30:45.1111' TIMESTAMP '2012-12-31 11:30:45.11111' TIMESTAMP '2012-12-31 11:30:45.111111'
|
||||
2012-12-31 11:30:45 2012-12-31 11:30:45.1 2012-12-31 11:30:45.11 2012-12-31 11:30:45.111 2012-12-31 11:30:45.1111 2012-12-31 11:30:45.11111 2012-12-31 11:30:45.111111
|
||||
select TIME '11:30:45', TIME '11:30:45.111111', TIME '11:30:45.11111', TIME '11:30:45.1111', TIME '11:30:45.111', TIME '11:30:45.11', TIME '11:30:45.1';
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def TIME '11:30:45' TIME '11:30:45' 11 10 8 N 129 0 63
|
||||
def TIME '11:30:45.111111' TIME '11:30:45.111111' 11 17 15 N 129 6 63
|
||||
def TIME '11:30:45.11111' TIME '11:30:45.11111' 11 16 14 N 129 5 63
|
||||
def TIME '11:30:45.1111' TIME '11:30:45.1111' 11 15 13 N 129 4 63
|
||||
def TIME '11:30:45.111' TIME '11:30:45.111' 11 14 12 N 129 3 63
|
||||
def TIME '11:30:45.11' TIME '11:30:45.11' 11 13 11 N 129 2 63
|
||||
def TIME '11:30:45.1' TIME '11:30:45.1' 11 12 10 N 129 1 63
|
||||
TIME '11:30:45' TIME '11:30:45.111111' TIME '11:30:45.11111' TIME '11:30:45.1111' TIME '11:30:45.111' TIME '11:30:45.11' TIME '11:30:45.1'
|
||||
11:30:45 11:30:45.111111 11:30:45.11111 11:30:45.1111 11:30:45.111 11:30:45.11 11:30:45.1
|
||||
select date '1998-09-09';
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def date '1998-09-09' date '1998-09-09' 10 10 10 N 129 0 63
|
||||
date '1998-09-09'
|
||||
1998-09-09
|
||||
select TIMESTAMP '2012-2-1 11:30:45';
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def TIMESTAMP '2012-2-1 11:30:45' TIMESTAMP '2012-2-1 11:30:45' 12 19 19 N 129 0 63
|
||||
TIMESTAMP '2012-2-1 11:30:45'
|
||||
2012-02-01 11:30:45
|
||||
select TIME '11:5:45';
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def TIME '11:5:45' TIME '11:5:45' 11 10 8 N 129 0 63
|
||||
TIME '11:5:45'
|
||||
11:05:45
|
||||
select date '1998-9-9';
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def date '1998-9-9' date '1998-9-9' 10 10 10 N 129 0 63
|
||||
date '1998-9-9'
|
||||
1998-09-09
|
||||
SELECT X'4D7953514C';
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def X'4D7953514C' X'4D7953514C' 253 5 5 N 129 31 63
|
||||
X'4D7953514C'
|
||||
MySQL
|
||||
SELECT 0x5061756c;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def 0x5061756c 0x5061756c 253 5 4 N 129 31 63
|
||||
0x5061756c
|
||||
Paul
|
||||
SELECT 0x636174;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def 0x636174 0x636174 253 5 3 N 129 31 63
|
||||
0x636174
|
||||
cat
|
||||
SELECT TRUE, true, FALSE, false;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def TRUE TRUE 1 1 1 N 32897 0 63
|
||||
def true true 1 1 1 N 32897 0 63
|
||||
def FALSE FALSE 1 1 1 N 32897 0 63
|
||||
def false false 1 1 1 N 32897 0 63
|
||||
TRUE true FALSE false
|
||||
1 1 0 0
|
||||
select 'abcde';
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def abcde abcde 253 20 5 N 1 31 45
|
||||
abcde
|
||||
abcde
|
||||
select '我爱你';
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def 我爱你 我爱你 253 20 9 N 1 31 45
|
||||
我爱你
|
||||
我爱你
|
||||
select '我e爱a你t';
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def 我e爱a你t 我e爱a你t 253 20 12 N 1 31 45
|
||||
我e爱a你t
|
||||
我e爱a你t
|
||||
select '';
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def 253 20 0 N 1 31 45
|
||||
|
||||
|
||||
select ' ';
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def 253 20 1 N 1 31 45
|
||||
|
||||
|
||||
select '0x10';
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def 0x10 0x10 253 20 4 N 1 31 45
|
||||
0x10
|
||||
0x10
|
||||
select '0810';
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def 0810 0810 253 20 4 N 1 31 45
|
||||
0810
|
||||
0810
|
||||
drop table if exists t1;
|
||||
create table t1(f1 datetime(6));
|
||||
insert into t1 values('01-01-01'),('02-02-02'),('01-01-01'),('02-02-02');
|
||||
set @bug28261='';
|
||||
select if(@bug28261 = f1, '', @bug28261:= f1) from t1;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def if(@bug28261 = f1, '', @bug28261:= f1) if(@bug28261 = f1, '', @bug28261:= f1) 253 104 26 Y 0 31 45
|
||||
if(@bug28261 = f1, '', @bug28261:= f1)
|
||||
2001-01-01 00:00:00.000000
|
||||
2002-02-02 00:00:00.000000
|
||||
2001-01-01 00:00:00.000000
|
||||
2002-02-02 00:00:00.000000
|
||||
drop table t1;
|
||||
drop table if exists tt;
|
||||
CREATE TABLE if not exists tt(aa int);
|
||||
select count(*) as cnt from tt a ;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def cnt cnt 8 20 1 Y 32896 0 63
|
||||
cnt
|
||||
0
|
||||
select sum(cnt) from(select count(*) as cnt from tt a ) c;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def sum(cnt) sum(cnt) 246 21 1 Y 32896 0 63
|
||||
sum(cnt)
|
||||
0
|
||||
drop table if exists obright;
|
||||
create table obright(row_id bigint, dec3 decimal(16,6));
|
||||
select dec3 mod (case when row_id > 0 then dec3 else 1 end) from obright;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def dec3 mod (case when row_id > 0 then dec3 else 1 end) dec3 mod (case when row_id > 0 then dec3 else 1 end) 246 28 0 Y 32896 6 63
|
||||
dec3 mod (case when row_id > 0 then dec3 else 1 end)
|
||||
select field(0,'a');
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def field(0,'a') field(0,'a') 8 3 1 Y 32896 0 63
|
||||
field(0,'a')
|
||||
1
|
||||
show warnings;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def subquery_alias subquery_alias Level Level 253 128 7 N 1 31 45
|
||||
def subquery_alias subquery_alias Code Code 8 20 4 N 32897 0 63
|
||||
def subquery_alias subquery_alias Message Message 253 2048 37 N 1 31 45
|
||||
Level Code Message
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'a'
|
||||
select field(1,'a', 'b');
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def field(1,'a', 'b') field(1,'a', 'b') 8 3 1 Y 32896 0 63
|
||||
field(1,'a', 'b')
|
||||
0
|
||||
show warnings;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def subquery_alias subquery_alias Level Level 253 128 7 N 1 31 45
|
||||
def subquery_alias subquery_alias Code Code 8 20 4 N 32897 0 63
|
||||
def subquery_alias subquery_alias Message Message 253 2048 37 N 1 31 45
|
||||
Level Code Message
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'a'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'b'
|
||||
select field(3,'a', 2, 'c');
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def field(3,'a', 2, 'c') field(3,'a', 2, 'c') 8 3 1 Y 32896 0 63
|
||||
field(3,'a', 2, 'c')
|
||||
0
|
||||
show warnings;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def subquery_alias subquery_alias Level Level 253 128 7 N 1 31 45
|
||||
def subquery_alias subquery_alias Code Code 8 20 4 N 32897 0 63
|
||||
def subquery_alias subquery_alias Message Message 253 2048 37 N 1 31 45
|
||||
Level Code Message
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'a'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'c'
|
||||
@ -0,0 +1,186 @@
|
||||
alter system flush plan cache global;
|
||||
drop table if exists tt;
|
||||
create table tt(c tinyint);
|
||||
select avg(c) from tt;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def avg(c) avg(c) 246 10 0 Y 32896 4 63
|
||||
avg(c)
|
||||
NULL
|
||||
drop table if exists tt;
|
||||
create table tt(c tinyint);
|
||||
select 2*avg(c) from tt;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def 2*avg(c) 2*avg(c) 246 11 0 Y 32896 4 63
|
||||
2*avg(c)
|
||||
NULL
|
||||
drop table if exists tt;
|
||||
create table tt(c tinyint);
|
||||
insert into tt values(19),(20);
|
||||
select 2*avg(c) from tt;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def 2*avg(c) 2*avg(c) 246 11 7 Y 32896 4 63
|
||||
2*avg(c)
|
||||
39.0000
|
||||
select str_to_date('1970-01-02','%Y-%m-%d %H:%i:%s') + 1;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def str_to_date('1970-01-02','%Y-%m-%d %H:%i:%s') + 1 str_to_date('1970-01-02','%Y-%m-%d %H:%i:%s') + 1 246 21 14 Y 32896 0 63
|
||||
str_to_date('1970-01-02','%Y-%m-%d %H:%i:%s') + 1
|
||||
19700102000001
|
||||
select str_to_date('1970-01-02','%Y-%m-%d %H:%i:%s') + 10000;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def str_to_date('1970-01-02','%Y-%m-%d %H:%i:%s') + 10000 str_to_date('1970-01-02','%Y-%m-%d %H:%i:%s') + 10000 246 21 14 Y 32896 0 63
|
||||
str_to_date('1970-01-02','%Y-%m-%d %H:%i:%s') + 10000
|
||||
19700102010000
|
||||
select str_to_date('1970-01-02',null) + 100;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def str_to_date('1970-01-02',null) + 100 str_to_date('1970-01-02',null) + 100 246 28 0 Y 32896 6 63
|
||||
str_to_date('1970-01-02',null) + 100
|
||||
NULL
|
||||
select str_to_date('1970-01-02','null') + 100;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def str_to_date('1970-01-02','null') + 100 str_to_date('1970-01-02','null') + 100 8 11 0 Y 32896 0 63
|
||||
str_to_date('1970-01-02','null') + 100
|
||||
NULL
|
||||
Warnings:
|
||||
Warning 1411 Incorrect datetime value: '1970-01-02' for function str_to_date
|
||||
select str_to_date('1970-01-02',0)+ 1;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def str_to_date('1970-01-02',0)+ 1 str_to_date('1970-01-02',0)+ 1 246 21 0 Y 32896 0 63
|
||||
str_to_date('1970-01-02',0)+ 1
|
||||
NULL
|
||||
Warnings:
|
||||
Warning 1411 Incorrect datetime value: '1970-01-02' for function str_to_date
|
||||
select str_to_date('1970-01-02', 23) +10;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def str_to_date('1970-01-02', 23) +10 str_to_date('1970-01-02', 23) +10 246 21 0 Y 32896 0 63
|
||||
str_to_date('1970-01-02', 23) +10
|
||||
NULL
|
||||
Warnings:
|
||||
Warning 1411 Incorrect datetime value: '1970-01-02' for function str_to_date
|
||||
select str_to_date('1970-01-02 12:23:32','%Y-%m-%d %H:%i:%s')+ 10000;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def str_to_date('1970-01-02 12:23:32','%Y-%m-%d %H:%i:%s')+ 10000 str_to_date('1970-01-02 12:23:32','%Y-%m-%d %H:%i:%s')+ 10000 246 21 14 Y 32896 0 63
|
||||
str_to_date('1970-01-02 12:23:32','%Y-%m-%d %H:%i:%s')+ 10000
|
||||
19700102132332
|
||||
select str_to_date('1970-01-02 12:23:32','%Y-%m-%d')+ 10000;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def str_to_date('1970-01-02 12:23:32','%Y-%m-%d')+ 10000 str_to_date('1970-01-02 12:23:32','%Y-%m-%d')+ 10000 8 11 8 Y 32896 0 63
|
||||
str_to_date('1970-01-02 12:23:32','%Y-%m-%d')+ 10000
|
||||
19710102
|
||||
select str_to_date('12:23:32','%H:%i:%s')+ 10000;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def str_to_date('12:23:32','%H:%i:%s')+ 10000 str_to_date('12:23:32','%H:%i:%s')+ 10000 246 12 6 Y 32896 0 63
|
||||
str_to_date('12:23:32','%H:%i:%s')+ 10000
|
||||
132332
|
||||
select str_to_date('12:23:32',10)+ 10000;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def str_to_date('12:23:32',10)+ 10000 str_to_date('12:23:32',10)+ 10000 246 21 0 Y 32896 0 63
|
||||
str_to_date('12:23:32',10)+ 10000
|
||||
NULL
|
||||
Warnings:
|
||||
Warning 1411 Incorrect datetime value: '12:23:32' for function str_to_date
|
||||
drop table if exists t1, t2, t3, t3k;
|
||||
CREATE TABLE t1 (EMPNUM INT);
|
||||
INSERT INTO t1 VALUES (0), (2);
|
||||
CREATE TABLE t2 (EMPNUM DECIMAL (4, 2));
|
||||
INSERT INTO t2 VALUES (0.0), (9.0);
|
||||
SELECT IFNULL(t2.EMPNUM,t1.EMPNUM) AS CEMPNUM
|
||||
FROM t1 LEFT JOIN t2 ON t1.EMPNUM=t2.EMPNUM;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def CEMPNUM CEMPNUM 246 6 4 Y 32896 2 63
|
||||
CEMPNUM
|
||||
0.00
|
||||
2.00
|
||||
create table t3(a int, b decimal, c varchar(10));
|
||||
select ifnull(0, 0.0);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def ifnull(0, 0.0) ifnull(0, 0.0) 246 4 3 Y 32896 1 63
|
||||
ifnull(0, 0.0)
|
||||
0.0
|
||||
insert into t3 values(0, 2.4, "123");
|
||||
select ifnull(a, b), ifnull(a, c) from t3;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def ifnull(a, b) ifnull(a, b) 246 11 1 Y 32896 0 63
|
||||
def ifnull(a, c) ifnull(a, c) 253 44 1 Y 0 31 45
|
||||
ifnull(a, b) ifnull(a, c)
|
||||
0 0
|
||||
drop table t1,t2, t3;
|
||||
create table t3k(c1 timestamp(6), c2 datetime(5), c3 timestamp(3), c4 datetime(5), c5 datetime(2));
|
||||
select UNIX_TIMESTAMP(c1), UNIX_TIMESTAMP(c2), UNIX_TIMESTAMP(c3), UNIX_TIMESTAMP(c4), UNIX_TIMESTAMP(c5) from t3k;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def UNIX_TIMESTAMP(c1) UNIX_TIMESTAMP(c1) 246 20 0 Y 32896 6 63
|
||||
def UNIX_TIMESTAMP(c2) UNIX_TIMESTAMP(c2) 246 19 0 Y 32896 5 63
|
||||
def UNIX_TIMESTAMP(c3) UNIX_TIMESTAMP(c3) 246 17 0 Y 32896 3 63
|
||||
def UNIX_TIMESTAMP(c4) UNIX_TIMESTAMP(c4) 246 19 0 Y 32896 5 63
|
||||
def UNIX_TIMESTAMP(c5) UNIX_TIMESTAMP(c5) 246 16 0 Y 32896 2 63
|
||||
UNIX_TIMESTAMP(c1) UNIX_TIMESTAMP(c2) UNIX_TIMESTAMP(c3) UNIX_TIMESTAMP(c4) UNIX_TIMESTAMP(c5)
|
||||
drop table t3k;
|
||||
drop table if exists t1, t2, t3, t3k;
|
||||
drop view if exists v1;
|
||||
CREATE TABLE t1 (a DATETIME NOT NULL);
|
||||
INSERT INTO t1 VALUES ('2009-09-20 07:32:39.06');
|
||||
INSERT INTO t1 VALUES ('0000-00-00 00:00:00.00');
|
||||
CREATE VIEW v1 AS SELECT * FROM t1;
|
||||
SELECT CAST(UNIX_TIMESTAMP(a) AS DECIMAL(25,3)) AS c1 FROM v1 ORDER BY 1;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def c1 c1 246 27 14 Y 32896 3 63
|
||||
c1
|
||||
0.000
|
||||
1253403159.000
|
||||
CREATE TABLE t2 (a VARCHAR(32) NOT NULL);
|
||||
INSERT INTO t2 VALUES ('a');
|
||||
SELECT 1 FROM t2 GROUP BY @a:=UNIX_TIMESTAMP(a);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def 1 1 8 1 1 N 32897 0 63
|
||||
1
|
||||
1
|
||||
SELECT a, UNIX_TIMESTAMP(a), UNIX_TIMESTAMP('a') FROM t2;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def test t2 t2 a a 253 128 1 N 1 31 45
|
||||
def UNIX_TIMESTAMP(a) UNIX_TIMESTAMP(a) 246 20 8 Y 32896 6 63
|
||||
def UNIX_TIMESTAMP('a') UNIX_TIMESTAMP('a') 246 20 8 Y 32896 6 63
|
||||
a UNIX_TIMESTAMP(a) UNIX_TIMESTAMP('a')
|
||||
a 0.000000 0.000000
|
||||
SELECT a, UNIX_TIMESTAMP(a), UNIX_TIMESTAMP('5000-01-01 00:00:00') FROM t2;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def test t2 t2 a a 253 128 1 N 1 31 45
|
||||
def UNIX_TIMESTAMP(a) UNIX_TIMESTAMP(a) 246 20 8 Y 32896 6 63
|
||||
def UNIX_TIMESTAMP('5000-01-01 00:00:00') UNIX_TIMESTAMP('5000-01-01 00:00:00') 8 12 11 Y 32896 0 63
|
||||
a UNIX_TIMESTAMP(a) UNIX_TIMESTAMP('5000-01-01 00:00:00')
|
||||
a 0.000000 95617555200
|
||||
create table tbl1(a datetime(5),b date,c timestamp, d double);
|
||||
set time_zone='-3:00';
|
||||
insert into tbl1 values("2010-01-01 11:22:33","2010-10-01","2010-01-01 11:22:33",3302747.4167);
|
||||
insert into tbl1 values(20100101112233,20101001,20100101112233,3302747.4167);
|
||||
set time_zone='+4:00';
|
||||
select UNIX_TIMESTAMP(a),UNIX_TIMESTAMP(b),UNIX_TIMESTAMP(c),UNIX_TIMESTAMP(d) from tbl1;
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def UNIX_TIMESTAMP(a) UNIX_TIMESTAMP(a) 246 19 16 Y 32896 5 63
|
||||
def UNIX_TIMESTAMP(b) UNIX_TIMESTAMP(b) 8 12 10 Y 32896 0 63
|
||||
def UNIX_TIMESTAMP(c) UNIX_TIMESTAMP(c) 8 12 10 Y 32896 0 63
|
||||
def UNIX_TIMESTAMP(d) UNIX_TIMESTAMP(d) 246 20 8 Y 32896 6 63
|
||||
UNIX_TIMESTAMP(a) UNIX_TIMESTAMP(b) UNIX_TIMESTAMP(c) UNIX_TIMESTAMP(d)
|
||||
1262330553.00000 1285876800 1262355753 0.000000
|
||||
1262330553.00000 1285876800 1262355753 0.000000
|
||||
select UNIX_TIMESTAMP(1);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def UNIX_TIMESTAMP(1) UNIX_TIMESTAMP(1) 8 12 1 Y 32896 0 63
|
||||
UNIX_TIMESTAMP(1)
|
||||
0
|
||||
select UNIX_TIMESTAMP("1");
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def UNIX_TIMESTAMP("1") UNIX_TIMESTAMP("1") 246 20 8 Y 32896 6 63
|
||||
UNIX_TIMESTAMP("1")
|
||||
0.000000
|
||||
select UNIX_TIMESTAMP("2010-01-01 11:22:33");
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def UNIX_TIMESTAMP("2010-01-01 11:22:33") UNIX_TIMESTAMP("2010-01-01 11:22:33") 8 12 10 Y 32896 0 63
|
||||
UNIX_TIMESTAMP("2010-01-01 11:22:33")
|
||||
1262330553
|
||||
select UNIX_TIMESTAMP(20100101112233);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def UNIX_TIMESTAMP(20100101112233) UNIX_TIMESTAMP(20100101112233) 8 12 10 Y 32896 0 63
|
||||
UNIX_TIMESTAMP(20100101112233)
|
||||
1262330553
|
||||
drop table t1, t2, tbl1;
|
||||
drop view v1;
|
||||
@ -0,0 +1,161 @@
|
||||
alter system flush plan cache global;
|
||||
select ceil(3.1415926);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def ceil(3.1415926) ceil(3.1415926) 246 9 1 N 32897 0 63
|
||||
ceil(3.1415926)
|
||||
4
|
||||
select ceil(-3.1415926);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def ceil(-3.1415926) ceil(-3.1415926) 246 9 2 N 32897 0 63
|
||||
ceil(-3.1415926)
|
||||
-3
|
||||
select ceil(0.00);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def ceil(0.00) ceil(0.00) 246 4 1 N 32897 0 63
|
||||
ceil(0.00)
|
||||
0
|
||||
select ceil(-0.0);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def ceil(-0.0) ceil(-0.0) 246 3 1 N 32897 0 63
|
||||
ceil(-0.0)
|
||||
0
|
||||
select ceil(0.123456789);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def ceil(0.123456789) ceil(0.123456789) 246 11 1 N 32897 0 63
|
||||
ceil(0.123456789)
|
||||
1
|
||||
select ceil(-0.123456789);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def ceil(-0.123456789) ceil(-0.123456789) 246 11 1 N 32897 0 63
|
||||
ceil(-0.123456789)
|
||||
0
|
||||
select ceil(123456789.123456789);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def ceil(123456789.123456789) ceil(123456789.123456789) 246 11 9 N 32897 0 63
|
||||
ceil(123456789.123456789)
|
||||
123456790
|
||||
select ceil(-99999999.999999999);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def ceil(-99999999.999999999) ceil(-99999999.999999999) 246 11 9 N 32897 0 63
|
||||
ceil(-99999999.999999999)
|
||||
-99999999
|
||||
select ceil(999999999.123456789);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def ceil(999999999.123456789) ceil(999999999.123456789) 246 11 10 N 32897 0 63
|
||||
ceil(999999999.123456789)
|
||||
1000000000
|
||||
select ceil(-999999999.123456789);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def ceil(-999999999.123456789) ceil(-999999999.123456789) 246 11 10 N 32897 0 63
|
||||
ceil(-999999999.123456789)
|
||||
-999999999
|
||||
select ceil(-123456789123456789123456789.123456789);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def ceil(-123456789123456789123456789.123456789) ceil(-123456789123456789123456789.123456789) 246 11 28 N 32897 0 63
|
||||
ceil(-123456789123456789123456789.123456789)
|
||||
-123456789123456789123456789
|
||||
select ceil(123456789123456789123456789123456789123456789123456789.123456789);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def ceil(123456789123456789123456789123456789123456789123456789.123456789) ceil(123456789123456789123456789123456789123456789123456789.123456789) 246 11 54 N 32897 0 63
|
||||
ceil(123456789123456789123456789123456789123456789123456789.123456789)
|
||||
123456789123456789123456789123456789123456789123456790
|
||||
select ceil(-123456789123456789123456789123456789123456789123456789.123456789);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def ceil(-123456789123456789123456789123456789123456789123456789.123456789) ceil(-123456789123456789123456789123456789123456789123456789.123456789) 246 11 55 N 32897 0 63
|
||||
ceil(-123456789123456789123456789123456789123456789123456789.123456789)
|
||||
-123456789123456789123456789123456789123456789123456789
|
||||
select ceil(123456789123456789123456789.123456789123456789123456789123456789);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def ceil(123456789123456789123456789.123456789123456789123456789123456789) ceil(123456789123456789123456789.123456789123456789123456789123456789) 246 64 27 N 32897 0 63
|
||||
ceil(123456789123456789123456789.123456789123456789123456789123456789)
|
||||
123456789123456789123456790
|
||||
select ceil(-123456789123456789123456789.123456789123456789123456789123456789);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def ceil(-123456789123456789123456789.123456789123456789123456789123456789) ceil(-123456789123456789123456789.123456789123456789123456789123456789) 246 64 28 N 32897 0 63
|
||||
ceil(-123456789123456789123456789.123456789123456789123456789123456789)
|
||||
-123456789123456789123456789
|
||||
select ceil(-123456789123456789123456789.123456789);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def ceil(-123456789123456789123456789.123456789) ceil(-123456789123456789123456789.123456789) 246 11 28 N 32897 0 63
|
||||
ceil(-123456789123456789123456789.123456789)
|
||||
-123456789123456789123456789
|
||||
select ceil(999999999999999999999999999999999999999999999.499999999);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def ceil(999999999999999999999999999999999999999999999.499999999) ceil(999999999999999999999999999999999999999999999.499999999) 246 11 46 N 32897 0 63
|
||||
ceil(999999999999999999999999999999999999999999999.499999999)
|
||||
1000000000000000000000000000000000000000000000
|
||||
select ceil(999999999999999999999999999999999999999999999.500000001);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def ceil(999999999999999999999999999999999999999999999.500000001) ceil(999999999999999999999999999999999999999999999.500000001) 246 11 46 N 32897 0 63
|
||||
ceil(999999999999999999999999999999999999999999999.500000001)
|
||||
1000000000000000000000000000000000000000000000
|
||||
select ceil(99999999999999999999999999999999999999999999.399999999);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def ceil(99999999999999999999999999999999999999999999.399999999) ceil(99999999999999999999999999999999999999999999.399999999) 246 11 45 N 32897 0 63
|
||||
ceil(99999999999999999999999999999999999999999999.399999999)
|
||||
100000000000000000000000000000000000000000000
|
||||
select ceil(-99999999999999999999999999999999999999999999.399999999);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def ceil(-99999999999999999999999999999999999999999999.399999999) ceil(-99999999999999999999999999999999999999999999.399999999) 246 11 45 N 32897 0 63
|
||||
ceil(-99999999999999999999999999999999999999999999.399999999)
|
||||
-99999999999999999999999999999999999999999999
|
||||
select ceil(-99999999999999999999999999999999999999999999.399999999);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def ceil(-99999999999999999999999999999999999999999999.399999999) ceil(-99999999999999999999999999999999999999999999.399999999) 246 11 45 N 32897 0 63
|
||||
ceil(-99999999999999999999999999999999999999999999.399999999)
|
||||
-99999999999999999999999999999999999999999999
|
||||
select ceil(999999999999999999999999999999999999999999999211111.399999999);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def ceil(999999999999999999999999999999999999999999999211111.399999999) ceil(999999999999999999999999999999999999999999999211111.399999999) 246 11 51 N 32897 0 63
|
||||
ceil(999999999999999999999999999999999999999999999211111.399999999)
|
||||
999999999999999999999999999999999999999999999211112
|
||||
select ceil(-999999999999999999999999999999999999999999999211111.399999999);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def ceil(-999999999999999999999999999999999999999999999211111.399999999) ceil(-999999999999999999999999999999999999999999999211111.399999999) 246 11 52 N 32897 0 63
|
||||
ceil(-999999999999999999999999999999999999999999999211111.399999999)
|
||||
-999999999999999999999999999999999999999999999211111
|
||||
select ceil(-999999999999999999999999999999999999999999999511111.399999999);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def ceil(-999999999999999999999999999999999999999999999511111.399999999) ceil(-999999999999999999999999999999999999999999999511111.399999999) 246 11 52 N 32897 0 63
|
||||
ceil(-999999999999999999999999999999999999999999999511111.399999999)
|
||||
-999999999999999999999999999999999999999999999511111
|
||||
select ceil(-999999999999999999999999999999999999999999999499999.399999999);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def ceil(-999999999999999999999999999999999999999999999499999.399999999) ceil(-999999999999999999999999999999999999999999999499999.399999999) 246 11 52 N 32897 0 63
|
||||
ceil(-999999999999999999999999999999999999999999999499999.399999999)
|
||||
-999999999999999999999999999999999999999999999499999
|
||||
select ceil(-1);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def ceil(-1) ceil(-1) 8 2 2 N 32897 0 63
|
||||
ceil(-1)
|
||||
-1
|
||||
select floor(-1);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def floor(-1) floor(-1) 8 2 2 N 32897 0 63
|
||||
floor(-1)
|
||||
-1
|
||||
select ceil(-161);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def ceil(-161) ceil(-161) 8 2 4 N 32897 0 63
|
||||
ceil(-161)
|
||||
-161
|
||||
select floor(-161);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def floor(-161) floor(-161) 8 2 4 N 32897 0 63
|
||||
floor(-161)
|
||||
-161
|
||||
select ceil(null);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def ceil(null) ceil(null) 5 23 0 Y 32896 0 63
|
||||
ceil(null)
|
||||
NULL
|
||||
select floor(null);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def floor(null) floor(null) 5 23 0 Y 32896 0 63
|
||||
floor(null)
|
||||
NULL
|
||||
select floor(1+null*5);
|
||||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
|
||||
def floor(1+null*5) floor(1+null*5) 5 23 0 Y 32896 0 63
|
||||
floor(1+null*5)
|
||||
NULL
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user