move test folder
This commit is contained in:
parent
29e0cb7475
commit
d5269307a9
2
deps/logmessage
vendored
2
deps/logmessage
vendored
@ -1 +1 @@
|
||||
Subproject commit 4f9e63f635e841e457cd1d6f28d80ef2e196ebea
|
||||
Subproject commit 509d86f9ea7afa6a5e6a577e95d20633f6c584b7
|
@ -1,31 +0,0 @@
|
||||
#--disable_query_log
|
||||
#--disable_result_log
|
||||
#
|
||||
#let $index_status_expect = 2;
|
||||
#let $result = 2;
|
||||
#
|
||||
#connect (obsys_caio,$OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
#connection obsys_caio;
|
||||
#let $i=210;
|
||||
#while($i>0)
|
||||
#{
|
||||
# sleep 1;
|
||||
# #--echo $index_name
|
||||
# ## let $result = query_get_value(select count(*) from oceanbase.__all_virtual_table where table_name like '__idx_%' and index_status!=2,count(*),1);
|
||||
# let $result = query_get_value(select count(*) from oceanbase.__all_virtual_table as t join oceanbase.__all_virtual_database as d where t.tenant_id = d.tenant_id and t.database_id = d.database_id and d.in_recyclebin = false and d.database_name != "__recyclebin" and t.table_name like '__idx_%' and t.index_status!=2,count(*),1);
|
||||
# if($result == 0)
|
||||
# {
|
||||
# let $i = -4;
|
||||
# }
|
||||
# dec $i;
|
||||
#}
|
||||
#sleep 2;
|
||||
#if($i != -5)
|
||||
#{
|
||||
# let $table_id = query_get_value(select table_id from oceanbase.__all_virtual_table as t join oceanbase.__all_virtual_database as d where t.tenant_id = d.tenant_id and t.database_id = d.database_id and d.in_recyclebin = false and d.database_name != "__recyclebin" and t.table_name like '__idx_%' and t.index_status!=2 limit 1,table_id,1);
|
||||
# --echo $result idx is build failed, first table id is $table_id
|
||||
#}
|
||||
#disconnect obsys_caio;
|
||||
#connection default;
|
||||
#--enable_query_log
|
||||
#--enable_result_log
|
@ -1,9 +0,0 @@
|
||||
|
||||
let $cluster_is_ob = 1;
|
||||
let $cluster_is_mysql = 0;
|
||||
let $collation_count = query_get_value(select count(1) as cnt from information_schema.COLLATIONS, cnt, 1);
|
||||
if ($collation_count > 100) {
|
||||
let $cluster_is_ob = 0;
|
||||
let $cluster_is_mysql = 1;
|
||||
}
|
||||
|
@ -1,22 +0,0 @@
|
||||
|
||||
connect (ob_sys_check_schema,$OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connection ob_sys_check_schema;
|
||||
|
||||
let $i = 10;
|
||||
while($i > 0)
|
||||
{
|
||||
sleep 1;
|
||||
let $cnt = query_get_value(select count(*) as cnt from oceanbase.__all_virtual_server_schema_info as a join oceanbase.__all_virtual_server_schema_info as b on a.tenant_id = b.tenant_id where a.refreshed_schema_version != b.refreshed_schema_version, cnt, 1);
|
||||
dec $i;
|
||||
if ($cnt == 0)
|
||||
{
|
||||
let $i = -4;
|
||||
}
|
||||
}
|
||||
|
||||
if ($i != -4)
|
||||
{
|
||||
--echo check schema sync timeout
|
||||
eval select * from oceanbase.__all_virtual_server_schema_info;
|
||||
}
|
||||
disconnect ob_sys_check_schema;
|
@ -1,25 +0,0 @@
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
connection default;
|
||||
let $tenant_id = query_get_value(select effective_tenant_id() as ID from dual, ID, 1);
|
||||
connect (obsys_ydm,$OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connection obsys_ydm;
|
||||
let $__i__= 100;
|
||||
while($__i__ > 0)
|
||||
{
|
||||
sleep 1;
|
||||
dec $__i__;
|
||||
|
||||
## 检查有没有分区的列级统计信息还没有汇报上来
|
||||
let $__num__ = query_get_value(select count(*) as num from oceanbase.__all_virtual_meta_table a where a.tenant_id = $tenant_id and not exists (select 1 from oceanbase.__all_virtual_column_statistic b where a.table_id = b.table_id and a.partition_id = b.partition_id and b.tenant_id = $tenant_id), num, 1);
|
||||
if($__num__ == 0)
|
||||
{
|
||||
let $__i__ = -5;
|
||||
}
|
||||
}
|
||||
|
||||
connection default;
|
||||
disconnect obsys_ydm;
|
||||
|
||||
--enable_query_log
|
||||
--enable_result_log
|
@ -1,24 +0,0 @@
|
||||
|
||||
let $server_cnt = query_get_value(select count(*) as cnt from oceanbase.__all_server, cnt, 1);
|
||||
|
||||
let $schema_version = query_get_value(select max(schema_version) as max_schema_version from oceanbase.__all_tenant_history, max_schema_version, 1);
|
||||
|
||||
let $sync_cnt = 0;
|
||||
|
||||
let $i = 10;
|
||||
while($i > 0)
|
||||
{
|
||||
sleep 1;
|
||||
dec $i;
|
||||
let $sync_cnt = query_get_value(select count(*) as cnt from oceanbase.__all_virtual_server_schema_info where refreshed_schema_version >= $schema_version and tenant_id = 1, cnt, 1);
|
||||
if ($sync_cnt == $server_cnt)
|
||||
{
|
||||
let $i = -4;
|
||||
}
|
||||
}
|
||||
|
||||
if ($i != -4)
|
||||
{
|
||||
--echo check tenant sync timeout, sync_cnt:$sync_cnt, server_cnt:$server_cnt
|
||||
eval select * from oceanbase.__all_virtual_server_schema_info where refreshed_schema_version >= $schema_version and tenant_id = 1;
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
## 功能: 获取指定租户的ip&port
|
||||
# 1.最好使用前sleep下,否则tenant_schema有可能还未刷到server上导致连接不上
|
||||
# 2.如果分布于多个server,取unit_id最小的
|
||||
## 用法:
|
||||
# 1.设置待连接的tenant_name
|
||||
# 2.source本文件
|
||||
# 3.connect
|
||||
## 模板:
|
||||
# sleep 3;
|
||||
# let $__tenant_name__ = 'tt1';
|
||||
# --source mysql_test/include/get_tenant_server.inc
|
||||
# connect (conn1,$TE_SERVER_IP,root@tt1,,*NO-ONE*,$TE_SERVER_PORT);
|
||||
|
||||
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
connect (obsys,$OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connection obsys;
|
||||
let $__tenant_id__ = `select tenant_id from oceanbase.__all_tenant where tenant_name = $__tenant_name__ limit 1`;
|
||||
let $__resource_pool_id__ = `select resource_pool_id from oceanbase.__all_resource_pool where tenant_id = $__tenant_id__ limit 1`;
|
||||
|
||||
let $__svr_ip__ = `select svr_ip from oceanbase.__all_unit where resource_pool_id = $__resource_pool_id__ limit 1`;
|
||||
let $__svr_port__ = `select svr_port from oceanbase.__all_unit where resource_pool_id = $__resource_pool_id__ limit 1`;
|
||||
|
||||
let $__inner_port__ = `select inner_port from oceanbase.__all_server where svr_ip = '$__svr_ip__' and svr_port = $__svr_port__ limit 1`;
|
||||
|
||||
let $TE_SERVER_IP = $__svr_ip__;
|
||||
let $TE_SERVER_PORT = $__inner_port__;
|
||||
disconnect obsys;
|
||||
connection default;
|
||||
--enable_query_log
|
||||
--enable_result_log
|
@ -1,6 +0,0 @@
|
||||
connect (obsys_idm,$OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connection obsys_idm;
|
||||
set ob_enable_index_direct_select=1;
|
||||
alter system set merger_check_interval = '10s';
|
||||
disconnect obsys_idm;
|
||||
connection default;
|
@ -1,5 +0,0 @@
|
||||
connect (obsys,$OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connection obsys;
|
||||
alter system major freeze;
|
||||
disconnect obsys;
|
||||
connection default;
|
@ -1,5 +0,0 @@
|
||||
-- require mysql_test/r/not_embedded.require
|
||||
disable_query_log;
|
||||
select version() like '%embedded%' as 'have_embedded';
|
||||
enable_query_log;
|
||||
|
@ -1,9 +0,0 @@
|
||||
|
||||
connection default;
|
||||
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
select * from proxy_mock_table_for_pc;
|
||||
--enable_query_log
|
||||
--enable_result_log
|
||||
|
@ -1 +0,0 @@
|
||||
--replace_regex /REPLICA_NUM = [0-9]*/REPLICA_NUM = 1/g /ROW_FORMAT = (DYNAMIC|COMPRESSED|COMPACT|REDUNDANT)[ ]*//g /(NOCOMPRESS|COMPRESS) (FOR)*[ ]*(BASIC|OLTP|QUERY|ARCHIVE)*[ ]*//g /zstd_1\.3\.8/lz4_1.0/g /OBFK_[0-9]*/OBFK_1234/g /OBPK_[0-9]*/OBPK_1234/g /OBUNIQUE_[0-9]*/OBUNIQUE_1234/g /RECYCLE_\$_[0-9]*_[0-9]*_OBCHECK_[0-9]*/RECYCLE_$_1_2_OBCHECK_3/g /PCTFREE = [0-9]*/PCTFREE = 10/g
|
@ -1 +0,0 @@
|
||||
--replace_regex /REPLICA_NUM = [0-9]*/REPLICA_NUM = NUM/g /ROW_FORMAT = (DYNAMIC|COMPRESSED|COMPACT|REDUNDANT)[ ]*//g /(NOCOMPRESS|COMPRESS) (FOR)*[ ]*(BASIC|OLTP|QUERY|ARCHIVE)*[ ]*//g /zstd_1\.3\.8/lz4_1.0/g /OBFK_[0-9]*/OBFK_1234/g /OBIDX_[0-9]*/OBIDX_1234/g /OBCHECK_[0-9]*/OBCHECK_1234/g /OBPK_[0-9]*/OBPK_1234/g /OBUNIQUE_[0-9]*/OBUNIQUE_1234/g /zone1;zone2/zone1/g /BLOCK_SIZE = [0-9]*/BLOCK_SIZE = SIZE/g /TABLET_SIZE = [0-9]*/TABLET_SIZE = SIZE/g /ZONE_LIST = \(.*\)/ZONE_LIST = (test)/g /PRIMARY_ZONE = .*/PRIMARY_ZONE = /g /PCTFREE = [0-9]*/PCTFREE = 10/g
|
@ -1,45 +0,0 @@
|
||||
#--disable_query_log
|
||||
#--disable_result_log
|
||||
connect (obsys_ydm,$OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connection obsys_ydm;
|
||||
let $__i__= 600;
|
||||
while($__i__ > 0)
|
||||
{
|
||||
sleep 1;
|
||||
dec $__i__;
|
||||
let $__forzen_version__ = query_get_value(select value from oceanbase.__all_zone where name = 'frozen_version', value, 1);
|
||||
let $__merged_version__ = query_get_value(select value from oceanbase.__all_zone where name = 'last_merged_version' and zone = '', value, 1);
|
||||
if($__forzen_version__ == $__merged_version__)
|
||||
{
|
||||
let $__i__ = -5;
|
||||
}
|
||||
}
|
||||
|
||||
###判断集群状态,先注释掉
|
||||
#let $__j__= 180;
|
||||
#while($__j__ > 0)
|
||||
#{
|
||||
# sleep 1;
|
||||
# dec $__j__;
|
||||
# let $__global_stat__ = query_get_value(select comment from oceanbase.__all_cluster_stat where name='global_stat',comment, 1);
|
||||
# if($__global_stat__ == NORMAL)
|
||||
# {
|
||||
# let $__j__ = -5;
|
||||
# }
|
||||
#}
|
||||
|
||||
#if($__j__ != -5)
|
||||
#{
|
||||
# --echo major freeze failed
|
||||
#}
|
||||
|
||||
if($__i__ != -5)
|
||||
{
|
||||
--echo major freeze failed
|
||||
}
|
||||
sleep 2;
|
||||
|
||||
disconnect obsys_ydm;
|
||||
connection default;
|
||||
--enable_query_log
|
||||
--enable_result_log
|
@ -1,2 +0,0 @@
|
||||
have_embedded
|
||||
0
|
@ -1,37 +0,0 @@
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t_h3_01_20;
|
||||
drop table if exists t_h3_05_24;
|
||||
drop table if exists t_h3_09_28;
|
||||
drop table if exists t_h5_01_20;
|
||||
drop table if exists t_h5_05_24;
|
||||
drop table if exists t_h5_09_28;
|
||||
drop table if exists t_r4_01_20;
|
||||
drop table if exists t_r4_05_24;
|
||||
drop table if exists t_r4_09_28;
|
||||
drop table if exists t_r5_01_20;
|
||||
drop table if exists t_r5_05_24;
|
||||
drop table if exists t_r5_09_28;
|
||||
drop table if exists t_h3_r4_01_20;
|
||||
drop table if exists t_h3_r5_09_28;
|
||||
drop table if exists t_h5_r4_01_20;
|
||||
drop table if exists t_h5_r5_09_28;
|
||||
|
||||
drop table if exists t_refered;
|
||||
drop table if exists t_h5_int;
|
||||
drop table if exists t_r4_int;
|
||||
drop table if exists t_r4_date;
|
||||
drop table if exists t_r4_datetime;
|
||||
drop table if exists t_r4_timestamp;
|
||||
drop table if exists t_h5_r4_int_int;
|
||||
drop table if exists t_h5_r4_int_int_datetime;
|
||||
|
||||
|
||||
drop table if exists t_r4_h2_date_int;
|
||||
drop table if exists t_r4_h3_date_int;
|
||||
drop table if exists t_r4_h3_date_bigint;
|
||||
drop table if exists tt;
|
||||
|
||||
drop table if exists t_many_range_part;
|
||||
|
||||
--enable_warnings
|
@ -1,355 +0,0 @@
|
||||
|
||||
--source mysql_test/include/check_ob_or_mysql.inc
|
||||
|
||||
create table t_h3_01_20(a int, b int, c datetime, primary key (a)) partition by hash(a) partitions 3;
|
||||
create table t_h3_05_24(a int, b int, c datetime, primary key (a)) partition by hash(a) partitions 3;
|
||||
create table t_h3_09_28(a int, b int, c datetime, primary key (a)) partition by hash(a) partitions 3;
|
||||
create table t_h5_01_20(a int, b int, c datetime, primary key (a)) partition by hash(a) partitions 5;
|
||||
create table t_h5_05_24(a int, b int, c datetime, primary key (a)) partition by hash(a) partitions 5;
|
||||
create table t_h5_09_28(a int, b int, c datetime, primary key (a)) partition by hash(a) partitions 5;
|
||||
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)
|
||||
);
|
||||
create table t_r4_05_24(a int, b int, c datetime, primary key (a))
|
||||
partition by range columns(a)
|
||||
(
|
||||
partition p10 values less than (10),
|
||||
partition p15 values less than (15),
|
||||
partition p20 values less than (20),
|
||||
partition pm values less than (MAXVALUE)
|
||||
);
|
||||
create table t_r4_09_28(a int, b int, c datetime, primary key (a))
|
||||
partition by range columns(a)
|
||||
(
|
||||
partition p14 values less than (14),
|
||||
partition p19 values less than (19),
|
||||
partition p24 values less than (24),
|
||||
partition pm values less than (MAXVALUE)
|
||||
);
|
||||
create table t_r5_01_20(a int, b int, c datetime, primary key (a))
|
||||
partition by range columns(a)
|
||||
(
|
||||
partition p5 values less than (5),
|
||||
partition p9 values less than (9),
|
||||
partition p13 values less than (13),
|
||||
partition p17 values less than (17),
|
||||
partition pm values less than (MAXVALUE)
|
||||
);
|
||||
create table t_r5_05_24(a int, b int, c datetime, primary key (a))
|
||||
partition by range columns(a)
|
||||
(
|
||||
partition p9 values less than (9),
|
||||
partition p13 values less than (13),
|
||||
partition p17 values less than (17),
|
||||
partition p21 values less than (21),
|
||||
partition pm values less than (MAXVALUE)
|
||||
);
|
||||
create table t_r5_09_28(a int, b int, c datetime, primary key (a,b))
|
||||
partition by range columns(a)
|
||||
(
|
||||
partition p13 values less than (13),
|
||||
partition p17 values less than (17),
|
||||
partition p21 values less than (21),
|
||||
partition p25 values less than (25),
|
||||
partition pm values less than (MAXVALUE)
|
||||
);
|
||||
#--disable_query_log
|
||||
if ($cluster_is_ob == 1) {
|
||||
create table t_h3_r4_01_20(a int, b int, c int, d int, e datetime, primary key (a, b, c))
|
||||
partition by hash(a)
|
||||
subpartition by range(b)
|
||||
subpartition template (
|
||||
subpartition p6 values less than (6),
|
||||
subpartition p11 values less than (11),
|
||||
subpartition p16 values less than (16),
|
||||
subpartition pm values less than (MAXVALUE)
|
||||
)
|
||||
partitions 3;
|
||||
create table t_h3_r5_09_28(a int, b int, c int, d int, e datetime, primary key (a, b))
|
||||
partition by hash(a)
|
||||
subpartition by range(b)
|
||||
subpartition template (
|
||||
subpartition p13 values less than (13),
|
||||
subpartition p17 values less than (17),
|
||||
subpartition p21 values less than (21),
|
||||
subpartition p25 values less than (25),
|
||||
subpartition pm values less than (MAXVALUE)
|
||||
)
|
||||
partitions 3;
|
||||
create table t_h5_r4_01_20(a int, b int, c int, d int, e datetime, primary key (a, b))
|
||||
partition by hash(a)
|
||||
subpartition by range(b)
|
||||
subpartition template (
|
||||
subpartition p6 values less than (6),
|
||||
subpartition p11 values less than (11),
|
||||
subpartition p16 values less than (16),
|
||||
subpartition pm values less than (MAXVALUE)
|
||||
)
|
||||
partitions 5;
|
||||
create table t_h5_r5_09_28(a int, b int, c int, d int, e datetime, primary key (a, b, c))
|
||||
partition by hash(a)
|
||||
subpartition by range(b)
|
||||
subpartition template (
|
||||
subpartition p13 values less than (13),
|
||||
subpartition p17 values less than (17),
|
||||
subpartition p21 values less than (21),
|
||||
subpartition p25 values less than (25),
|
||||
subpartition pm values less than (MAXVALUE)
|
||||
)
|
||||
partitions 5;
|
||||
}
|
||||
if ($cluster_is_mysql == 1) {
|
||||
create table t_h3_r4_01_20(a int, b int, c int, d int, e datetime, primary key (a, b, c));
|
||||
create table t_h3_r5_09_28(a int, b int, c int, d int, e datetime, primary key (a, b));
|
||||
create table t_h5_r4_01_20(a int, b int, c int, d int, e datetime, primary key (a, b));
|
||||
create table t_h5_r5_09_28(a int, b int, c int, d int, e datetime, primary key (a, b, c));
|
||||
}
|
||||
|
||||
create table t_refered(a int, aa bigint, b int unsigned, bb bigint unsigned, c datetime, d date, e timestamp, primary key (a)) partition by hash(a) partitions 3;
|
||||
|
||||
create table t_h5_int(a int, b int, c datetime, primary key (a)) partition by hash(a) partitions 5;
|
||||
|
||||
create table t_r4_int(a int, b int, c date, 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)
|
||||
);
|
||||
|
||||
create table t_r4_date(a int, b int, c date, primary key (b,c))
|
||||
partition by range columns(c)
|
||||
(
|
||||
partition p11 values less than ("20161101"),
|
||||
partition p12 values less than ("20161201"),
|
||||
partition p171 values less than ("20170101"),
|
||||
partition pm values less than (MAXVALUE)
|
||||
);
|
||||
|
||||
create table t_r4_datetime(a int, b int, c datetime, primary key (b,c))
|
||||
partition by range columns(c)
|
||||
(
|
||||
partition p11 values less than ("20161101"),
|
||||
partition p12 values less than ("20161201"),
|
||||
partition p171 values less than ("20170101"),
|
||||
partition pm values less than (MAXVALUE)
|
||||
);
|
||||
|
||||
create table t_r4_timestamp(a int, b int, c timestamp, primary key (a))
|
||||
partition by range columns(a)
|
||||
(
|
||||
partition p11 values less than (10),
|
||||
partition p12 values less than (100),
|
||||
partition p171 values less than (1000),
|
||||
partition pm values less than (MAXVALUE)
|
||||
);
|
||||
|
||||
create table t_h5_r4_int_int(a int, b int, c datetime, primary key (a, b))
|
||||
partition by hash(a)
|
||||
subpartition by range columns(b)
|
||||
subpartition template (
|
||||
subpartition p6 values less than (6),
|
||||
subpartition p11 values less than (11),
|
||||
subpartition p16 values less than (16),
|
||||
subpartition pm values less than (MAXVALUE)
|
||||
);
|
||||
|
||||
create table t_r4_h3_date_int(a date, b int, c int, primary key (a, b))
|
||||
partition by range columns(a) subpartition by hash(b) subpartitions 3
|
||||
(
|
||||
partition p11 values less than ("20161101"),
|
||||
partition p12 values less than ("20161201"),
|
||||
partition p171 values less than ("20170101"),
|
||||
partition pm values less than (MAXVALUE)
|
||||
);
|
||||
|
||||
create table t_r4_h2_date_int(a date, b int, c int, primary key (a, b))
|
||||
partition by range columns(a) subpartition by hash(b) subpartitions 2
|
||||
(
|
||||
partition p11 values less than ("20161101"),
|
||||
partition p12 values less than ("20161201"),
|
||||
partition p171 values less than ("20170101"),
|
||||
partition pm values less than (MAXVALUE)
|
||||
);
|
||||
|
||||
create table t_r4_h3_date_bigint(a date, b bigint, c int, primary key (a, b))
|
||||
partition by range columns(a) subpartition by hash(b) subpartitions 3
|
||||
(
|
||||
partition p11 values less than ("20161101"),
|
||||
partition p12 values less than ("20161201"),
|
||||
partition p171 values less than ("20170101"),
|
||||
partition pm values less than (MAXVALUE)
|
||||
);
|
||||
|
||||
|
||||
create table t_h5_r4_int_int_datetime(a int, b int, c datetime, primary key (a, b, c))
|
||||
partition by hash(a)
|
||||
subpartition by range columns(b, c)
|
||||
subpartition template (
|
||||
subpartition p6 values less than (6, "20170510"),
|
||||
subpartition p11 values less than (11, "20170510"),
|
||||
subpartition p16 values less than (16, "20170510"),
|
||||
subpartition pm values less than (MAXVALUE, MAXVALUE)
|
||||
);
|
||||
|
||||
create table tt (a int, b int, c date, primary key(a, b));
|
||||
|
||||
|
||||
|
||||
#--enable_query_log
|
||||
|
||||
insert into t_h3_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);
|
||||
insert into t_h3_05_24 values ( 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),
|
||||
(21, 21, 20161121), (22, 22, 20161122), (23, 23, 20161123), (24, 24, 20161124);
|
||||
insert into t_h3_09_28 values ( 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),
|
||||
(21, 21, 20161121), (22, 22, 20161122), (23, 23, 20161123), (24, 24, 20161124),
|
||||
(25, 25, 20161125), (26, 26, 20161126), (27, 27, 20161127), (28, 28, 20161128);
|
||||
insert into t_h5_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);
|
||||
insert into t_h5_05_24 values ( 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),
|
||||
(21, 21, 20161121), (22, 22, 20161122), (23, 23, 20161123), (24, 24, 20161124);
|
||||
insert into t_h5_09_28 values ( 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),
|
||||
(21, 21, 20161121), (22, 22, 20161122), (23, 23, 20161123), (24, 24, 20161124),
|
||||
(25, 25, 20161125), (26, 26, 20161126), (27, 27, 20161127), (28, 28, 20161128);
|
||||
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);
|
||||
insert into t_r4_05_24 values ( 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),
|
||||
(21, 21, 20161121), (22, 22, 20161122), (23, 23, 20161123), (24, 24, 20161124);
|
||||
insert into t_r4_09_28 values ( 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),
|
||||
(21, 21, 20161121), (22, 22, 20161122), (23, 23, 20161123), (24, 24, 20161124),
|
||||
(25, 25, 20161125), (26, 26, 20161126), (27, 27, 20161127), (28, 28, 20161128);
|
||||
insert into t_r5_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);
|
||||
insert into t_r5_05_24 values ( 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),
|
||||
(21, 21, 20161121), (22, 22, 20161122), (23, 23, 20161123), (24, 24, 20161124);
|
||||
insert into t_r5_09_28 values ( 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),
|
||||
(21, 21, 20161121), (22, 22, 20161122), (23, 23, 20161123), (24, 24, 20161124),
|
||||
(25, 25, 20161125), (26, 26, 20161126), (27, 27, 20161127), (28, 28, 20161128);
|
||||
insert into t_h3_r4_01_20 values ( 1, 1, 1, 1, 20161101), ( 2, 2, 2, 2, 20161102), ( 3, 3, 3, 3, 20161103), ( 4, 4, 4, 4, 20161104),
|
||||
( 5, 5, 5, 5, 20161105), ( 6, 6, 6, 6, 20161106), ( 7, 7, 7, 7, 20161107), ( 8, 8, 8, 8, 20161108),
|
||||
( 9, 9, 9, 9, 20161109), (10, 10, 10, 10, 20161110), (11, 11, 11, 11, 20161111), (12, 12, 12, 12, 20161112),
|
||||
(13, 13, 13, 13, 20161113), (14, 14, 14, 14, 20161114), (15, 15, 15, 15, 20161115), (16, 16, 16, 16, 20161116),
|
||||
(17, 17, 17, 17, 20161117), (18, 18, 18, 18, 20161118), (19, 19, 19, 19, 20161119), (20, 20, 20, 20, 20161120);
|
||||
insert into t_h3_r5_09_28 values ( 9, 9, 9, 9, 20161109), (10, 10, 10, 10, 20161110), (11, 11, 11, 11, 20161111), (12, 12, 12, 12, 20161112),
|
||||
(13, 13, 13, 13, 20161113), (14, 14, 14, 14, 20161114), (15, 15, 15, 15, 20161115), (16, 16, 16, 16, 20161116),
|
||||
(17, 17, 17, 17, 20161117), (18, 18, 18, 18, 20161118), (19, 19, 19, 19, 20161119), (20, 20, 20, 20, 20161120),
|
||||
(21, 21, 21, 21, 20161121), (22, 22, 22, 22, 20161122), (23, 23, 23, 23, 20161123), (24, 24, 24, 24, 20161124),
|
||||
(25, 25, 25, 25, 20161125), (26, 26, 26, 26, 20161126), (27, 27, 27, 27, 20161127), (28, 28, 28, 28, 20161128);
|
||||
insert into t_h5_r4_01_20 values ( 1, 1, 1, 1, 20161101), ( 2, 2, 2, 2, 20161102), ( 3, 3, 3, 3, 20161103), ( 4, 4, 4, 4, 20161104),
|
||||
( 5, 5, 5, 5, 20161105), ( 6, 6, 6, 6, 20161106), ( 7, 7, 7, 7, 20161107), ( 8, 8, 8, 8, 20161108),
|
||||
( 9, 9, 9, 9, 20161109), (10, 10, 10, 10, 20161110), (11, 11, 11, 11, 20161111), (12, 12, 12, 12, 20161112),
|
||||
(13, 13, 13, 13, 20161113), (14, 14, 14, 14, 20161114), (15, 15, 15, 15, 20161115), (16, 16, 16, 16, 20161116),
|
||||
(17, 17, 17, 17, 20161117), (18, 18, 18, 18, 20161118), (19, 19, 19, 19, 20161119), (20, 20, 20, 20, 20161120);
|
||||
insert into t_h5_r5_09_28 values ( 9, 9, 9, 9, 20161109), (10, 10, 10, 10, 20161110), (11, 11, 11, 11, 20161111), (12, 12, 12, 12, 20161112),
|
||||
(13, 13, 13, 13, 20161113), (14, 14, 14, 14, 20161114), (15, 15, 15, 15, 20161115), (16, 16, 16, 16, 20161116),
|
||||
(17, 17, 17, 17, 20161117), (18, 18, 18, 18, 20161118), (19, 19, 19, 19, 20161119), (20, 20, 20, 20, 20161120),
|
||||
(21, 21, 21, 21, 20161121), (22, 22, 22, 22, 20161122), (23, 23, 23, 23, 20161123), (24, 24, 24, 24, 20161124),
|
||||
(25, 25, 25, 25, 20161125), (26, 26, 26, 26, 20161126), (27, 27, 27, 27, 20161127), (28, 28, 28, 28, 20161128);
|
||||
|
||||
insert into t_refered values ( 1, 1, 1, 1, 20161101, 20161101, 20161101), ( 2, 2, 2, 2, 20161101, 20161102, 20161102), ( 3, 3, 3, 3, 20161103, 20161101, 20161103), ( 4, 4, 4, 4, 20161104, 20161101, 20161104);
|
||||
insert into t_h5_int values ( 1, 1, 20161101), ( 2, 2, 20161102), ( 3, 3, 20161103), ( 4, 4, 20161104), ( 5, 5, 20161105);
|
||||
insert into t_r4_int values ( 1, 1, 20161101), ( 2, 2, 20161102), ( 3, 3, 20161103), ( 4, 4, 20161104), ( 5, 5, 20161105);
|
||||
insert into t_r4_date values ( 1, 1, 20161101), ( 2, 2, 20161102), ( 3, 3, 20161103), ( 4, 4, 20161104);
|
||||
insert into t_r4_datetime values ( 1, 1, 20161101), ( 2, 2, 20161102), ( 3, 3, 20161103), ( 4, 4, 20161104);
|
||||
insert into t_r4_timestamp values ( 1, 1, 20161101), ( 2, 2, 20161102), ( 3, 3, 20161103), ( 4, 4, 20161104);
|
||||
insert into t_h5_r4_int_int values ( 1, 1, 20161101), ( 2, 2, 20161102), ( 3, 3, 20161103), ( 4, 4, 20161104);
|
||||
insert into t_h5_r4_int_int_datetime values ( 1, 1, 20161101), ( 2, 2, 20161102), ( 3, 3, 20161103), ( 4, 4, 20161104);
|
||||
|
||||
insert into tt values ( 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),
|
||||
(21, 21, 20161121), (22, 22, 20161122), (23, 23, 20161123), (24, 24, 20161124),
|
||||
(5, 6, 20161105), ( 6, 7, 20161106), ( 7, 8, 20161107), ( 8, 9, 20161108),
|
||||
(9, 10, 20161109), (10, 11, 20161110), (11, 12, 20161111), (12, 13, 20161112),
|
||||
(13, 14, 20161113), (14, 15, 20161114), (15, 16, 20161115), (16, 17, 20161116),
|
||||
(17, 18, 20161117), (18, 19, 20161118), (19, 20, 20161119), (20, 21, 20161120),
|
||||
(21, 22, 20161121), (22, 23, 20161122), (23, 24, 20161123), (24, 25, 20161124);
|
||||
|
||||
insert into t_r4_h2_date_int(b, c, a) values (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),
|
||||
(21, 21, 20161121), (22, 22, 20161122), (23, 23, 20161123), (24, 24, 20161124);
|
||||
|
||||
insert into t_r4_h3_date_int(b, c, a) values ( 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),
|
||||
(21, 21, 20161121), (22, 22, 20161122), (23, 23, 20161123);
|
||||
|
||||
insert into t_r4_h3_date_bigint(b, c, a) values ( 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),
|
||||
(21, 21, 20161121), (22, 22, 20161122);
|
||||
|
||||
create table t_many_range_part(a int, b int, primary key (a))
|
||||
partition by range columns(a)
|
||||
(
|
||||
partition p05 values less than (5),
|
||||
partition p10 values less than (10),
|
||||
partition p15 values less than (15),
|
||||
partition p20 values less than (20),
|
||||
partition p25 values less than (25),
|
||||
partition p30 values less than (30),
|
||||
partition p35 values less than (35),
|
||||
partition p40 values less than (40),
|
||||
partition p45 values less than (45),
|
||||
partition p50 values less than (50),
|
||||
partition p55 values less than (55),
|
||||
partition p60 values less than (60),
|
||||
partition p65 values less than (65),
|
||||
partition p70 values less than (70),
|
||||
partition p75 values less than (75),
|
||||
partition p80 values less than (80),
|
||||
partition p85 values less than (85),
|
||||
partition pm values less than (MAXVALUE)
|
||||
);
|
||||
insert into t_many_range_part values (01, 01), (02, 02), (03, 03), (04, 04), (05, 05), (06, 06), (07, 07), (08, 08), (09, 09), (10, 10),
|
||||
(11, 11), (12, 12), (13, 13), (14, 14), (15, 15), (16, 16), (17, 17), (18, 18), (19, 19), (20, 20),
|
||||
(21, 21), (22, 22), (23, 23), (24, 24), (25, 25), (26, 26), (27, 27), (28, 28), (29, 29), (30, 30),
|
||||
(31, 31), (32, 32), (33, 33), (34, 34), (35, 35), (36, 36), (37, 37), (38, 38), (39, 39), (40, 40),
|
||||
(41, 41), (42, 42), (43, 43), (44, 44), (45, 45), (46, 46), (47, 47), (48, 48), (49, 49), (50, 50);
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,361 +0,0 @@
|
||||
================ 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 |
|
||||
+-----------------------------------------------------+
|
||||
|
||||
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 |
|
||||
+-----------------------------------------------------+
|
||||
|
||||
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 |
|
||||
+-----------------------------------------------------+
|
||||
|
||||
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 |
|
||||
+-----------------------------------------------------+
|
||||
|
||||
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 |
|
||||
+-----------------------------------------------------+
|
||||
|
||||
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 |
|
||||
+-----------------------------------------------------+
|
||||
|
||||
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 |
|
||||
+-----------------------------------------------------+
|
||||
|
||||
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 |
|
||||
+-----------------------------------------------------+
|
||||
|
||||
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 |
|
||||
+-----------------------------------------------------+
|
||||
|
||||
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 |
|
||||
+-----------------------------------------------------+
|
||||
|
||||
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 |
|
||||
+-----------------------------------------------------+
|
||||
|
||||
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 |
|
||||
+-----------------------------------------------------+
|
||||
|
||||
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 |
|
||||
+-----------------------------------------------------+
|
||||
|
||||
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 |
|
||||
+-----------------------------------------------------+
|
||||
|
||||
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 |
|
||||
+-----------------------------------------------------+
|
||||
|
||||
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 |
|
||||
+-----------------------------------------------------+
|
||||
|
||||
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 |
|
||||
+-----------------------------------------------------+
|
||||
|
||||
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 |
|
||||
+-----------------------------------------------------+
|
||||
|
||||
|
||||
|
||||
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 |
|
||||
+-----------------------------------------------------------------+
|
||||
|
||||
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 |
|
||||
+-----------------------------------------------------------------------+
|
||||
|
||||
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 |
|
||||
+-----------------------------------------------------------------------+
|
||||
|
||||
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 |
|
||||
+-----------------------------------------------------------------------+
|
||||
|
||||
SELECT CONVERT_TZ('2021-01-01 07:11:00','Europe/Amsterdam','Libya');
|
||||
+--------------------------------------------------------------+
|
||||
| CONVERT_TZ('2021-01-01 07:11:00','Europe/Amsterdam','Libya') |
|
||||
+--------------------------------------------------------------+
|
||||
| 2021-01-01 08:11:00 |
|
||||
+--------------------------------------------------------------+
|
||||
|
||||
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 |
|
||||
+-------------------------------------------------+
|
||||
|
||||
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 |
|
||||
+-----------------------------------------------+
|
||||
|
||||
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 |
|
||||
+-----------------------------------------------+
|
||||
|
||||
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 |
|
||||
+-----------------------------------------------+
|
||||
|
||||
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 |
|
||||
+-----------------------------------------------+
|
||||
|
||||
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 |
|
||||
+-----------------------------------------------------+
|
||||
|
||||
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 |
|
||||
+-------------------------------------------------------------+
|
||||
|
||||
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 |
|
||||
+-------------------------------------------------+
|
||||
|
||||
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 |
|
||||
+-------------------------------------------------------+
|
||||
|
||||
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 |
|
||||
+-------------------------------------------------------+
|
||||
|
||||
|
||||
|
||||
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 |
|
||||
+---------------------------------------------------+
|
||||
|
||||
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 |
|
||||
+-----------------------------------------------------------+
|
||||
|
||||
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 |
|
||||
+---------------------------------------------------+
|
||||
|
||||
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 |
|
||||
+-----------------------------------------------------------+
|
||||
|
||||
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 |
|
||||
+---------------------------------------------------+
|
||||
|
||||
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 |
|
||||
+---------------------------------------------------+
|
||||
|
||||
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 |
|
||||
+-----------------------------------------------------------+
|
||||
|
||||
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 |
|
||||
+---------------------------------------------------+
|
||||
|
||||
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 |
|
||||
+---------------------------------------------------+
|
||||
|
||||
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 |
|
||||
+---------------------------------------------------+
|
@ -1,66 +0,0 @@
|
||||
--disable_query_log
|
||||
set @@session.explicit_defaults_for_timestamp=off;
|
||||
--enable_query_log
|
||||
--enable_abort_on_error
|
||||
--echo ================ expression convert_tz ================
|
||||
|
||||
# 直接时刻类型
|
||||
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');
|
@ -1,562 +0,0 @@
|
||||
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;
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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;
|
@ -1,15 +0,0 @@
|
||||
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;
|
File diff suppressed because it is too large
Load Diff
@ -1,27 +0,0 @@
|
||||
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);
|
||||
select t1.id, t2.id from t1, t2 where t2.id = t1.id and t1.id>200;
|
||||
id id
|
||||
|
||||
select t1.id, t2.id from t1, t2 where t2.id = t1.id and t1.id>200 and t1.id<200;
|
||||
id id
|
||||
|
||||
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
|
||||
|
||||
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;
|
@ -1,28 +0,0 @@
|
||||
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);
|
||||
|
||||
select t1.id, t2.id from t1 join t2 on t2.id = t1.id and t1.id>200;
|
||||
id id
|
||||
|
||||
select t1.id, t2.id from t1 join t2 on t2.id = t1.id and t1.id>200 and t1.id<200;
|
||||
id id
|
||||
|
||||
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
|
||||
|
||||
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;
|
@ -1,28 +0,0 @@
|
||||
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);
|
||||
|
||||
select t1.id, t2.id from t1 join t2 on t2.id = t1.id where t1.id>200;
|
||||
id id
|
||||
|
||||
select t1.id, t2.id from t1 join t2 on t2.id = t1.id where t1.id>200 and t1.id<200;
|
||||
id id
|
||||
|
||||
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
|
||||
|
||||
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;
|
@ -1,373 +0,0 @@
|
||||
drop database if exists bushy_leading_hint_db;
|
||||
create database bushy_leading_hint_db;
|
||||
use bushy_leading_hint_db;
|
||||
drop table if exists nn1;
|
||||
drop table if exists nn2;
|
||||
drop table if exists t1;
|
||||
drop table if exists t2;
|
||||
drop table if exists t3;
|
||||
create table nn1(c1 int, c2 int, c3 varchar(10));
|
||||
create table nn2(d1 int, d2 int, d3 varchar(10));
|
||||
create table t1(a int, b int, c int);
|
||||
create table t2(a int, b int, c int);
|
||||
create table t3(a int, b int, c int);
|
||||
select /*+ leading(c, (b , a) ) */ count(*),sum(a.c1+b.d2*a.c2) from nn1 a join nn2 b on a.c1 = b.d2 join nn1 c on b.d1 = c.c1 where a.c2 < 5 ;
|
||||
count(*) sum(a.c1+b.d2*a.c2)
|
||||
0 NULL
|
||||
select /*+ leading(c, (b , a) ) */ count(a.c1), sum(a.c2+b.d2) from nn1 a join nn2 b on a.c1 = b.d2 join nn1 c on c.c1 = b.d2 + 1 where a.c2 < 15 ;
|
||||
count(a.c1) sum(a.c2+b.d2)
|
||||
0 NULL
|
||||
select /*+ leading((c, d), (a , b) ) */ count(*),sum(a.c1),sum(b.d2) from nn1 a join nn2 b on a.c1 = b.d2
|
||||
join nn1 c on b.d1 = c.c1 join nn1 d on d.c2 = c.c2 where a.c2 < 5 ;
|
||||
count(*) sum(a.c1) sum(b.d2)
|
||||
0 NULL NULL
|
||||
select /*+ leading(c, d, (a , b)) */ count(*),sum(a.c1+b.d1+c.c1-d.c2) from
|
||||
nn1 a, nn2 b , nn1 c, nn1 d
|
||||
where a.c1 = b.d2 and b.d1 = c.c1 and d.c2 = c.c2;
|
||||
count(*) sum(a.c1+b.d1+c.c1-d.c2)
|
||||
0 NULL
|
||||
select /*+ leading(c, (a ,d, b) ) use_hash(c,d) */ count(a.c1),sum(b.d1*b.d2-a.c2) from nn1 a join nn2 b on a.c1 = b.d2
|
||||
join nn1 c on b.d1 = c.c1 join nn1 d on d.c2 = c.c2 where a.c2 < 5 and d.c1 = b.d2
|
||||
and d.c2 = a.c1 ;
|
||||
count(a.c1) sum(b.d1*b.d2-a.c2)
|
||||
0 NULL
|
||||
select /*+ leading(c, (d, b) ) */ count(*)
|
||||
from nn2 b, nn1 c, nn1 d
|
||||
where b.d1 = c.c1 and d.c2 = c.c2 and d.c1 = b.d2;
|
||||
count(*)
|
||||
0
|
||||
select /*+ leading(t2, (t1, t3), t7, (t8, t9), (t4, t5, t6)) */
|
||||
count(*) from nn1 t1, nn1 t2, nn1 t3, nn1 t4, nn1 t5, nn1 t6 , nn1 t7, nn1 t8, nn1 t9
|
||||
where t1.c1 = t2.c1 and t1.c1=t3.c2 and t2.c1 = t3.c1 and t3.c1 = t4.c1 and t4.c1 = t5.c1 and t5.c1 = t6.c1 AND
|
||||
t6.c1 = t7.c1 and t7.c1 = t8.c1 and t8.c1 = t9.c1 and t8.c1 = t2.c1 and t1.c1 = t9.c1
|
||||
and t1.c3 = 'hello11' and t2.c2 < 4 ;
|
||||
count(*)
|
||||
0
|
||||
select /*+ leading(t1,t2,t3,(t4,t5,t6),(t7,t8)) */ count(*),sum(t1.c1+t2.d1+t3.c1+t4.d2-t5.c1+t6.d2-t7.c1-t8.d2)
|
||||
from nn1 t1, nn2 t2, nn1 t3, nn2 t4, nn1 t5 , nn2 t6, nn1 t7, nn2 t8
|
||||
where t1.c1 = t2.d1 and t1.c2 = t3.c1 and
|
||||
t4.d1 = t1.c1 and t5.c1 = t2.d2 and t6.d2 = t3.c1 AND
|
||||
t7.c1 = t2.d1 and t7.c2 = t5.c1 and t8.d1 = t4.d2 and t8.d2 = t6.d2;
|
||||
count(*) sum(t1.c1+t2.d1+t3.c1+t4.d2-t5.c1+t6.d2-t7.c1-t8.d2)
|
||||
0 NULL
|
||||
select /*+ leading(c, (d, (a,b))) */ count(a.c1+b.d2+a.c2) from nn1 a join nn2 b on a.c1 = b.d2
|
||||
join nn1 c on b.d1 = c.c1 join nn1 d on d.c2 = c.c2 where a.c2 < 5 ;
|
||||
count(a.c1+b.d2+a.c2)
|
||||
0
|
||||
select /*+ leading(t2, (t1, (t3 , (t7, (t8, (t9 , (t4, (t5, (t6))))))))) */
|
||||
count(*),sum(t1.c1+t2.c1+t3.c1+t4.c2-t5.c1+t6.c2-t7.c1-t8.c2)+count(t9.c1)
|
||||
from nn1 t1, nn1 t2, nn1 t3, nn1 t4, nn1 t5, nn1 t6 , nn1 t7, nn1 t8, nn1 t9
|
||||
where t1.c1 = t2.c1 and t1.c1=t3.c2 and t2.c1 = t3.c1 and t3.c1 = t4.c1 and t4.c1 = t5.c1 and t5.c1 = t6.c1 AND
|
||||
t6.c1 = t7.c1 and t7.c1 = t8.c1 and t8.c1 = t9.c1 and t8.c1 = t2.c1 and t1.c1 = t9.c1;
|
||||
count(*) sum(t1.c1+t2.c1+t3.c1+t4.c2-t5.c1+t6.c2-t7.c1-t8.c2)+count(t9.c1)
|
||||
0 NULL
|
||||
select /*+ leading(t1, ((t2, t3), t4), (t5, t6)) */ count(t1.c1), count(t2.d1 * t3.c1), sum(t4.d1 + t5.c1)
|
||||
from nn1 t1, nn2 t2, nn1 t3, nn2 t4, nn1 t5, nn2 t6
|
||||
where t1.c1 = t2.d1 and t1.c2 = t3.c1 and t1.c1 + t2.d2 = t4.d1 + t1.c2 and
|
||||
t4.d1 = t5.c1 + t6.d2 and t2.d2 = t5.c1 and t2.d1 = t6.d2 and
|
||||
t1.c1 + t4.d2 = t5.c2 + t6.d2 - 1;
|
||||
count(t1.c1) count(t2.d1 * t3.c1) sum(t4.d1 + t5.c1)
|
||||
0 0 NULL
|
||||
select /*+ leading(t1, ((t2, t3), t4)) */ count(*), sum(t2.d1 * t3.c1 - t4.d2)
|
||||
from nn1 t1, nn2 t2, nn1 t3, nn2 t4
|
||||
where t1.c1 = t2.d1 and t1.c2 = t3.c1 and t1.c1 + t2.d2 = t4.d1 + t1.c2;
|
||||
count(*) sum(t2.d1 * t3.c1 - t4.d2)
|
||||
0 NULL
|
||||
select /*+ leading(t1, (t2, t3)) */ count(*), sum(t2.d1+t3.c2)
|
||||
from nn1 t1, nn2 t2, nn1 t3
|
||||
where t1.c1 = t2.d1 and t1.c2 = t3.c1 and t1.c1 =t3.c1+t2.d2;
|
||||
count(*) sum(t2.d1+t3.c2)
|
||||
0 NULL
|
||||
SELECT count(*), sum(b.d1) from
|
||||
nn1 a, nn2 b, nn1 c
|
||||
WHERE
|
||||
a.c1 = b.d1 and b.d2 = c.c1 and c.c2 in (
|
||||
select
|
||||
/*+ leading(x, ((y, z), x2, (y2,y3))) no_use_hash(y2, y3) */
|
||||
x.c1
|
||||
from nn1 x, nn2 y, nn1 z, nn1 x2, nn1 y2, nn1 y3
|
||||
where x.c2 = y.d2 and y.d1 = z.c2 and y2.c1 = y3.c1
|
||||
);
|
||||
count(*) sum(b.d1)
|
||||
0 NULL
|
||||
select /*+ leading(t6, (t5, t4), (t3, t1), (t2)) */ count(*), sum(t2.c1) from nn1 t1, nn1 t2 , nn1 t3, nn1 t4, nn1 t5, nn1 t6
|
||||
where t1.c1 = t2.c1 and t2.c2 = t3.c1 and t3.c2 = t4.c1 and t4.c2 = t5.c1 and t5.c2 = t6.c1 and t5.c2 <> 44
|
||||
union ALL
|
||||
select /* leading(t2, t1, (t4, t3, (t6, t5))) */ sum(t1.c1), max(t2.c2)+sum(t5.c1-t6.c2) from nn1 t1, nn1 t2 , nn1 t3, nn1 t4, nn1 t5, nn1 t6
|
||||
where t1.c1 = t2.c1 and t2.c2 = t3.c1 and t3.c2 = t4.c1 and t4.c2 = t5.c1 and t5.c2 = t6.c1 and t5.c2 <> 55;
|
||||
count(*) sum(t2.c1)
|
||||
0 NULL
|
||||
NULL NULL
|
||||
select /*+ leading(t9, (t8, t7, (t6, t5), t4), (t3, t1), t2)*/ count(*),sum(t9.c1-t5.c1+t4.d2-t1.c1) from
|
||||
nn1 t1, nn2 t2, nn1 t3, nn2 t4, nn1 t5, nn2 t6, nn1 t7, nn2 t8, nn1 t9
|
||||
where mod(t1.c1, 3) = mod(t2.d2,2) and mod(t1.c1,5) = mod(t3.c1,4) and mod(t1.c2, 7) = mod(t4.d1, 3) AND
|
||||
mod(t1.c2, 5) = mod(t5.c1, 6) and mod(t1.c1, 3) = mod(t6.d2, 2) and mod(t1.c1, 4) = mod(t7.c1,3) AND
|
||||
mod(t1.c1, 7) = mod(t8.d1, 3) and mod(t1.c2, 5) = mod(t9.c1, 4) AND
|
||||
mod(t2.d1,5) = mod(t3.c1,4) and mod(t2.d2, 7) = mod(t4.d1, 3) AND
|
||||
mod(t2.d2, 5) = mod(t5.c1, 6) and mod(t2.d1, 3) = mod(t6.d2, 2) and mod(t2.d1, 4) = mod(t7.c1,3) AND
|
||||
mod(t2.d1, 7) = mod(t8.d1, 3) and mod(t2.d2, 5) = mod(t9.c1, 4) AND
|
||||
mod(t3.c2, 7) = mod(t4.d1, 3) AND
|
||||
mod(t3.c2, 5) = mod(t5.c1, 6) and mod(t3.c1, 3) = mod(t6.d2, 2) and mod(t3.c1, 4) = mod(t7.c1,3) AND
|
||||
mod(t3.c1, 7) = mod(t8.d1, 3) and mod(t3.c2, 5) = mod(t9.c1, 4) AND
|
||||
mod(t4.d2, 5) = mod(t5.c1, 6) and mod(t4.d1, 3) = mod(t6.d2, 2) and mod(t4.d1, 4) = mod(t7.c1,3) AND
|
||||
mod(t4.d1, 7) = mod(t8.d1, 3) and mod(t4.d2, 5) = mod(t9.c1, 4) and
|
||||
mod(t5.c1, 2) = mod(t6.d2, 5) and mod(t5.c1, 4) = mod(t7.c1,1) AND
|
||||
mod(t5.c1, 7) = mod(t8.d1, 6) and mod(t5.c2, 5) = mod(t9.c1, 4) AND
|
||||
mod(t6.d1, 4) = mod(t7.c1,3) AND
|
||||
mod(t6.d1, 7) = mod(t8.d1, 3) and mod(t6.d2, 5) = mod(t9.c1, 4) AND
|
||||
mod(t7.c1, 7) = mod(t8.d1, 3) and mod(t7.c2, 5) = mod(t9.c1, 4) AND
|
||||
mod(t8.d2, 5) = mod(t9.c1, 14) ;
|
||||
count(*) sum(t9.c1-t5.c1+t4.d2-t1.c1)
|
||||
0 NULL
|
||||
select /*+ leading(a (c ,(b, d))) */ count(*),sum(a.c1) from nn1 a, (select * from nn2) b,
|
||||
(select * from nn1 cc group by c1,c2) c, nn2 d
|
||||
where a.c1 = c.c1 and b.d2 = d.d1 and c.c2 = d.d2;
|
||||
count(*) sum(a.c1)
|
||||
0 NULL
|
||||
select /*+ leading(a (c ,(b, d))) */count(*), sum(b.d2) from nn1 a left join nn2 b
|
||||
on a.c1 = b.d1 left join nn1 c on b.d2 = c.c1 left join nn2 d on c.c2 = d.d2
|
||||
where a.c1 = b.d1 and b.d2 = c.c1 and c.c2 = d.d2;
|
||||
count(*) sum(b.d2)
|
||||
0 NULL
|
||||
select (select /*+ leading(a (c ,(b, d))) */ count(x.c2) from nn1 a left join nn2 b
|
||||
on a.c1 = b.d1 left join nn1 c on b.d2 = c.c1 left join nn2 d on c.c2 = d.d2
|
||||
where a.c1 = b.d1 and b.d2 = c.c1 and c.c2 = d.d2 and x.c1 = a.c1 + b.d1 + c.c2 - d.d2 * 5) as x
|
||||
from nn1 x;
|
||||
x
|
||||
NULL
|
||||
select /* leading(t3 (t2 t1)) */ sum(t1.c1) from nn1 t1 , nn1 t2 , nn1 t3 where t2.c2=t1.c2 and t1.c1 =
|
||||
(select /*+ leading(x,(y z)) */ count(*) from nn1 x, nn2 y, nn1 z where x.c1 = y.d1 and y.d2 = z.c1)
|
||||
and t3.c1 in (1,2);
|
||||
sum(t1.c1)
|
||||
NULL
|
||||
select /*+ leading((d, c), b , a) */ count(*), sum(b.d1+d.d2) from nn1 a, nn2 b, nn1 c, nn2 d
|
||||
where a.c1 = b.d1 and c.c2 = d.d1;
|
||||
count(*) sum(b.d1+d.d2)
|
||||
0 NULL
|
||||
select /*+ leading((d, (c), (b)) , (a)) */ count(*),sum(a.c1+b.d2+c.c1+d.d2) from nn1 a, nn2 b, nn1 c, nn2 d
|
||||
where a.c1 = b.d2 and c.c2 = d.d2;
|
||||
count(*) sum(a.c1+b.d2+c.c1+d.d2)
|
||||
0 NULL
|
||||
select /*+ leading(b, (c d)) a) */ count(*), sum(b.d1+d.d2) from nn1 a, nn2 b, nn1 c, nn2 d
|
||||
where a.c1 = b.d1 and c.c2 = d.d1;
|
||||
count(*) sum(b.d1+d.d2)
|
||||
0 NULL
|
||||
select /*+ leading(b1, (c1 d1 ) a1) */ count(*), sum(b.d2+d.d1*c.c1-a.c1) from nn1 a, nn2 b, nn1 c, nn2 d
|
||||
where a.c1 = b.d1 and c.c2 = d.d1;
|
||||
count(*) sum(b.d2+d.d1*c.c1-a.c1)
|
||||
0 NULL
|
||||
select /*+ leading((((t2,t1,t4),t3),t5), (t6),(t7))*/ count(*), sum(t6.c1+t7.c1+t4.c2) from
|
||||
nn1 t1, nn1 t2, nn1 t3, nn1 t4, nn1 t5, nn1 t6, nn1 t7
|
||||
where t1.c1 = t2.c1 and t1.c1=t3.c2 and t2.c1 = t3.c1 and t3.c1 = t4.c1 and t4.c1 = t5.c1 and t5.c1 = t6.c1 AND
|
||||
t6.c1 = t7.c1;
|
||||
count(*) sum(t6.c1+t7.c1+t4.c2)
|
||||
0 NULL
|
||||
select /*+ leading(t4,t6,t5) */ count(*), sum(t2.c2+t3.c1)
|
||||
from nn1 t1 left join nn1 t2 on t1.c1 = t2.c1 left JOIN
|
||||
nn1 t3 on t3.c2 IN(1,23,4,2,5,6) join nn1 t4 on t3.c1=t4.c1 join nn1 t5 on t4.c2=t5.c2
|
||||
join nn1 t6 on t5.c1 = t6.c2 left join nn1 t7 on t1.c1=t7.c1;
|
||||
count(*) sum(t2.c2+t3.c1)
|
||||
0 NULL
|
||||
select /*+ leading(c, (a ,(d, b)) ) */ count(a.c1+b.d2) , sum(b.d2+b.d2*a.c1) from nn1 a join nn2 b on a.c1 = b.d2
|
||||
join nn1 c on b.d1 = c.c1 join nn1 d on d.c2 = c.c2 where a.c2 < 5 and d.c1 = b.d2
|
||||
and d.c2 = a.c1 ;
|
||||
count(a.c1+b.d2) sum(b.d2+b.d2*a.c1)
|
||||
0 NULL
|
||||
create view v1 as select /*+ leading(c, b , a ) use_hash(b a) */ a.c1 as a_c1, a.c2 as a_c2, a.c3 as a_c3, b.d1, b.d2, b.d3, c.c1 as c_c1, c.c2 as c_c2, c.c3 as c_c3 from nn1 a join nn2 b on a.c1 = b.d2 join nn1 c on b.d1 = c.c1 where a.c2 < 5;
|
||||
show create view v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE VIEW `v1` AS select /*+ LEADING(c b a) USE_HASH((b) (a)) */`a`.`c1` AS `a_c1`,`a`.`c2` AS `a_c2`,`a`.`c3` AS `a_c3`,`b`.`d1` AS `d1`,`b`.`d2` AS `d2`,`b`.`d3` AS `d3`,`c`.`c1` AS `c_c1`,`c`.`c2` AS `c_c2`,`c`.`c3` AS `c_c3` from ((`bushy_leading_hint_db`.`nn1` `a` join `bushy_leading_hint_db`.`nn2` `b` on ((`a`.`c1` = `b`.`d2`))) join `bushy_leading_hint_db`.`nn1` `c` on ((`b`.`d1` = `c`.`c1`))) where (`a`.`c2` < 5) utf8mb4 utf8mb4_general_ci
|
||||
create view v2 as select /*+ leading(c, (b , a)) */ a.c1 as a_c1, a.c2 as a_c2, a.c3 as a_c3, b.d1, b.d2, b.d3, c.c1 as c_c1, c.c2 as c_c2, c.c3 as c_c3 from nn1 a join nn2 b on a.c1 = b.d2 join nn1 c on b.d1 = c.c1 where a.c2 < 5 ;
|
||||
show create view v2;
|
||||
View Create View character_set_client collation_connection
|
||||
v2 CREATE VIEW `v2` AS select /*+ LEADING(c (b a)) */`a`.`c1` AS `a_c1`,`a`.`c2` AS `a_c2`,`a`.`c3` AS `a_c3`,`b`.`d1` AS `d1`,`b`.`d2` AS `d2`,`b`.`d3` AS `d3`,`c`.`c1` AS `c_c1`,`c`.`c2` AS `c_c2`,`c`.`c3` AS `c_c3` from ((`bushy_leading_hint_db`.`nn1` `a` join `bushy_leading_hint_db`.`nn2` `b` on ((`a`.`c1` = `b`.`d2`))) join `bushy_leading_hint_db`.`nn1` `c` on ((`b`.`d1` = `c`.`c1`))) where (`a`.`c2` < 5) utf8mb4 utf8mb4_general_ci
|
||||
create view v3 as select /*+ leading(c, (d, (a,b))) */ a.c1 as a_c1, a.c2 as a_c2, a.c3 as a_c3, b.d1, b.d2, b.d3, c.c1 as c_c1, c.c2 as c_c2, c.c3 as c_c3 from nn1 a join nn2 b
|
||||
on a.c1 = b.d2
|
||||
join nn1 c on b.d1 = c.c1 join nn1 d on d.c2 = c.c2 where a.c2 < 5 ;
|
||||
show create view v3;
|
||||
View Create View character_set_client collation_connection
|
||||
v3 CREATE VIEW `v3` AS select /*+ LEADING(c (d (a b))) */`a`.`c1` AS `a_c1`,`a`.`c2` AS `a_c2`,`a`.`c3` AS `a_c3`,`b`.`d1` AS `d1`,`b`.`d2` AS `d2`,`b`.`d3` AS `d3`,`c`.`c1` AS `c_c1`,`c`.`c2` AS `c_c2`,`c`.`c3` AS `c_c3` from (((`bushy_leading_hint_db`.`nn1` `a` join `bushy_leading_hint_db`.`nn2` `b` on ((`a`.`c1` = `b`.`d2`))) join `bushy_leading_hint_db`.`nn1` `c` on ((`b`.`d1` = `c`.`c1`))) join `bushy_leading_hint_db`.`nn1` `d` on ((`d`.`c2` = `c`.`c2`))) where (`a`.`c2` < 5) utf8mb4 utf8mb4_general_ci
|
||||
create view v4 as
|
||||
select /*+ leading(t2, (t1, t3), (t7, (t8, t9)), (t4, t5, t6)) */
|
||||
t1.c1 as x, t3.c2 as y, t5.c2 as z from nn1 t1, nn1 t2, nn1 t3, nn1 t4, nn1 t5, nn1 t6 , nn1 t7, nn1 t8, nn1 t9
|
||||
where t1.c1 = t2.c1 and t1.c1=t3.c2 and t2.c1 = t3.c1 and t3.c1 = t4.c1 and t4.c1 = t5.c1 and t5.c1 = t6.c1 AND
|
||||
t6.c1 = t7.c1 and t7.c1 = t8.c1 and t8.c1 = t9.c1 and t8.c1 = t2.c1 and t1.c1 = t9.c1;
|
||||
show create view v4;
|
||||
View Create View character_set_client collation_connection
|
||||
v4 CREATE VIEW `v4` AS select /*+ LEADING(t2 (t1 t3) (t7 (t8 t9)) (t4 t5 t6)) */`t1`.`c1` AS `x`,`t3`.`c2` AS `y`,`t5`.`c2` AS `z` from `bushy_leading_hint_db`.`nn1` `t1`,`bushy_leading_hint_db`.`nn1` `t2`,`bushy_leading_hint_db`.`nn1` `t3`,`bushy_leading_hint_db`.`nn1` `t4`,`bushy_leading_hint_db`.`nn1` `t5`,`bushy_leading_hint_db`.`nn1` `t6`,`bushy_leading_hint_db`.`nn1` `t7`,`bushy_leading_hint_db`.`nn1` `t8`,`bushy_leading_hint_db`.`nn1` `t9` where (`t1`.`c1` = `t2`.`c1`) and (`t1`.`c1` = `t3`.`c2`) and (`t2`.`c1` = `t3`.`c1`) and (`t3`.`c1` = `t4`.`c1`) and (`t4`.`c1` = `t5`.`c1`) and (`t5`.`c1` = `t6`.`c1`) and (`t6`.`c1` = `t7`.`c1`) and (`t7`.`c1` = `t8`.`c1`) and (`t8`.`c1` = `t9`.`c1`) and (`t8`.`c1` = `t2`.`c1`) and (`t1`.`c1` = `t9`.`c1`) utf8mb4 utf8mb4_general_ci
|
||||
select count(*), sum(x+y-z*4) from v4;
|
||||
count(*) sum(x+y-z*4)
|
||||
0 NULL
|
||||
select /*+ leading(t2, (t1, t3), (t7, (t8, t9))) */
|
||||
count(*)+sum(t1.c1+t4.c2+t5.c1+t5.c2-5*t9.c1) from nn1 t1, nn1 t2, nn1 t3, nn1 t4, nn1 t5, nn1 t6 , nn1 t7, nn1 t8, nn1 t9
|
||||
where t1.c1 = t2.c1 and t1.c1=t3.c2 and t2.c1 = t3.c1 and t3.c1 = t4.c1 and t4.c1 = t5.c1 and t5.c1 = t6.c1 AND
|
||||
t6.c1 = t7.c1 and t7.c1 = t8.c1 and t8.c1 = t9.c1 and t8.c1 = t2.c1 and t1.c1 = t9.c1;
|
||||
count(*)+sum(t1.c1+t4.c2+t5.c1+t5.c2-5*t9.c1)
|
||||
NULL
|
||||
select /*+ leading(t2, t1, t3, (t4, (t5, t6)), (t8, (t9, t7))) */
|
||||
count(*), sum(t1.c1+t5.c1+t6.c1-t7.c1-t8.c2*t9.c1) from nn1 t1, nn1 t2, nn1 t3, nn1 t4, nn1 t5, nn1 t6 , nn1 t7, nn1 t8, nn1 t9
|
||||
where t1.c1 = t2.c1 and t1.c1=t3.c2 and t2.c1 = t3.c1 and t3.c1 >= t4.c1 and t4.c1 = t5.c1 and t5.c1 = t6.c1 AND
|
||||
t6.c1 = t7.c1 and t7.c1 = t8.c2 and t8.c2 = t9.c1 and t8.c1 <= t2.c1 and t1.c1 = t9.c1;
|
||||
count(*) sum(t1.c1+t5.c1+t6.c1-t7.c1-t8.c2*t9.c1)
|
||||
0 NULL
|
||||
select /*+ leading(t2, (t1, t3), (t7, t8, t9), (t4, t5, t6)) */
|
||||
count(*), sum(t1.c1-t7.c2-t8.c1-t9.c2) from nn1 t1, nn1 t2, nn1 t3, nn1 t4, nn1 t5, nn1 t6 , nn1 t7, nn1 t8, nn1 t9
|
||||
where t1.c1 = t2.c1 and t1.c1=t3.c2 and t2.c1 = t3.c1 and t3.c1 = t4.c1 and t4.c1 = t5.c1 and t5.c1 = t6.c1 AND
|
||||
t6.c1 = t7.c1 and t7.c1 = t8.c1 and t8.c1 = t9.c1 and t8.c1 = t2.c1 and t1.c1 = t9.c1;
|
||||
count(*) sum(t1.c1-t7.c2-t8.c1-t9.c2)
|
||||
0 NULL
|
||||
select /*+ leading(t1, (t2 t3), (t4, t5 (t6, t7))) use_hash(t4, t5) use_hash(t6,t7) */
|
||||
count(*), sum(t1.c1-t5.c2+t6.c1) - max(t2.c1*t8.c2) from nn1 t1, nn1 t2, nn1 t3, nn1 t4, nn1 t5, nn1 t6 , nn1 t7, nn1 t8, nn1 t9
|
||||
where t1.c1 = t2.c1 and t1.c1=t3.c2 and t2.c1 = t3.c1 and t3.c1 = t4.c1 and t4.c1 = t5.c1 and t5.c1 = t6.c1 AND
|
||||
t6.c1 = t7.c1 and t7.c1 = t8.c1 and t8.c1 = t9.c1 and t8.c1 = t2.c1 and t1.c1 = t9.c1;
|
||||
count(*) sum(t1.c1-t5.c2+t6.c1) - max(t2.c1*t8.c2)
|
||||
0 NULL
|
||||
select /*+ leading(t2 (t7, t1 (t8, t9))) */
|
||||
count(*) , sum(t1.c1+t5.c1+t8.c2*t9.c1-t3.c1*4) from nn1 t1, nn1 t2, nn1 t3, nn1 t4, nn1 t5, nn1 t6 , nn1 t7, nn1 t8, nn1 t9
|
||||
where t1.c1 = t2.c1 and t1.c1=t3.c2 and t2.c1 = t3.c1 and t3.c1 = t4.c1 and t4.c1 = t5.c1 and t5.c1 = t6.c1 AND
|
||||
t6.c1 = t7.c1 and t7.c1 = t8.c1 and t8.c1 = t9.c1 and t8.c1 = t2.c1 and t1.c1 = t9.c1;
|
||||
count(*) sum(t1.c1+t5.c1+t8.c2*t9.c1-t3.c1*4)
|
||||
0 NULL
|
||||
select /*+ leading(t1,t4,(t2,t3)) */
|
||||
count(*), sum(t1.c1)-sum(t4.c2) from nn1 t1, nn1 t2, nn1 t3, nn1 t4
|
||||
where t1.c1 = t2.c1 and t3.c1 = t4.c1 and t1.c2 = t3.c2;
|
||||
count(*) sum(t1.c1)-sum(t4.c2)
|
||||
0 NULL
|
||||
select /*+ LEADING(@x2x (c d), (a b)) */
|
||||
* from nn1 x
|
||||
where exists (select /*+ qb_name(x2x) */ 1
|
||||
from nn1 a, nn2 b, nn1 c, nn2 d where a.c1 = b.d1
|
||||
and c.c2 = d.d1) order by x.c1 asc, x.c2 asc, x.c3 desc;
|
||||
c1 c2 c3
|
||||
select /*+ LEADING(@x2x (c d), (a b)) */
|
||||
* from nn1 x
|
||||
where exists (select /*+ qb_name(x2x) LEADING(a c b d)*/ 1
|
||||
from nn1 a, nn2 b, nn1 c, nn2 d where a.c1 = b.d1
|
||||
and c.c2 = d.d1) order by x.c1 desc, x.c2 asc, x.c3 desc;
|
||||
c1 c2 c3
|
||||
select /*+ LEADING(@x3x b d (a c)) */
|
||||
* from nn1 x
|
||||
where exists (select /*+ qb_name(x3x) */ 1
|
||||
from nn1 a, nn2 b, nn1 c, nn2 d where a.c1 = b.d1
|
||||
and c.c2 = d.d1) order by x.c1 desc, x.c3 desc, x.c2 asc ;
|
||||
c1 c2 c3
|
||||
select /*+ leading(t1,t2,(t4,t5))*/ count(*),min(t2.c1)+max(t5.d2) from nn1 t1, nn1 t2, nn2 t4, nn2 t5
|
||||
where t1.c1 = t2.c1 and
|
||||
t4.d1 = t5.d1 AND
|
||||
t1.c1 + t2.c1 = t4.d1 + t5.d2 ;
|
||||
count(*) min(t2.c1)+max(t5.d2)
|
||||
0 NULL
|
||||
explain select /*+leading(t1 (t2 t3))*/* from t1,t3 where t1.a = t3.a and t1.b not in (select b from t2);
|
||||
Query Plan
|
||||
=====================================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST |
|
||||
-----------------------------------------------------
|
||||
|0 |HASH JOIN | |960597 |2820926886|
|
||||
|1 | NESTED-LOOP ANTI JOIN| |981 |2820256644|
|
||||
|2 | TABLE SCAN |t1 |100000 |66272 |
|
||||
|3 | MATERIAL | |100000 |80235 |
|
||||
|4 | TABLE SCAN |t2 |100000 |61860 |
|
||||
|5 | TABLE SCAN |t3 |100000 |66272 |
|
||||
=====================================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.a], [t1.b], [t1.c], [t3.a], [t3.b], [t3.c]), filter(nil),
|
||||
equal_conds([t1.a = t3.a]), other_conds(nil)
|
||||
1 - output([t1.a], [t1.b], [t1.c]), filter(nil),
|
||||
conds([(T_OP_OR, t1.b = t2.b, (T_OP_IS, t1.b, NULL, 0), (T_OP_IS, t2.b, NULL, 0))]), nl_params_(nil)
|
||||
2 - output([t1.a], [t1.b], [t1.c]), filter(nil),
|
||||
access([t1.a], [t1.b], [t1.c]), partitions(p0)
|
||||
3 - output([t2.b]), filter(nil)
|
||||
4 - output([t2.b]), filter(nil),
|
||||
access([t2.b]), partitions(p0)
|
||||
5 - output([t3.a], [t3.b], [t3.c]), filter(nil),
|
||||
access([t3.a], [t3.b], [t3.c]), partitions(p0)
|
||||
|
||||
explain select /*+leading(t2 t3 t1)*/* from t1,t3 where t1.a = t3.a and t1.b not in (select b from t2);
|
||||
Query Plan
|
||||
=====================================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST |
|
||||
-----------------------------------------------------
|
||||
|0 |HASH JOIN | |960597 |2820926886|
|
||||
|1 | NESTED-LOOP ANTI JOIN| |981 |2820256644|
|
||||
|2 | TABLE SCAN |t1 |100000 |66272 |
|
||||
|3 | MATERIAL | |100000 |80235 |
|
||||
|4 | TABLE SCAN |t2 |100000 |61860 |
|
||||
|5 | TABLE SCAN |t3 |100000 |66272 |
|
||||
=====================================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.a], [t1.b], [t1.c], [t3.a], [t3.b], [t3.c]), filter(nil),
|
||||
equal_conds([t1.a = t3.a]), other_conds(nil)
|
||||
1 - output([t1.a], [t1.b], [t1.c]), filter(nil),
|
||||
conds([(T_OP_OR, t1.b = t2.b, (T_OP_IS, t1.b, NULL, 0), (T_OP_IS, t2.b, NULL, 0))]), nl_params_(nil)
|
||||
2 - output([t1.a], [t1.b], [t1.c]), filter(nil),
|
||||
access([t1.a], [t1.b], [t1.c]), partitions(p0)
|
||||
3 - output([t2.b]), filter(nil)
|
||||
4 - output([t2.b]), filter(nil),
|
||||
access([t2.b]), partitions(p0)
|
||||
5 - output([t3.a], [t3.b], [t3.c]), filter(nil),
|
||||
access([t3.a], [t3.b], [t3.c]), partitions(p0)
|
||||
|
||||
explain select /*+leading(t3 t1 t2)*/* from t1,t3 where t1.a = t3.a and t1.b not in (select b from t2);
|
||||
Query Plan
|
||||
=======================================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST |
|
||||
-------------------------------------------------------
|
||||
|0 |NESTED-LOOP ANTI JOIN| |960597 |2.764048e+12 |
|
||||
|1 | HASH JOIN | |98010000 |58439627 |
|
||||
|2 | TABLE SCAN |t3 |100000 |66272 |
|
||||
|3 | TABLE SCAN |t1 |100000 |66272 |
|
||||
|4 | MATERIAL | |100000 |80235 |
|
||||
|5 | TABLE SCAN |t2 |100000 |61860 |
|
||||
=======================================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.a], [t1.b], [t1.c], [t3.a], [t3.b], [t3.c]), filter(nil),
|
||||
conds([(T_OP_OR, t1.b = t2.b, (T_OP_IS, t1.b, NULL, 0), (T_OP_IS, t2.b, NULL, 0))]), nl_params_(nil)
|
||||
1 - output([t1.a], [t1.b], [t1.c], [t3.a], [t3.b], [t3.c]), filter(nil),
|
||||
equal_conds([t1.a = t3.a]), other_conds(nil)
|
||||
2 - output([t3.a], [t3.b], [t3.c]), filter(nil),
|
||||
access([t3.a], [t3.b], [t3.c]), partitions(p0)
|
||||
3 - output([t1.a], [t1.b], [t1.c]), filter(nil),
|
||||
access([t1.a], [t1.b], [t1.c]), partitions(p0)
|
||||
4 - output([t2.b]), filter(nil)
|
||||
5 - output([t2.b]), filter(nil),
|
||||
access([t2.b]), partitions(p0)
|
||||
|
||||
explain select /*+leading(t1 t2 t3)*/* from t1,t3 where t1.a = t3.a and t1.b not in (select b from t2);
|
||||
Query Plan
|
||||
=====================================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST |
|
||||
-----------------------------------------------------
|
||||
|0 |HASH JOIN | |960597 |2820926886|
|
||||
|1 | NESTED-LOOP ANTI JOIN| |981 |2820256644|
|
||||
|2 | TABLE SCAN |t1 |100000 |66272 |
|
||||
|3 | MATERIAL | |100000 |80235 |
|
||||
|4 | TABLE SCAN |t2 |100000 |61860 |
|
||||
|5 | TABLE SCAN |t3 |100000 |66272 |
|
||||
=====================================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.a], [t1.b], [t1.c], [t3.a], [t3.b], [t3.c]), filter(nil),
|
||||
equal_conds([t1.a = t3.a]), other_conds(nil)
|
||||
1 - output([t1.a], [t1.b], [t1.c]), filter(nil),
|
||||
conds([(T_OP_OR, t1.b = t2.b, (T_OP_IS, t1.b, NULL, 0), (T_OP_IS, t2.b, NULL, 0))]), nl_params_(nil)
|
||||
2 - output([t1.a], [t1.b], [t1.c]), filter(nil),
|
||||
access([t1.a], [t1.b], [t1.c]), partitions(p0)
|
||||
3 - output([t2.b]), filter(nil)
|
||||
4 - output([t2.b]), filter(nil),
|
||||
access([t2.b]), partitions(p0)
|
||||
5 - output([t3.a], [t3.b], [t3.c]), filter(nil),
|
||||
access([t3.a], [t3.b], [t3.c]), partitions(p0)
|
||||
|
||||
drop table nn1;
|
||||
drop table nn2;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
drop database bushy_leading_hint_db;
|
@ -1,550 +0,0 @@
|
||||
drop database if exists union_sort_opt_db;
|
||||
create database union_sort_opt_db;
|
||||
use union_sort_opt_db;
|
||||
create table t4(c1 int primary key, c2 int, c3 int);
|
||||
insert into t4 values(10,12,3),(4,5,6),(2,13,4),(3,4,25),(7,18,9);
|
||||
commit;
|
||||
create index idx_t4_c2c3 on t4(c2,c3);
|
||||
### 1, 基本测试 表有PK ###
|
||||
select* from (select * from t4 union select * from t4) as x order by 1,2,3;
|
||||
c1 c2 c3
|
||||
2 13 4
|
||||
3 4 25
|
||||
4 5 6
|
||||
7 18 9
|
||||
10 12 3
|
||||
select * from t4 union select * from t4;
|
||||
c1 c2 c3
|
||||
2 13 4
|
||||
3 4 25
|
||||
4 5 6
|
||||
7 18 9
|
||||
10 12 3
|
||||
#1.2 使用索引c2c3也ok
|
||||
select /*+ index(t4 idx_t4_c2c3) */ * from t4 union
|
||||
select /*+ index(t4 idx_t4_c2c3) */ * from t4 order by 1,2,3;
|
||||
c1 c2 c3
|
||||
2 13 4
|
||||
3 4 25
|
||||
4 5 6
|
||||
7 18 9
|
||||
10 12 3
|
||||
#1.3 顺序一致, 原本就支持
|
||||
select /*+ index(t4 idx_t4_c2c3) */ c2,c3 from t4 union
|
||||
select /*+ index(t4 idx_t4_c2c3) */ c2,c3 from t4 order by 2,1;
|
||||
c2 c3
|
||||
12 3
|
||||
13 4
|
||||
5 6
|
||||
18 9
|
||||
4 25
|
||||
#1.4 顺序不一致, 修改后支持, 5
|
||||
select /*+ index(t4 idx_t4_c2c3) */ c3,c2 from t4 union
|
||||
select /*+ index(t4 idx_t4_c2c3) */ c3,c2 from t4 order by 1,2;
|
||||
c3 c2
|
||||
3 12
|
||||
4 13
|
||||
6 5
|
||||
9 18
|
||||
25 4
|
||||
#1.5 完全一致
|
||||
select /*+ index(t4 idx_t4_c2c3) */ c2,c3,c1 from t4 union
|
||||
select /*+ index(t4 idx_t4_c2c3) */ c2,c3,c1 from t4 order by 1,2,3;
|
||||
c2 c3 c1
|
||||
4 25 3
|
||||
5 6 4
|
||||
12 3 10
|
||||
13 4 2
|
||||
18 9 7
|
||||
#1.5.2 左匹配, 原本就支持
|
||||
select /*+ index(t4 idx_t4_c2c3) */ c2 from t4 union
|
||||
select /*+ index(t4 idx_t4_c2c3) */ c2 from t4 order by 1;
|
||||
c2
|
||||
4
|
||||
5
|
||||
12
|
||||
13
|
||||
18
|
||||
#1.5.3 不能优化
|
||||
select /*+ index(t4 idx_t4_c2c3) */ c3 from t4 union
|
||||
select /*+ index(t4 idx_t4_c2c3) */ c3 from t4 order by 1;
|
||||
c3
|
||||
3
|
||||
4
|
||||
6
|
||||
9
|
||||
25
|
||||
#1.5.4 不支持
|
||||
select /*+ index(t4 idx_t4_c2c3) */ c1 from t4 union
|
||||
select /*+ index(t4 idx_t4_c2c3) */ c1 from t4 order by 1;
|
||||
c1
|
||||
2
|
||||
3
|
||||
4
|
||||
7
|
||||
10
|
||||
#1.6 两侧不匹配不能优化, 都加sort 10
|
||||
select /*+ index(x idx_t4_c2c3) */ c3,c1,c2 from t4 x union
|
||||
select /*+ index(y idx_t4_c2c3) */ c3,c2,c1 from t4 y order by 1,2,3;
|
||||
c3 c1 c2
|
||||
3 10 12
|
||||
3 12 10
|
||||
4 2 13
|
||||
4 13 2
|
||||
6 4 5
|
||||
6 5 4
|
||||
9 7 18
|
||||
9 18 7
|
||||
25 3 4
|
||||
25 4 3
|
||||
#1.7 两侧不匹配不能优化, 单侧加sort
|
||||
select /*+ index(t4 idx_t4_c2c3) */ c2,c3,c1 from t4 union
|
||||
select /*+ index(t4 idx_t4_c2c3) */ c3,c2,c1 from t4 order by 1,2,3;
|
||||
c2 c3 c1
|
||||
3 12 10
|
||||
4 13 2
|
||||
4 25 3
|
||||
5 6 4
|
||||
6 5 4
|
||||
9 18 7
|
||||
12 3 10
|
||||
13 4 2
|
||||
18 9 7
|
||||
25 4 3
|
||||
### 2, 不包含PK的简单测试, 单key索引 ###
|
||||
create table t5(c int, c2 int, c3 int);
|
||||
insert into t5 values(1,2,3),(2,3,4),(0,1,2),(3,4,5),(0,2,3),(2,4,5);
|
||||
create index idx_t5_c2 on t5(c2);
|
||||
#2.1 不能优化
|
||||
select /*+ index(t5 idx_t5_c2) */ c2,c3 from t5 union
|
||||
select /*+ index(t5 idx_t5_c2) */ c2,c3 from t5 order by 1,2;
|
||||
c2 c3
|
||||
1 2
|
||||
2 3
|
||||
3 4
|
||||
4 5
|
||||
#2.2 原本就可优化
|
||||
select /*+ index(t5 idx_t5_c2) */ c2 from t5 union
|
||||
select /*+ index(t5 idx_t5_c2) */ c2 from t5 order by 1;
|
||||
c2
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
### 3, 无PK, 数据有重复, 结果正确性验证1
|
||||
create table t6(c1 int, c2 int);
|
||||
create index idx_t6_c1c2 on t6(c1,c2);
|
||||
insert into t6 values(10,20),(10,30),(20,10),(20,5),(10,30),(40,5),(10,8),(10,20),(1,0),(0,1),(20,80),(10,5),(10,5),(30,20),(30,1),(30,5),
|
||||
(10,20),(10,30),(20,10),(20,5),(10,30),(40,5),(10,8),(20,80),(10,5),(10,5),(30,20),(30,1),(1,0),(0,1),(0,0),(30,5);
|
||||
#3.1 可以优化, 14 rows
|
||||
select c1,c2 from t6 union select c1,c2 from t6 order by 1,2;
|
||||
c1 c2
|
||||
0 0
|
||||
0 1
|
||||
1 0
|
||||
10 5
|
||||
10 8
|
||||
10 20
|
||||
10 30
|
||||
20 5
|
||||
20 10
|
||||
20 80
|
||||
30 1
|
||||
30 5
|
||||
30 20
|
||||
40 5
|
||||
#3.2 可以优化, 14 rows
|
||||
select c2,c1 from t6 union select c2,c1 from t6 order by 1,2;
|
||||
c2 c1
|
||||
0 0
|
||||
0 1
|
||||
1 0
|
||||
1 30
|
||||
5 10
|
||||
5 20
|
||||
5 30
|
||||
5 40
|
||||
8 10
|
||||
10 20
|
||||
20 10
|
||||
20 30
|
||||
30 10
|
||||
80 20
|
||||
#3.3 不能优化 23 rows
|
||||
select c2,c1 from t6 union select c1,c2 from t6 order by 1,2;
|
||||
c2 c1
|
||||
0 0
|
||||
0 1
|
||||
1 0
|
||||
1 30
|
||||
5 10
|
||||
5 20
|
||||
5 30
|
||||
5 40
|
||||
8 10
|
||||
10 5
|
||||
10 8
|
||||
10 20
|
||||
10 30
|
||||
20 5
|
||||
20 10
|
||||
20 30
|
||||
20 80
|
||||
30 1
|
||||
30 5
|
||||
30 10
|
||||
30 20
|
||||
40 5
|
||||
80 20
|
||||
#3.4 不能优化, 有计算列的情况, 23 rows, 14
|
||||
select c2,c1 from t6 union select 0+c1,c2 from t6 order by 1,2;
|
||||
c2 c1
|
||||
0 0
|
||||
0 1
|
||||
1 0
|
||||
1 30
|
||||
5 10
|
||||
5 20
|
||||
5 30
|
||||
5 40
|
||||
8 10
|
||||
10 5
|
||||
10 8
|
||||
10 20
|
||||
10 30
|
||||
20 5
|
||||
20 10
|
||||
20 30
|
||||
20 80
|
||||
30 1
|
||||
30 5
|
||||
30 10
|
||||
30 20
|
||||
40 5
|
||||
80 20
|
||||
select c1,c2,c1,c2 from t6 union select 0+c1,c2,c1,c2 from t6 order by 1,2,3,4;
|
||||
c1 c2 c1 c2
|
||||
0 0 0 0
|
||||
0 1 0 1
|
||||
1 0 1 0
|
||||
10 5 10 5
|
||||
10 8 10 8
|
||||
10 20 10 20
|
||||
10 30 10 30
|
||||
20 5 20 5
|
||||
20 10 20 10
|
||||
20 80 20 80
|
||||
30 1 30 1
|
||||
30 5 30 5
|
||||
30 20 30 20
|
||||
40 5 40 5
|
||||
#4 分区表的测试
|
||||
create table t7(c1 varchar(10), c2 decimal(10,2), c3 int, c4 int) partition by hash(c4) partitions 5;
|
||||
insert into t7 values('11', 1.2, 1, 7),('22', 2.3, 2, 6),('33', 3.4, 3, 2), ('44', 4.5, 4, 10), ('55', 5.6, 5, 6),
|
||||
('12', 1.244, 4, 22),('22', 2.3, 3, 13),('3', 3.4, 2, 0), ('44', 4.5, 4, 1), ('56', 56, 1, 6),('44', 4.5, 4, 10);
|
||||
create index idx_t7_c2c1 on t7(c2,c1,c3) local;
|
||||
#4.1 可以优化, 完全匹配, 9 rows
|
||||
select /*+ index(t7 idx_t7_c2c1) */ c2,c1,c3 from t7 union
|
||||
select /*+ index(t7 idx_t7_c2c1) */ c2,c1,c3 from t7 where c2 < 10 order by 1,2,3;
|
||||
c2 c1 c3
|
||||
1.20 11 1
|
||||
1.24 12 4
|
||||
2.30 22 2
|
||||
2.30 22 3
|
||||
3.40 3 2
|
||||
3.40 33 3
|
||||
4.50 44 4
|
||||
5.60 55 5
|
||||
56.00 56 1
|
||||
#4.2 可以优化, 后续有连接, 15 rows
|
||||
select xx.c2,xx.c1 from
|
||||
(select /*+ index(t7 idx_t7_c2c1) */ c2,c1,c3 from t7 union
|
||||
select /*+ index(t7 idx_t7_c2c1) */ c2,c1,c3 from t7 where c2 < 10) xx,
|
||||
t7 yy where xx.c2 = yy.c2 order by 1,2;
|
||||
c2 c1
|
||||
1.20 11
|
||||
1.24 12
|
||||
2.30 22
|
||||
2.30 22
|
||||
2.30 22
|
||||
2.30 22
|
||||
3.40 3
|
||||
3.40 3
|
||||
3.40 33
|
||||
3.40 33
|
||||
4.50 44
|
||||
4.50 44
|
||||
4.50 44
|
||||
5.60 55
|
||||
56.00 56
|
||||
#4.3 可以优化, 9 rows
|
||||
select /*+ index(t7 idx_t7_c2c1) */ c2,c1,c3 from t7 union
|
||||
select /*+ index(t7 idx_t7_c2c1) */ c2,c1,c3 from t7 order by 1,2,3;
|
||||
c2 c1 c3
|
||||
1.20 11 1
|
||||
1.24 12 4
|
||||
2.30 22 2
|
||||
2.30 22 3
|
||||
3.40 3 2
|
||||
3.40 33 3
|
||||
4.50 44 4
|
||||
5.60 55 5
|
||||
56.00 56 1
|
||||
select c1 from t7 union select c1 from t7 order by 1;
|
||||
c1
|
||||
11
|
||||
12
|
||||
22
|
||||
3
|
||||
33
|
||||
44
|
||||
55
|
||||
56
|
||||
select /*+ index(t7 idx_t7_c2c1) */ c1,c2,c3 from t7 union
|
||||
select /*+ index(t7 idx_t7_c2c1) */ c1,c2,c3 from t7 order by 1,2,3;
|
||||
c1 c2 c3
|
||||
11 1.20 1
|
||||
12 1.24 4
|
||||
22 2.30 2
|
||||
22 2.30 3
|
||||
3 3.40 2
|
||||
33 3.40 3
|
||||
44 4.50 4
|
||||
55 5.60 5
|
||||
56 56.00 1
|
||||
#4.4 索引KEY升降序的测试, 目前此功能并不支持, 实际都是ASC
|
||||
drop index idx_t7_c2c1 on t7;
|
||||
create index idx_t7_c3c2c1 on t7(c3 asc,c2 asc,c1 asc) local;
|
||||
create table t72(c1 varchar(10), c2 decimal(10,2), c3 int);
|
||||
insert into t72 values('11', 1.2, 1),('22', 2.3, 2),('33', 3.4, 3), ('44', 4.5, 4), ('55', 5.6, 5),
|
||||
('12', 1.244, 4),('22', 2.3, 3),('3', 3.4, 2), ('44', 4.5, 4), ('56', 56, 1),('44', 4.5, 4);
|
||||
create index idx_t72_c3c2c1 on t72(c3 asc,c2 asc,c1 asc);
|
||||
#4.4.1 两个表上索引升降序一致, 不一一对应但两侧分支匹配, 可以优化, 8 rows
|
||||
select /*+ index(t7 idx_t7_c3c2c1) */ c1,c2,c3 from t7 where c3 < 5 union
|
||||
select /*+ index(t72 idx_t72_c3c2c1) */ c1,c2,c3 from t72 where c3 < 5 order by 1,2,3;
|
||||
c1 c2 c3
|
||||
11 1.20 1
|
||||
12 1.24 4
|
||||
22 2.30 2
|
||||
22 2.30 3
|
||||
3 3.40 2
|
||||
33 3.40 3
|
||||
44 4.50 4
|
||||
56 56.00 1
|
||||
#4.4.2 可以优化, 同上
|
||||
select /*+ index(t7 idx_t7_c3c2c1) */ c3,c2,c1 from t7 where c3 < 5 union
|
||||
select /*+ index(t72 idx_t72_c3c2c1) */ c3,c2,c1 from t72 where c3 < 5 order by 1,2,3;
|
||||
c3 c2 c1
|
||||
1 1.20 11
|
||||
1 56.00 56
|
||||
2 2.30 22
|
||||
2 3.40 3
|
||||
3 2.30 22
|
||||
3 3.40 33
|
||||
4 1.24 12
|
||||
4 4.50 44
|
||||
drop index idx_t72_c3c2c1 on t72;
|
||||
create index idx_t72_c3c2c1 on t72(c3 asc,c2 asc,c1 asc);
|
||||
#4.4.3 A,D不同, 但是实际存储一样, 所以也能优化, 8 rows
|
||||
select /*+ index(t7 idx_t7_c3c2c1) */ c1,c2,c3 from t7 where c3 < 5 union
|
||||
select /*+ index(t72 idx_t72_c3c2c1) */ c1,c2,c3 from t72 where c3 < 5 order by 1,2,3;
|
||||
c1 c2 c3
|
||||
11 1.20 1
|
||||
12 1.24 4
|
||||
22 2.30 2
|
||||
22 2.30 3
|
||||
3 3.40 2
|
||||
33 3.40 3
|
||||
44 4.50 4
|
||||
56 56.00 1
|
||||
#4.4.4 同上, 也能优化
|
||||
select /*+ index(t7 idx_t7_c3c2c1) */ c3,c2,c1 from t7 where c3 < 5 union
|
||||
select /*+ index(t72 idx_t72_c3c2c1) */ c3,c2,c1 from t72 where c3 < 5 order by 1,2,3;
|
||||
c3 c2 c1
|
||||
1 1.20 11
|
||||
1 56.00 56
|
||||
2 2.30 22
|
||||
2 3.40 3
|
||||
3 2.30 22
|
||||
3 3.40 33
|
||||
4 1.24 12
|
||||
4 4.50 44
|
||||
#5 结果正确性测试2
|
||||
create table test1(c1 int, c2 int);
|
||||
create table test2(d1 int, d2 int);
|
||||
insert into test1 values(1,1),(1,2),(2,1),(2,2),(2,0),(1,3),(1,0),(3,0),(3,2),(3,1),(2,1);
|
||||
insert into test2 values(1,1),(1,2),(2,1),(2,2),(2,0),(1,3),(1,0),(3,0),(3,2),(3,1),(2,1);
|
||||
commit;
|
||||
create index idx_test1_c1c2 on test1(c1 asc, c2 asc);
|
||||
create index idx_test2_d1d2 on test2(d1 asc, d2 asc);
|
||||
#5.1 最后加了排序, which can't be optimized...
|
||||
select c2, c1 from test1 union select d2,d1 from test2 order by c2,c1;
|
||||
c2 c1
|
||||
0 1
|
||||
0 2
|
||||
0 3
|
||||
1 1
|
||||
1 2
|
||||
1 3
|
||||
2 1
|
||||
2 2
|
||||
2 3
|
||||
3 1
|
||||
#5.2 最后的排序可以被优化
|
||||
select c2, c1 from test1 union select d2,d1 from test2 order by c1,c2;
|
||||
c2 c1
|
||||
0 1
|
||||
1 1
|
||||
2 1
|
||||
3 1
|
||||
0 2
|
||||
1 2
|
||||
2 2
|
||||
0 3
|
||||
1 3
|
||||
2 3
|
||||
#5.3 最后的排序由于是逆序不能被优化掉
|
||||
select c2, c1 from test1 union select d2,d1 from test2 order by c1 desc,c2 desc;
|
||||
c2 c1
|
||||
2 3
|
||||
1 3
|
||||
0 3
|
||||
2 2
|
||||
1 2
|
||||
0 2
|
||||
3 1
|
||||
2 1
|
||||
1 1
|
||||
0 1
|
||||
#5.4 整数的查询项, 6 rows, 10, 4 rows
|
||||
select 1, c1 from test1 union select 2,d1 from test2 order by 1,2;
|
||||
1 c1
|
||||
1 1
|
||||
1 2
|
||||
1 3
|
||||
2 1
|
||||
2 2
|
||||
2 3
|
||||
select 1, c2 from test1 union select d1,d2 from test2 order by 1,2;
|
||||
1 c2
|
||||
1 0
|
||||
1 1
|
||||
1 2
|
||||
1 3
|
||||
2 0
|
||||
2 1
|
||||
2 2
|
||||
3 0
|
||||
3 1
|
||||
3 2
|
||||
select mod(c1,2),mod(c2,2) from test1 union select mod(d1,2),mod(d2,2) from test2 order by 1,2;
|
||||
mod(c1,2) mod(c2,2)
|
||||
0 0
|
||||
0 1
|
||||
1 0
|
||||
1 1
|
||||
#6 from mysqltest union1, simply recreate
|
||||
create table x1(c1 int, c2 char(10), c3 int);
|
||||
create table x2(d1 int, d2 char(10), d3 int, index ix2(d2, d3));
|
||||
insert into x1 values(1,'xx2',3),(2,'xxx3',4),(3,'aaa4',5);
|
||||
insert into x2 values(11,'xx2',3),(2,'xx3',4),(3,'aaa4',5);
|
||||
select c2, c3 from x1 union select /*+ index(x2 ix2) */ d2, d3 from x2 order by 1,2;
|
||||
c2 c3
|
||||
aaa4 5
|
||||
xx2 3
|
||||
xx3 4
|
||||
xxx3 4
|
||||
select c3, c2 from x1 union select /*+ index(x2 ix2) */ d3, d2 from x2 order by 1,2;
|
||||
c3 c2
|
||||
3 xx2
|
||||
4 xx3
|
||||
4 xxx3
|
||||
5 aaa4
|
||||
CREATE TABLE ts1 (c1 VARCHAR(10) NOT NULL, c2 INT NOT NULL);
|
||||
CREATE TABLE ts2 (c1 VARCHAR(10) NOT NULL, c2 INT NOT NULL);
|
||||
INSERT INTO ts1 (c1, c2) VALUES ('t1a', 1), ('t1a', 2), ('t1a', 3), ('t1b', 2), ('t1b', 1);
|
||||
INSERT INTO ts2 (c1, c2) VALUES ('t2a', 1), ('t2a', 2), ('t2a', 3), ('t2b', 2), ('t2b', 1);
|
||||
SELECT c1, c2 FROM (
|
||||
SELECT c1, c2 FROM ts1
|
||||
UNION
|
||||
(SELECT c1, c2 FROM ts2 ORDER BY c2 DESC, c1 LIMIT 1)
|
||||
) AS res order by 1,2;
|
||||
c1 c2
|
||||
t1a 1
|
||||
t1a 2
|
||||
t1a 3
|
||||
t1b 1
|
||||
t1b 2
|
||||
t2a 3
|
||||
DROP TABLE IF EXISTS T1, T2, T3;
|
||||
CREATE TABLE T1 (PK INT PRIMARY KEY, C1 INT, C2 INT);
|
||||
CREATE TABLE T2 (PK INT PRIMARY KEY, C1 INT, C2 INT);
|
||||
CREATE TABLE T3 (PK INT PRIMARY KEY, C1 INT, C2 INT);
|
||||
SELECT C1, C2, PK FROM T1 ORDER BY PK DESC LIMIT 1 UNION (SELECT C1, C2, PK FROM T2 UNION SELECT C1, C2 ,PK FROM T3);
|
||||
C1 C2 PK
|
||||
5 4 2
|
||||
1 1 1
|
||||
1 1 2
|
||||
CREATE TABLE table2_bigint (
|
||||
col_decimal_20_0_signed decimal(20,0) signed,
|
||||
col_decimal_20_0_unsigned decimal(20,0) unsigned,
|
||||
col_char_20 char(20),
|
||||
col_decimal_20_0 decimal(20,0),
|
||||
pk bigint,
|
||||
col_bigint bigint,
|
||||
col_timestamp_6 timestamp(6) NULL DEFAULT NULL,
|
||||
col_bigint_unsigned bigint unsigned,
|
||||
col_bigint_signed bigint signed,
|
||||
primary key (pk));
|
||||
CREATE TABLE table100_bigint (
|
||||
col_bigint_unsigned bigint unsigned,
|
||||
col_decimal_20_0_unsigned decimal(20,0) unsigned,
|
||||
col_bigint_signed bigint signed,
|
||||
col_bigint bigint,
|
||||
pk bigint,
|
||||
col_decimal_20_0_signed decimal(20,0) signed,
|
||||
col_timestamp_6 timestamp(6) NULL DEFAULT NULL,
|
||||
col_char_20 char(20),
|
||||
col_decimal_20_0 decimal(20,0),
|
||||
/*Indices*/
|
||||
primary key (pk)) ;
|
||||
SELECT col_bigint, col_bigint_signed, col_bigint_unsigned, col_char_20, col_decimal_20_0, col_decimal_20_0_signed, col_decimal_20_0_unsigned, col_timestamp_6, pk
|
||||
FROM
|
||||
(
|
||||
(SELECT col_bigint, col_bigint_signed, col_bigint_unsigned, col_char_20, col_decimal_20_0, col_decimal_20_0_signed, col_decimal_20_0_unsigned, col_timestamp_6, pk
|
||||
FROM table2_bigint
|
||||
WHERE col_decimal_20_0_unsigned <> 99999
|
||||
ORDER BY pk DESC , 6 DESC , pk
|
||||
LIMIT 1,
|
||||
5)
|
||||
UNION DISTINCT SELECT col_bigint, col_bigint_signed, col_bigint_unsigned, col_char_20, col_decimal_20_0, col_decimal_20_0_signed, col_decimal_20_0_unsigned, col_timestamp_6, pk
|
||||
FROM (
|
||||
(SELECT col_bigint, col_bigint_signed, col_bigint_unsigned, col_char_20, col_decimal_20_0, col_decimal_20_0_signed, col_decimal_20_0_unsigned, col_timestamp_6, pk
|
||||
FROM table100_bigint
|
||||
WHERE col_decimal_20_0_signed = ROUND(SIGN(col_decimal_20_0))
|
||||
ORDER BY col_bigint_signed , 6 , col_decimal_20_0 , pk DESC LIMIT 7)
|
||||
UNION DISTINCT
|
||||
(SELECT col_bigint, col_bigint_signed, col_bigint_unsigned, col_char_20, col_decimal_20_0, col_decimal_20_0_signed, col_decimal_20_0_unsigned, col_timestamp_6, pk
|
||||
FROM table2_bigint
|
||||
WHERE SUBSTR('g', 1, LEAST(58, 20)) <> INSERT('lgeswk', 99, 8, TRIM(SUBSTRING(CONVERT(TRIM(SUBSTR(TRIM(SUBSTR(SUBSTRING('nlge', 1, LEAST(58, 20)), 1, 2)
|
||||
FROM SUBSTRING('', 1, LEAST(58, 20))), 1, LEAST(58, 20))), CHAR(50)), 1, LEAST(58, 20))))
|
||||
ORDER BY 3 ,
|
||||
col_bigint_unsigned ,
|
||||
pk DESC)) TUT
|
||||
ORDER BY col_bigint,
|
||||
col_bigint_signed,
|
||||
col_bigint_unsigned,
|
||||
col_char_20,
|
||||
col_decimal_20_0,
|
||||
col_decimal_20_0_signed,
|
||||
col_decimal_20_0_unsigned,
|
||||
col_timestamp_6,
|
||||
pk) TUT WHERE pk in (9727744 ,7826688 ,1657856 , 55039 , 50631)
|
||||
ORDER BY col_bigint, col_bigint_signed, col_bigint_unsigned, col_char_20, col_decimal_20_0, col_decimal_20_0_signed, col_decimal_20_0_unsigned, col_timestamp_6, pk;
|
||||
col_bigint col_bigint_signed col_bigint_unsigned col_char_20 col_decimal_20_0 col_decimal_20_0_signed col_decimal_20_0_unsigned col_timestamp_6 pk
|
||||
NULL NULL NULL NULL NULL NULL 0 NULL 7826688
|
||||
NULL NULL NULL NULL NULL NULL 1 NULL 1657856
|
||||
NULL NULL NULL NULL NULL NULL 11753728 NULL 9727744
|
||||
NULL NULL NULL 0 NULL NULL 999999999 NULL 50631
|
||||
NULL NULL NULL nf NULL NULL 22222222 NULL 55039
|
||||
drop database union_sort_opt_db;
|
Binary file not shown.
@ -1,106 +0,0 @@
|
||||
set ob_query_timeout=1000000000;
|
||||
--disable_warnings
|
||||
drop database if exists px_test;
|
||||
--enable_warnings
|
||||
create database px_test;
|
||||
use px_test;
|
||||
|
||||
# 场景:一个年级 6 个班,修了2门课,英语和数学
|
||||
|
||||
create table stu (
|
||||
sid int,
|
||||
name varchar(32),
|
||||
cls int,
|
||||
primary key (cls, sid)
|
||||
) partition by hash(sid) partitions 6;
|
||||
|
||||
create table teacher (
|
||||
tid int,
|
||||
name varchar(32),
|
||||
subject varchar(4),
|
||||
primary key (tid)
|
||||
) partition by hash(tid) partitions 8;
|
||||
|
||||
create table score (
|
||||
sid int,
|
||||
subject varchar(4),
|
||||
score int,
|
||||
primary key (sid, subject)
|
||||
) partition by hash(sid) partitions 6;
|
||||
|
||||
insert into stu values
|
||||
(11, 'a1', 1),
|
||||
(12, 'b1', 1),
|
||||
(13, 'c1', 1),
|
||||
|
||||
(21, 'a2', 2),
|
||||
(22, 'b2', 2),
|
||||
|
||||
(31, 'a3', 3),
|
||||
|
||||
(41, 'a4', 4),
|
||||
(42, 'b4', 4),
|
||||
|
||||
(51, 'a5', 5),
|
||||
(52, 'b5', 5),
|
||||
|
||||
(61, 'a6', 6),
|
||||
(62, 'b6', 6),
|
||||
(63, 'c6', 6),
|
||||
(64, 'd6', 6);
|
||||
|
||||
insert into teacher values
|
||||
(1, 'Miss Zhang', 'EN'),
|
||||
(2, 'Mr Wang', 'MA');
|
||||
|
||||
|
||||
insert into score values
|
||||
(11, 'EN', 60),
|
||||
(12, 'EN', 70),
|
||||
(13, 'EN', 80),
|
||||
|
||||
(21, 'EN', 58),
|
||||
(22, 'EN', 90),
|
||||
|
||||
(31, 'EN', 80),
|
||||
|
||||
(41, 'EN', 80),
|
||||
(42, 'EN', 90),
|
||||
|
||||
(51, 'EN', 89),
|
||||
(52, 'EN', 99),
|
||||
|
||||
(61, 'EN', 100),
|
||||
(62, 'EN', 90),
|
||||
(63, 'EN', 99),
|
||||
(64, 'EN', 87);
|
||||
|
||||
|
||||
insert into score values
|
||||
(11, 'MA', 60),
|
||||
(12, 'MA', 70),
|
||||
(13, 'MA', 80),
|
||||
|
||||
(21, 'MA', 58),
|
||||
(22, 'MA', 90),
|
||||
|
||||
(31, 'MA', 80),
|
||||
|
||||
(41, 'MA', 80),
|
||||
(42, 'MA', 90),
|
||||
|
||||
(51, 'MA', 89),
|
||||
(52, 'MA', 99),
|
||||
|
||||
(61, 'MA', 100),
|
||||
(62, 'MA', 90),
|
||||
(63, 'MA', 99),
|
||||
(64, 'MA', 87);
|
||||
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
select * from stu;
|
||||
select * from teacher;
|
||||
select * from score;
|
||||
--enable_query_log
|
||||
--enable_result_log
|
@ -1,98 +0,0 @@
|
||||
set ob_query_timeout=1000000000;
|
||||
drop database if exists px_test;
|
||||
create database px_test;
|
||||
use px_test;
|
||||
create table stu (
|
||||
sid int,
|
||||
name varchar(32),
|
||||
cls int,
|
||||
primary key (cls, sid)
|
||||
) partition by hash(sid) partitions 6;
|
||||
create table teacher (
|
||||
tid int,
|
||||
name varchar(32),
|
||||
subject varchar(4),
|
||||
primary key (tid)
|
||||
) partition by hash(tid) partitions 8;
|
||||
create table score (
|
||||
sid int,
|
||||
subject varchar(4),
|
||||
score int,
|
||||
primary key (sid, subject)
|
||||
) partition by hash(sid) partitions 6;
|
||||
insert into stu values
|
||||
(11, 'a1', 1),
|
||||
(12, 'b1', 1),
|
||||
(13, 'c1', 1),
|
||||
(21, 'a2', 2),
|
||||
(22, 'b2', 2),
|
||||
(31, 'a3', 3),
|
||||
(41, 'a4', 4),
|
||||
(42, 'b4', 4),
|
||||
(51, 'a5', 5),
|
||||
(52, 'b5', 5),
|
||||
(61, 'a6', 6),
|
||||
(62, 'b6', 6),
|
||||
(63, 'c6', 6),
|
||||
(64, 'd6', 6);
|
||||
insert into teacher values
|
||||
(1, 'Miss Zhang', 'EN'),
|
||||
(2, 'Mr Wang', 'MA');
|
||||
insert into score values
|
||||
(11, 'EN', 60),
|
||||
(12, 'EN', 70),
|
||||
(13, 'EN', 80),
|
||||
(21, 'EN', 58),
|
||||
(22, 'EN', 90),
|
||||
(31, 'EN', 80),
|
||||
(41, 'EN', 80),
|
||||
(42, 'EN', 90),
|
||||
(51, 'EN', 89),
|
||||
(52, 'EN', 99),
|
||||
(61, 'EN', 100),
|
||||
(62, 'EN', 90),
|
||||
(63, 'EN', 99),
|
||||
(64, 'EN', 87);
|
||||
insert into score values
|
||||
(11, 'MA', 60),
|
||||
(12, 'MA', 70),
|
||||
(13, 'MA', 80),
|
||||
(21, 'MA', 58),
|
||||
(22, 'MA', 90),
|
||||
(31, 'MA', 80),
|
||||
(41, 'MA', 80),
|
||||
(42, 'MA', 90),
|
||||
(51, 'MA', 89),
|
||||
(52, 'MA', 99),
|
||||
(61, 'MA', 100),
|
||||
(62, 'MA', 90),
|
||||
(63, 'MA', 99),
|
||||
(64, 'MA', 87);
|
||||
connect obsys,$OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection obsys;
|
||||
alter system set enable_sql_audit = true;
|
||||
alter system flush sql audit global;
|
||||
disconnect obsys;
|
||||
connection default;
|
||||
select /*+ TEST_SQL_AUDIT USE_PX parallel(2) */ * from teacher;
|
||||
select /*+ TEST_SQL_AUDIT USE_PX parallel(3) */ * from teacher;
|
||||
select /*+ TEST_SQL_AUDIT USE_PX parallel(4) */ * from teacher;
|
||||
select /*+ TEST_SQL_AUDIT USE_PX parallel(2) */ subject, avg(score), max(score), min(score) from score group by subject;
|
||||
select /*+ TEST_SQL_AUDIT USE_PX parallel(2) */ cls, subject, avg(score), max(score), min(score) from score join stu using (sid) group by cls, subject;
|
||||
select /*+ TEST_SQL_AUDIT USE_PX parallel(2) */ count(*) from score join stu using (sid) inner join teacher where score.subject = teacher.subject;
|
||||
select /*+ TEST_SQL_AUDIT USE_PX parallel(3) */ subject, avg(score), max(score), min(score) from score group by subject;
|
||||
select /*+ TEST_SQL_AUDIT USE_PX parallel(3) */ cls, subject, avg(score), max(score), min(score) from score join stu using (sid) group by cls, subject;
|
||||
select /*+ TEST_SQL_AUDIT USE_PX parallel(3) */ count(*) from score join stu using (sid) inner join teacher where score.subject = teacher.subject;
|
||||
connect obsys,$OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection obsys;
|
||||
select query_sql, EXPECTED_WORKER_COUNT, USED_WORKER_COUNT from oceanbase.gv$sql_audit where EXPECTED_WORKER_COUNT > 0 AND query_sql like '%TEST_SQL_AUDIT%' order by request_time desc limit 10;
|
||||
query_sql EXPECTED_WORKER_COUNT USED_WORKER_COUNT
|
||||
select /*+ TEST_SQL_AUDIT USE_PX parallel(2) */ * from teacher 2 2
|
||||
select /*+ TEST_SQL_AUDIT USE_PX parallel(2) */ cls, subject, avg(score), max(score), min(score) from score join stu using (sid) group by cls, subject 4 4
|
||||
select /*+ TEST_SQL_AUDIT USE_PX parallel(2) */ count(*) from score join stu using (sid) inner join teacher where score.subject = teacher.subject 4 4
|
||||
select /*+ TEST_SQL_AUDIT USE_PX parallel(2) */ subject, avg(score), max(score), min(score) from score group by subject 4 4
|
||||
select /*+ TEST_SQL_AUDIT USE_PX parallel(3) */ * from teacher 3 3
|
||||
select /*+ TEST_SQL_AUDIT USE_PX parallel(3) */ cls, subject, avg(score), max(score), min(score) from score join stu using (sid) group by cls, subject 6 6
|
||||
select /*+ TEST_SQL_AUDIT USE_PX parallel(3) */ count(*) from score join stu using (sid) inner join teacher where score.subject = teacher.subject 6 6
|
||||
select /*+ TEST_SQL_AUDIT USE_PX parallel(3) */ subject, avg(score), max(score), min(score) from score group by subject 6 6
|
||||
select /*+ TEST_SQL_AUDIT USE_PX parallel(4) */ * from teacher 4 4
|
@ -1,261 +0,0 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
drop database if exists shaoge;
|
||||
drop table if exists t1;
|
||||
create database shaoge;
|
||||
use shaoge;
|
||||
create table t1(col_float float, col_char char(100), col_text text);
|
||||
insert into t1 values (1.1, '1.1', '1.1');
|
||||
insert into t1 values (1.9, '1.9', '1.9');
|
||||
insert into t1 values (2.1, '2.1', '2.1');
|
||||
insert into t1 values (2.9, '2.9', '2.9');
|
||||
insert into t1 values (9223372036854775807, '9223372036854775807', '9223372036854775807');
|
||||
insert into t1 values (9223372036854775807.5, '9223372036854775807.5', '9223372036854775807.5');
|
||||
insert into t1 values (9223372036854775806.5, '9223372036854775806.5', '9223372036854775806.5');
|
||||
insert into t1 values (null, '1234567890123456789012345678901234567890.5', '1234567890123456789012345678901234567890.5');
|
||||
insert into t1 values (-1.1, '-1.1', '-1.1');
|
||||
insert into t1 values (-1.9, '-1.9', '-1.9');
|
||||
insert into t1 values (-2.1, '-2.1', '-2.1');
|
||||
insert into t1 values (-2.9, '-2.9', '-2.9');
|
||||
insert into t1 values (-9223372036854775807, '-9223372036854775808', '-9223372036854775808');
|
||||
insert into t1 values (-9223372036854775807.5, '-9223372036854775807.5', '-9223372036854775807.5');
|
||||
insert into t1 values (-9223372036854775806.5, '-9223372036854775806.5', '-9223372036854775806.5');
|
||||
insert into t1 values (null, '-1234567890123456789012345678901234567890.5', '-1234567890123456789012345678901234567890.5');
|
||||
create table tbl_check_zerofill(col_zf int(3) zerofill, col_no_zf int(3));
|
||||
insert into tbl_check_zerofill values(1, 1);
|
||||
// sql engine 3.0 test
|
||||
// string->int/uint will trunc
|
||||
// otherwise will round
|
||||
select col_float, cast(col_float as signed) from t1;
|
||||
col_float cast(col_float as signed)
|
||||
1.1 1
|
||||
1.9 2
|
||||
2.1 2
|
||||
2.9 3
|
||||
9.22337e18 -9223372036854775808
|
||||
9.22337e18 -9223372036854775808
|
||||
9.22337e18 -9223372036854775808
|
||||
NULL NULL
|
||||
-1.1 -1
|
||||
-1.9 -2
|
||||
-2.1 -2
|
||||
-2.9 -3
|
||||
-9.22337e18 -9223372036854775808
|
||||
-9.22337e18 -9223372036854775808
|
||||
-9.22337e18 -9223372036854775808
|
||||
NULL NULL
|
||||
select col_char, cast(col_char as signed) from t1;
|
||||
col_char cast(col_char as signed)
|
||||
1.1 1
|
||||
1.9 1
|
||||
2.1 2
|
||||
2.9 2
|
||||
9223372036854775807 9223372036854775807
|
||||
9223372036854775807.5 9223372036854775807
|
||||
9223372036854775806.5 9223372036854775806
|
||||
1234567890123456789012345678901234567890.5 9223372036854775807
|
||||
-1.1 -1
|
||||
-1.9 -1
|
||||
-2.1 -2
|
||||
-2.9 -2
|
||||
-9223372036854775808 -9223372036854775808
|
||||
-9223372036854775807.5 -9223372036854775807
|
||||
-9223372036854775806.5 -9223372036854775806
|
||||
-1234567890123456789012345678901234567890.5 -9223372036854775808
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: '1.1'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '1.9'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '2.1'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '2.9'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '9223372036854775807.5'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '9223372036854775806.5'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-1.1'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-1.9'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-2.1'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-2.9'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-9223372036854775807.5'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-9223372036854775806.5'
|
||||
select col_text, cast(col_text as signed) from t1;
|
||||
col_text cast(col_text as signed)
|
||||
1.1 1
|
||||
1.9 1
|
||||
2.1 2
|
||||
2.9 2
|
||||
9223372036854775807 9223372036854775807
|
||||
9223372036854775807.5 9223372036854775807
|
||||
9223372036854775806.5 9223372036854775806
|
||||
1234567890123456789012345678901234567890.5 9223372036854775807
|
||||
-1.1 -1
|
||||
-1.9 -1
|
||||
-2.1 -2
|
||||
-2.9 -2
|
||||
-9223372036854775808 -9223372036854775808
|
||||
-9223372036854775807.5 -9223372036854775807
|
||||
-9223372036854775806.5 -9223372036854775806
|
||||
-1234567890123456789012345678901234567890.5 -9223372036854775808
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: '1.1'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '1.9'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '2.1'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '2.9'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '9223372036854775807.5'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '9223372036854775806.5'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-1.1'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-1.9'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-2.1'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-2.9'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-9223372036854775807.5'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-9223372036854775806.5'
|
||||
select col_float, cast(col_float as unsigned) from t1;
|
||||
col_float cast(col_float as unsigned)
|
||||
1.1 1
|
||||
1.9 2
|
||||
2.1 2
|
||||
2.9 3
|
||||
9.22337e18 9223372036854775808
|
||||
9.22337e18 9223372036854775808
|
||||
9.22337e18 9223372036854775808
|
||||
NULL NULL
|
||||
-1.1 18446744073709551615
|
||||
-1.9 18446744073709551614
|
||||
-2.1 18446744073709551614
|
||||
-2.9 18446744073709551613
|
||||
-9.22337e18 9223372036854775808
|
||||
-9.22337e18 9223372036854775808
|
||||
-9.22337e18 9223372036854775808
|
||||
NULL NULL
|
||||
select col_char, cast(col_char as unsigned) from t1;
|
||||
col_char cast(col_char as unsigned)
|
||||
1.1 1
|
||||
1.9 1
|
||||
2.1 2
|
||||
2.9 2
|
||||
9223372036854775807 9223372036854775807
|
||||
9223372036854775807.5 9223372036854775807
|
||||
9223372036854775806.5 9223372036854775806
|
||||
1234567890123456789012345678901234567890.5 18446744073709551615
|
||||
-1.1 18446744073709551615
|
||||
-1.9 18446744073709551615
|
||||
-2.1 18446744073709551614
|
||||
-2.9 18446744073709551614
|
||||
-9223372036854775808 9223372036854775808
|
||||
-9223372036854775807.5 9223372036854775809
|
||||
-9223372036854775806.5 9223372036854775810
|
||||
-1234567890123456789012345678901234567890.5 18446744073709551615
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: '1.1'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '1.9'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '2.1'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '2.9'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '9223372036854775807.5'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '9223372036854775806.5'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '1234567890123456789012345678901234567890.5'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-1.1'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-1.9'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-2.1'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-2.9'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-9223372036854775807.5'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-9223372036854775806.5'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-1234567890123456789012345678901234567890.5'
|
||||
select col_text, cast(col_text as unsigned) from t1;
|
||||
col_text cast(col_text as unsigned)
|
||||
1.1 1
|
||||
1.9 1
|
||||
2.1 2
|
||||
2.9 2
|
||||
9223372036854775807 9223372036854775807
|
||||
9223372036854775807.5 9223372036854775807
|
||||
9223372036854775806.5 9223372036854775806
|
||||
1234567890123456789012345678901234567890.5 18446744073709551615
|
||||
-1.1 18446744073709551615
|
||||
-1.9 18446744073709551615
|
||||
-2.1 18446744073709551614
|
||||
-2.9 18446744073709551614
|
||||
-9223372036854775808 9223372036854775808
|
||||
-9223372036854775807.5 9223372036854775809
|
||||
-9223372036854775806.5 9223372036854775810
|
||||
-1234567890123456789012345678901234567890.5 18446744073709551615
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: '1.1'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '1.9'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '2.1'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '2.9'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '9223372036854775807.5'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '9223372036854775806.5'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '1234567890123456789012345678901234567890.5'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-1.1'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-1.9'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-2.1'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-2.9'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-9223372036854775807.5'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-9223372036854775806.5'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-1234567890123456789012345678901234567890.5'
|
||||
// 测试zerofill
|
||||
// 应该有warning: Truncated incorrect CHAR(1) value: '001'
|
||||
select cast(col_zf as char(1)) from tbl_check_zerofill;
|
||||
cast(col_zf as char(1))
|
||||
0
|
||||
select cast(col_zf as char(2)) from tbl_check_zerofill;
|
||||
cast(col_zf as char(2))
|
||||
00
|
||||
select cast(col_zf as char(3)) from tbl_check_zerofill;
|
||||
cast(col_zf as char(3))
|
||||
001
|
||||
select cast(col_zf as char(4)) from tbl_check_zerofill;
|
||||
cast(col_zf as char(4))
|
||||
001
|
||||
select cast(col_no_zf as char(1)) from tbl_check_zerofill;
|
||||
cast(col_no_zf as char(1))
|
||||
1
|
||||
select cast(col_no_zf as char(1)) from tbl_check_zerofill;
|
||||
cast(col_no_zf as char(1))
|
||||
1
|
||||
select cast(col_no_zf as char(2)) from tbl_check_zerofill;
|
||||
cast(col_no_zf as char(2))
|
||||
1
|
||||
select cast(col_no_zf as char(3)) from tbl_check_zerofill;
|
||||
cast(col_no_zf as char(3))
|
||||
1
|
||||
select cast(col_no_zf as char(4)) from tbl_check_zerofill;
|
||||
cast(col_no_zf as char(4))
|
||||
1
|
||||
drop table t1;
|
||||
create table t1(c1 varchar(3));
|
||||
insert into t1 values('abc');
|
||||
select cast(c1 as char(10)), concat(c1, '123') from t1;
|
||||
cast(c1 as char(10)) concat(c1, '123')
|
||||
abc abc123
|
||||
select cast(c1 as char(1)), concat(c1, '123') from t1;
|
||||
cast(c1 as char(1)) concat(c1, '123')
|
||||
a abc123
|
||||
select concat(cast(c1 as char(10)), '123') from t1;
|
||||
concat(cast(c1 as char(10)), '123')
|
||||
abc123
|
||||
select concat(cast(c1 as char(1)), '123') from t1;
|
||||
concat(cast(c1 as char(1)), '123')
|
||||
a123
|
||||
drop table t1;
|
||||
create table t1(c1 decimal(10, 3));
|
||||
insert into t1 values(1.123);
|
||||
select cast(c1 as decimal(10,1)), concat(c1, 'abc') from t1;
|
||||
cast(c1 as decimal(10,1)) concat(c1, 'abc')
|
||||
1.1 1.123abc
|
||||
select c1, cast(c1 as binary(10)), hex(cast(c1 as binary(10))) from t1;
|
||||
c1 cast(c1 as binary(10)) hex(cast(c1 as binary(10)))
|
||||
1.123 1.123 312E3132330000000000
|
||||
drop table t1;
|
||||
create table t1(c1 time(6));
|
||||
insert into t1 values('11:11:11.123456');
|
||||
select cast(c1 as time), concat(c1, 'abc') from t1;
|
||||
cast(c1 as time) concat(c1, 'abc')
|
||||
11:11:11 11:11:11.123456abc
|
||||
drop table t1;
|
||||
create table t1(c1 bigint unsigned);
|
||||
insert into t1 values(18446744073709551615);
|
||||
select cast(c1 as signed) from t1;
|
||||
cast(c1 as signed)
|
||||
-1
|
||||
select c1, cast(c1 as binary(30)), hex(cast(c1 as binary(30))) from t1;
|
||||
c1 cast(c1 as binary(30)) hex(cast(c1 as binary(30)))
|
||||
18446744073709551615 18446744073709551615 313834343637343430373337303935353136313500000000000000000000
|
||||
drop table t1;
|
@ -1,314 +0,0 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,oceanbase,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
set ob_enable_plan_cache = 0;
|
||||
drop table if exists t1;
|
||||
create table t1(col_int int,
|
||||
col_zero int,
|
||||
col_null int,
|
||||
col_varchar varchar(100),
|
||||
col_varchar_num varchar(100),
|
||||
col_empty_str varchar(100),
|
||||
col_varchar_zero varchar(100));
|
||||
insert into t1 values(1, 0, null, 'abc', '1', '', '0');
|
||||
// Case1: normal test
|
||||
// Case1.1: int test
|
||||
// bool expr exists, no cast expr, res is NULL
|
||||
select col_int and col_null from t1;
|
||||
col_int and col_null
|
||||
NULL
|
||||
// same as above
|
||||
select col_null and col_int from t1;
|
||||
col_null and col_int
|
||||
NULL
|
||||
// bool expr exists for col_varchar, cast expr exists, res is 0
|
||||
select col_int and col_varchar from t1;
|
||||
col_int and col_varchar
|
||||
0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'abc'
|
||||
// same as above
|
||||
select col_varchar and col_int from t1;
|
||||
col_varchar and col_int
|
||||
0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'abc'
|
||||
// bool expr and cast expr exists for col_varchar_num, res is 0
|
||||
select col_int and col_varchar_num from t1;
|
||||
col_int and col_varchar_num
|
||||
1
|
||||
// same as above
|
||||
select col_varchar_num and col_int from t1;
|
||||
col_varchar_num and col_int
|
||||
1
|
||||
// bool expr exists, no cast expr, res is 0
|
||||
select col_int and 0 from t1;
|
||||
col_int and 0
|
||||
0
|
||||
// same as above
|
||||
select 0 and col_int from t1;
|
||||
0 and col_int
|
||||
0
|
||||
// Case1.1: null test
|
||||
// bool expr exists, no cast expr, res is NULL
|
||||
select col_null and col_null from t1;
|
||||
col_null and col_null
|
||||
NULL
|
||||
// bool expr and cast expr exists for col_varchar_num, res is NULL
|
||||
select col_null and col_varchar_num from t1;
|
||||
col_null and col_varchar_num
|
||||
NULL
|
||||
// same as above
|
||||
select col_varchar_num and col_null from t1;
|
||||
col_varchar_num and col_null
|
||||
NULL
|
||||
// bool expr and cast expr exists for col_varchar_num, res is 0
|
||||
select col_null and col_varchar from t1;
|
||||
col_null and col_varchar
|
||||
0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'abc'
|
||||
// same as above
|
||||
select col_varchar and col_null from t1;
|
||||
col_varchar and col_null
|
||||
0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'abc'
|
||||
// same as above
|
||||
select col_null and 0 from t1;
|
||||
col_null and 0
|
||||
0
|
||||
// Case1.2: 0 test
|
||||
// bool expr exists, no cast expr, res is 0
|
||||
select col_varchar_num and 0 from t1;
|
||||
col_varchar_num and 0
|
||||
0
|
||||
// same as above
|
||||
select col_varchar_num and 0 from t1;
|
||||
col_varchar_num and 0
|
||||
0
|
||||
// Case1.3: empty str test
|
||||
// bool expr and cast expr exists for empty str, res is 0
|
||||
select col_int and '' from t1;
|
||||
col_int and ''
|
||||
0
|
||||
// same as above
|
||||
select '' and col_int from t1;
|
||||
'' and col_int
|
||||
0
|
||||
// bool expr and cast expr exists for empty str and col_varchar, res is 0
|
||||
select col_varchar and '' from t1;
|
||||
col_varchar and ''
|
||||
0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'abc'
|
||||
// same as above
|
||||
select '' and col_varchar from t1;
|
||||
'' and col_varchar
|
||||
0
|
||||
// bool expr and cast expr exists for empty str and col_varchar_num, res is 0
|
||||
select col_varchar_num and '' from t1;
|
||||
col_varchar_num and ''
|
||||
0
|
||||
// same as above
|
||||
select '' and col_varchar_num from t1;
|
||||
'' and col_varchar_num
|
||||
0
|
||||
// Case2: create table as test. 因为select/explain语句对应的cast mode
|
||||
// 有WARN_ON_FAIL。其他的没有,所以结果是有区别的
|
||||
// TODO: 目前没法测试,建表语句还不完善
|
||||
// Case3: or test
|
||||
// Case3.1 normal test
|
||||
// bool expr exists, res is 1
|
||||
select col_int or col_int from t1;
|
||||
col_int or col_int
|
||||
1
|
||||
// bool expr exists, res is 0
|
||||
select col_zero or col_zero from t1;
|
||||
col_zero or col_zero
|
||||
0
|
||||
// bool expr exists, cast expr exists res is 0
|
||||
select col_varchar_zero or col_varchar_zero from t1;
|
||||
col_varchar_zero or col_varchar_zero
|
||||
0
|
||||
// Case3.2 null test
|
||||
// bool expr exists, res is NULL
|
||||
select col_null or col_null from t1;
|
||||
col_null or col_null
|
||||
NULL
|
||||
// bool expr exists, res is 1
|
||||
select col_int or col_null from t1;
|
||||
col_int or col_null
|
||||
1
|
||||
// same as above
|
||||
select col_null or col_int from t1;
|
||||
col_null or col_int
|
||||
1
|
||||
// bool expr exists, res is NULL
|
||||
select col_zero or col_null from t1;
|
||||
col_zero or col_null
|
||||
NULL
|
||||
// same as above
|
||||
select col_null or col_zero from t1;
|
||||
col_null or col_zero
|
||||
NULL
|
||||
// bool expr exists, res is 1
|
||||
select col_varchar_num or col_null from t1;
|
||||
col_varchar_num or col_null
|
||||
1
|
||||
// same as above
|
||||
select col_null or col_varchar_num from t1;
|
||||
col_null or col_varchar_num
|
||||
1
|
||||
// bool expr exists, res is NULL
|
||||
select col_varchar_zero or col_null from t1;
|
||||
col_varchar_zero or col_null
|
||||
NULL
|
||||
// same as above
|
||||
select col_null or col_varchar_zero from t1;
|
||||
col_null or col_varchar_zero
|
||||
NULL
|
||||
// Case3.3 empty str test
|
||||
// bool expr exists, res is NULL
|
||||
select col_null or '' from t1;
|
||||
col_null or ''
|
||||
NULL
|
||||
// same as above
|
||||
select '' or col_null from t1;
|
||||
'' or col_null
|
||||
NULL
|
||||
// bool expr exists, res is 1
|
||||
select col_int or '' from t1;
|
||||
col_int or ''
|
||||
1
|
||||
// same as above
|
||||
select '' or col_int from t1;
|
||||
'' or col_int
|
||||
1
|
||||
// bool expr exists, res is 0
|
||||
select col_zero or '' from t1;
|
||||
col_zero or ''
|
||||
0
|
||||
// same as above
|
||||
select '' or col_zero from t1;
|
||||
'' or col_zero
|
||||
0
|
||||
// res is 0
|
||||
select col_empty_str or '' from t1;
|
||||
col_empty_str or ''
|
||||
0
|
||||
// Case4: multi and test
|
||||
// res is 1
|
||||
select 1 and 2 and 3 and col_int from t1;
|
||||
1 and 2 and 3 and col_int
|
||||
1
|
||||
// res is NULL
|
||||
select 1 and col_null and 3 and col_int from t1;
|
||||
1 and col_null and 3 and col_int
|
||||
NULL
|
||||
// res is 0
|
||||
select 1 and col_null and 3 and col_zero from t1;
|
||||
1 and col_null and 3 and col_zero
|
||||
0
|
||||
// res is 0
|
||||
select 1 and col_null and 3 and col_empty_str from t1;
|
||||
1 and col_null and 3 and col_empty_str
|
||||
0
|
||||
// Case5: multi or test
|
||||
// res is 1
|
||||
select 1 or 2 or col_int from t1;
|
||||
1 or 2 or col_int
|
||||
1
|
||||
// res is NULL
|
||||
select 1 or 2 or col_null from t1;
|
||||
1 or 2 or col_null
|
||||
1
|
||||
// res is 0
|
||||
select '' or 0 or col_null from t1;
|
||||
'' or 0 or col_null
|
||||
NULL
|
||||
// Case6: 0, 1, null三个值组合测试,结果跟不开新引擎的结果进行对比
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 int, c2 int, c3 int,
|
||||
c4 float, c5 float, c6 float,
|
||||
c7 double, c8 double, c9 double,
|
||||
c10 decimal, c11 decimal, c12 decimal,
|
||||
c13 datetime, c14 datetime, c15 datetime,
|
||||
c16 timestamp, c17 timestamp, c18 timestamp,
|
||||
c19 date, c20 date, c21 date,
|
||||
c22 varchar(10), c23 varchar(10), c24 varchar(10),
|
||||
c25 char(11), c26 char(11), c27 char(12),
|
||||
c28 char(10), c29 char(10), c30 char(10));
|
||||
insert into t1 values(0, 1, null,
|
||||
0.0, 1.0, null,
|
||||
0.0, 1.0, null,
|
||||
0.0, 1.0, null,
|
||||
0, '2019-01-01 00:00:00', null,
|
||||
0, '2019-01-01 00:00:00', null,
|
||||
0, '2019-01-01', null,
|
||||
'0', '123', null,
|
||||
'0', '123', null,
|
||||
'0', 'abc', null);
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select c1, c1, c1 and c1 from t1;
|
||||
c1 c1 c1 and c1
|
||||
0 0 0
|
||||
select c1, c1, c1 or c1 from t1;
|
||||
c1 c1 c1 or c1
|
||||
0 0 0
|
||||
select c1, c2, c1 and c2 from t1;
|
||||
c1 c2 c1 and c2
|
||||
0 1 0
|
||||
select c1, c2, c1 or c2 from t1;
|
||||
c1 c2 c1 or c2
|
||||
0 1 1
|
||||
select c1, c3, c1 and c3 from t1;
|
||||
c1 c3 c1 and c3
|
||||
0 NULL 0
|
||||
select c1, c3, c1 or c3 from t1;
|
||||
c1 c3 c1 or c3
|
||||
0 NULL NULL
|
||||
select c2, c1, c2 and c1 from t1;
|
||||
c2 c1 c2 and c1
|
||||
1 0 0
|
||||
select c2, c1, c2 or c1 from t1;
|
||||
c2 c1 c2 or c1
|
||||
1 0 1
|
||||
select c2, c2, c2 and c2 from t1;
|
||||
c2 c2 c2 and c2
|
||||
1 1 1
|
||||
select c2, c2, c2 or c2 from t1;
|
||||
c2 c2 c2 or c2
|
||||
1 1 1
|
||||
select c2, c3, c2 and c3 from t1;
|
||||
c2 c3 c2 and c3
|
||||
1 NULL NULL
|
||||
select c2, c3, c2 or c3 from t1;
|
||||
c2 c3 c2 or c3
|
||||
1 NULL 1
|
||||
select c3, c1, c3 and c1 from t1;
|
||||
c3 c1 c3 and c1
|
||||
NULL 0 0
|
||||
select c3, c1, c3 or c1 from t1;
|
||||
c3 c1 c3 or c1
|
||||
NULL 0 NULL
|
||||
select c3, c2, c3 and c2 from t1;
|
||||
c3 c2 c3 and c2
|
||||
NULL 1 NULL
|
||||
select c3, c2, c3 or c2 from t1;
|
||||
c3 c2 c3 or c2
|
||||
NULL 1 1
|
||||
select c3, c3, c3 and c3 from t1;
|
||||
c3 c3 c3 and c3
|
||||
NULL NULL NULL
|
||||
select c3, c3, c3 or c3 from t1;
|
||||
c3 c3 c3 or c3
|
||||
NULL NULL NULL
|
||||
drop table t1;
|
||||
CREATE TABLE t1(c0 VARCHAR(500), c1 DECIMAL);
|
||||
insert into t1 values('', 123);
|
||||
SELECT ALL t1.c0 AS ref0 FROM t1 WHERE (NULL AND ( CAST(COALESCE(t1.c0, EXISTS (SELECT 1)) AS SIGNED) IS NOT NULL)) IS NULL;
|
||||
ref0
|
||||
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: ''
|
||||
drop table t1;
|
@ -1,183 +0,0 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,oceanbase,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 int, c2 int unsigned,
|
||||
c3 tinyint, c4 tinyint unsigned,
|
||||
c5 smallint, c6 smallint unsigned,
|
||||
c7 mediumint, c8 mediumint unsigned,
|
||||
c9 integer, c10 integer unsigned,
|
||||
c11 bigint, c12 bigint unsigned,
|
||||
c13 float, c14 float unsigned,
|
||||
c15 double, c16 double unsigned,
|
||||
c17 decimal, c18 decimal unsigned,
|
||||
c19 datetime, c20 timestamp,
|
||||
c21 varchar(30), c22 char(30));
|
||||
insert into t1 values(1, 2,
|
||||
1, 2,
|
||||
1, 2,
|
||||
1, 2,
|
||||
1, 2,
|
||||
1, 2,
|
||||
3.5, 4.5,
|
||||
5.5, 6.5,
|
||||
7.5, 8.5,
|
||||
'2019-12-01 12:00:00', '2019-12-03 06:00:00',
|
||||
'9.5', '10.5');
|
||||
select @var1, @var2;
|
||||
@var1 @var2
|
||||
NULL NULL
|
||||
select @var2_1 := @var1_1 := c1 from t1;
|
||||
@var2_1 := @var1_1 := c1
|
||||
1
|
||||
select @var1_1, @var2_1;
|
||||
@var1_1 @var2_1
|
||||
1 1
|
||||
select @var2_2 := @var1_2 := c2 from t1;
|
||||
@var2_2 := @var1_2 := c2
|
||||
2
|
||||
select @var1_2, @var2_2;
|
||||
@var1_2 @var2_2
|
||||
2 2
|
||||
select @var2_3 := @var1_3 := c3 from t1;
|
||||
@var2_3 := @var1_3 := c3
|
||||
1
|
||||
select @var1_3, @var2_3;
|
||||
@var1_3 @var2_3
|
||||
1 1
|
||||
select @var2_4 := @var1_4 := c4 from t1;
|
||||
@var2_4 := @var1_4 := c4
|
||||
2
|
||||
select @var1_4, @var2_4;
|
||||
@var1_4 @var2_4
|
||||
2 2
|
||||
select @var2_5 := @var1_5 := c5 from t1;
|
||||
@var2_5 := @var1_5 := c5
|
||||
1
|
||||
select @var1_5, @var2_5;
|
||||
@var1_5 @var2_5
|
||||
1 1
|
||||
select @var2_6 := @var1_6 := c6 from t1;
|
||||
@var2_6 := @var1_6 := c6
|
||||
2
|
||||
select @var1_6, @var2_6;
|
||||
@var1_6 @var2_6
|
||||
2 2
|
||||
select @var2_7 := @var1_7 := c7 from t1;
|
||||
@var2_7 := @var1_7 := c7
|
||||
1
|
||||
select @var1_7, @var2_7;
|
||||
@var1_7 @var2_7
|
||||
1 1
|
||||
select @var2_8 := @var1_8 := c8 from t1;
|
||||
@var2_8 := @var1_8 := c8
|
||||
2
|
||||
select @var1_8, @var2_8;
|
||||
@var1_8 @var2_8
|
||||
2 2
|
||||
select @var2_9 := @var1_9 := c9 from t1;
|
||||
@var2_9 := @var1_9 := c9
|
||||
1
|
||||
select @var1_9, @var2_9;
|
||||
@var1_9 @var2_9
|
||||
1 1
|
||||
select @var2_10 := @var1_10 := c10 from t1;
|
||||
@var2_10 := @var1_10 := c10
|
||||
2
|
||||
select @var1_10, @var2_10;
|
||||
@var1_10 @var2_10
|
||||
2 2
|
||||
select @var2_11 := @var1_11 := c11 from t1;
|
||||
@var2_11 := @var1_11 := c11
|
||||
1
|
||||
select @var1_11, @var2_11;
|
||||
@var1_11 @var2_11
|
||||
1 1
|
||||
select @var2_12 := @var1_12 := c12 from t1;
|
||||
@var2_12 := @var1_12 := c12
|
||||
2
|
||||
select @var1_12, @var2_12;
|
||||
@var1_12 @var2_12
|
||||
2 2
|
||||
select @var2_13 := @var1_13 := c13 from t1;
|
||||
@var2_13 := @var1_13 := c13
|
||||
3.5
|
||||
select @var1_13, @var2_13;
|
||||
@var1_13 @var2_13
|
||||
3.5 3.5
|
||||
select @var2_14 := @var1_14 := c14 from t1;
|
||||
@var2_14 := @var1_14 := c14
|
||||
4.5
|
||||
select @var1_14, @var2_14;
|
||||
@var1_14 @var2_14
|
||||
4.5 4.5
|
||||
select @var2_15 := @var1_15 := c15 from t1;
|
||||
@var2_15 := @var1_15 := c15
|
||||
5.5
|
||||
select @var1_15, @var2_15;
|
||||
@var1_15 @var2_15
|
||||
5.5 5.5
|
||||
select @var2_16 := @var1_16 := c16 from t1;
|
||||
@var2_16 := @var1_16 := c16
|
||||
6.5
|
||||
select @var1_16, @var2_16;
|
||||
@var1_16 @var2_16
|
||||
6.5 6.5
|
||||
select @var2_17 := @var1_17 := c17 from t1;
|
||||
@var2_17 := @var1_17 := c17
|
||||
8
|
||||
select @var1_17, @var2_17;
|
||||
@var1_17 @var2_17
|
||||
8 8
|
||||
select @var2_18 := @var1_18 := c18 from t1;
|
||||
@var2_18 := @var1_18 := c18
|
||||
9
|
||||
select @var1_18, @var2_18;
|
||||
@var1_18 @var2_18
|
||||
9 9
|
||||
select @var2_19 := @var1_19 := c19 from t1;
|
||||
@var2_19 := @var1_19 := c19
|
||||
2019-12-01 12:00:00
|
||||
select @var1_19, @var2_19;
|
||||
@var1_19 @var2_19
|
||||
2019-12-01 12:00:00 2019-12-01 12:00:00
|
||||
select @var2_20 := @var1_20 := c20 from t1;
|
||||
@var2_20 := @var1_20 := c20
|
||||
2019-12-03 06:00:00
|
||||
select @var1_20, @var2_20;
|
||||
@var1_20 @var2_20
|
||||
2019-12-03 06:00:00 2019-12-03 06:00:00
|
||||
select @var2_21 := @var1_21 := c21 from t1;
|
||||
@var2_21 := @var1_21 := c21
|
||||
9.5
|
||||
select @var1_21, @var2_21;
|
||||
@var1_21 @var2_21
|
||||
9.5 9.5
|
||||
select @var2_22 := @var1_22 := c22 from t1;
|
||||
@var2_22 := @var1_22 := c22
|
||||
10.5
|
||||
select @var1_22, @var2_22;
|
||||
@var1_22 @var2_22
|
||||
10.5 10.5
|
||||
set @a = 1;
|
||||
select @a := @someval;
|
||||
@a := @someval
|
||||
NULL
|
||||
select @a;
|
||||
@a
|
||||
NULL
|
||||
drop view if exists vv;
|
||||
create view vv as select @a;
|
||||
desc vv;
|
||||
Field Type Null Key Default Extra
|
||||
@a varbinary(1048576) NO
|
||||
select @a := null;
|
||||
@a := null
|
||||
NULL
|
||||
select @a;
|
||||
@a
|
||||
NULL
|
||||
drop view if exists vv;
|
||||
create view vv as select @a;
|
||||
desc vv;
|
||||
Field Type Null Key Default Extra
|
||||
@a varbinary(1048576) NO
|
File diff suppressed because it is too large
Load Diff
@ -1,43 +0,0 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,oceanbase,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
alter system flush plan cache global;
|
||||
set ob_enable_plan_cache = 0;
|
||||
select char_length(1234);
|
||||
char_length(1234)
|
||||
4
|
||||
select char_length(1);
|
||||
char_length(1)
|
||||
1
|
||||
select char_length(null);
|
||||
char_length(null)
|
||||
NULL
|
||||
select char_length('');
|
||||
char_length('')
|
||||
0
|
||||
select char_length('a');
|
||||
char_length('a')
|
||||
1
|
||||
select char_length(' a ');
|
||||
char_length(' a ')
|
||||
3
|
||||
select char_length(' a b');
|
||||
char_length(' a b')
|
||||
4
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 int, c2 char(10), c3 varchar(10), c4 timestamp, c5 decimal);
|
||||
insert into t1 values(1, 'a ', 'a ', '2010-01-01 11:11:11', 10.1);
|
||||
select char_length(c1) from t1;
|
||||
char_length(c1)
|
||||
1
|
||||
select char_length(c2) from t1;
|
||||
char_length(c2)
|
||||
1
|
||||
select char_length(c3) from t1;
|
||||
char_length(c3)
|
||||
2
|
||||
select char_length(c4) from t1;
|
||||
char_length(c4)
|
||||
19
|
||||
select char_length(c5) from t1;
|
||||
char_length(c5)
|
||||
2
|
@ -1,138 +0,0 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,oceanbase,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 int, c2 int unsigned,
|
||||
c3 tinyint, c4 tinyint unsigned,
|
||||
c5 smallint, c6 smallint unsigned,
|
||||
c7 mediumint, c8 mediumint unsigned,
|
||||
c9 integer, c10 integer unsigned,
|
||||
c11 bigint, c12 bigint unsigned,
|
||||
c13 float, c14 float unsigned,
|
||||
c15 double, c16 double unsigned,
|
||||
c17 decimal, c18 decimal unsigned,
|
||||
c19 datetime, c20 timestamp,
|
||||
c21 varchar(30), c22 char(30),
|
||||
c23 varchar(30) charset utf8);
|
||||
insert into t1 values(1, 2,
|
||||
1, 2,
|
||||
1, 2,
|
||||
1, 2,
|
||||
1, 2,
|
||||
1, 2,
|
||||
3.5, 4.5,
|
||||
5.5, 6.5,
|
||||
7.5, 8.5,
|
||||
'2019-12-01 12:00:00', '2019-12-03 06:00:00',
|
||||
'9.5', '10.5', 'utf8 col');
|
||||
insert into t1 values(-1, 2,
|
||||
-1, 2,
|
||||
-1, 2,
|
||||
-1, 2,
|
||||
-1, 2,
|
||||
-1, 2,
|
||||
-3.5, 4.5,
|
||||
-5.5, 6.5,
|
||||
-7.5, 8.5,
|
||||
'2019-12-01 12:00:00', '2019-12-03 06:00:00',
|
||||
'-9.5', '10.5', 'utf8 col');
|
||||
select c1, charset(c1), collation(c1), coercibility(c1) from t1;
|
||||
c1 charset(c1) collation(c1) coercibility(c1)
|
||||
1 binary binary 5
|
||||
-1 binary binary 5
|
||||
select c2, charset(c2), collation(c2), coercibility(c2) from t1;
|
||||
c2 charset(c2) collation(c2) coercibility(c2)
|
||||
2 binary binary 5
|
||||
2 binary binary 5
|
||||
select c3, charset(c3), collation(c3), coercibility(c3) from t1;
|
||||
c3 charset(c3) collation(c3) coercibility(c3)
|
||||
1 binary binary 5
|
||||
-1 binary binary 5
|
||||
select c4, charset(c4), collation(c4), coercibility(c4) from t1;
|
||||
c4 charset(c4) collation(c4) coercibility(c4)
|
||||
2 binary binary 5
|
||||
2 binary binary 5
|
||||
select c5, charset(c5), collation(c5), coercibility(c5) from t1;
|
||||
c5 charset(c5) collation(c5) coercibility(c5)
|
||||
1 binary binary 5
|
||||
-1 binary binary 5
|
||||
select c6, charset(c6), collation(c6), coercibility(c6) from t1;
|
||||
c6 charset(c6) collation(c6) coercibility(c6)
|
||||
2 binary binary 5
|
||||
2 binary binary 5
|
||||
select c7, charset(c7), collation(c7), coercibility(c7) from t1;
|
||||
c7 charset(c7) collation(c7) coercibility(c7)
|
||||
1 binary binary 5
|
||||
-1 binary binary 5
|
||||
select c8, charset(c8), collation(c8), coercibility(c8) from t1;
|
||||
c8 charset(c8) collation(c8) coercibility(c8)
|
||||
2 binary binary 5
|
||||
2 binary binary 5
|
||||
select c9, charset(c9), collation(c9), coercibility(c9) from t1;
|
||||
c9 charset(c9) collation(c9) coercibility(c9)
|
||||
1 binary binary 5
|
||||
-1 binary binary 5
|
||||
select c10, charset(c10), collation(c10), coercibility(c10) from t1;
|
||||
c10 charset(c10) collation(c10) coercibility(c10)
|
||||
2 binary binary 5
|
||||
2 binary binary 5
|
||||
select c11, charset(c11), collation(c11), coercibility(c11) from t1;
|
||||
c11 charset(c11) collation(c11) coercibility(c11)
|
||||
1 binary binary 5
|
||||
-1 binary binary 5
|
||||
select c12, charset(c12), collation(c12), coercibility(c12) from t1;
|
||||
c12 charset(c12) collation(c12) coercibility(c12)
|
||||
2 binary binary 5
|
||||
2 binary binary 5
|
||||
select c13, charset(c13), collation(c13), coercibility(c13) from t1;
|
||||
c13 charset(c13) collation(c13) coercibility(c13)
|
||||
3.5 binary binary 5
|
||||
-3.5 binary binary 5
|
||||
select c14, charset(c14), collation(c14), coercibility(c14) from t1;
|
||||
c14 charset(c14) collation(c14) coercibility(c14)
|
||||
4.5 binary binary 5
|
||||
4.5 binary binary 5
|
||||
select c15, charset(c15), collation(c15), coercibility(c15) from t1;
|
||||
c15 charset(c15) collation(c15) coercibility(c15)
|
||||
5.5 binary binary 5
|
||||
-5.5 binary binary 5
|
||||
select c16, charset(c16), collation(c16), coercibility(c16) from t1;
|
||||
c16 charset(c16) collation(c16) coercibility(c16)
|
||||
6.5 binary binary 5
|
||||
6.5 binary binary 5
|
||||
select c17, charset(c17), collation(c17), coercibility(c17) from t1;
|
||||
c17 charset(c17) collation(c17) coercibility(c17)
|
||||
8 binary binary 5
|
||||
-8 binary binary 5
|
||||
select c18, charset(c18), collation(c18), coercibility(c18) from t1;
|
||||
c18 charset(c18) collation(c18) coercibility(c18)
|
||||
9 binary binary 5
|
||||
9 binary binary 5
|
||||
select c19, charset(c19), collation(c19), coercibility(c19) from t1;
|
||||
c19 charset(c19) collation(c19) coercibility(c19)
|
||||
2019-12-01 12:00:00 binary binary 5
|
||||
2019-12-01 12:00:00 binary binary 5
|
||||
select c20, charset(c20), collation(c20), coercibility(c20) from t1;
|
||||
c20 charset(c20) collation(c20) coercibility(c20)
|
||||
2019-12-03 06:00:00 binary binary 5
|
||||
2019-12-03 06:00:00 binary binary 5
|
||||
select c21, charset(c21), collation(c21), coercibility(c21) from t1;
|
||||
c21 charset(c21) collation(c21) coercibility(c21)
|
||||
9.5 utf8mb4 utf8mb4_general_ci 2
|
||||
-9.5 utf8mb4 utf8mb4_general_ci 2
|
||||
select c22, charset(c22), collation(c22), coercibility(c22) from t1;
|
||||
c22 charset(c22) collation(c22) coercibility(c22)
|
||||
10.5 utf8mb4 utf8mb4_general_ci 2
|
||||
10.5 utf8mb4 utf8mb4_general_ci 2
|
||||
// test set_collation expr
|
||||
// set_collation表达式检查charset与collate不匹配,报错
|
||||
// 下面的是等号表达式在类型推导时,进行aggregate collation发现collation不一致报错
|
||||
select _utf8mb4'a' collate utf8mb4_general_ci = _utf8mb4'A' collate utf8mb4_bin;
|
||||
ERROR HY000: Illegal mix of collations
|
||||
select _utf8mb4'a' collate utf8mb4_general_ci = _utf8mb4'A' collate utf8mb4_general_ci;
|
||||
_utf8mb4'a' collate utf8mb4_general_ci = _utf8mb4'A' collate utf8mb4_general_ci
|
||||
1
|
||||
select _utf8mb4'a' collate utf8mb4_bin = _utf8mb4'A' collate utf8mb4_bin;
|
||||
_utf8mb4'a' collate utf8mb4_bin = _utf8mb4'A' collate utf8mb4_bin
|
||||
0
|
||||
drop table t1;
|
File diff suppressed because one or more lines are too long
@ -1,25 +0,0 @@
|
||||
connect sys, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select conv('a',16,2) from dual;
|
||||
conv('a',16,2)
|
||||
1010
|
||||
select conv('6E',18,8) from dual;
|
||||
conv('6E',18,8)
|
||||
172
|
||||
select conv(-17,10,-18) from dual;
|
||||
conv(-17,10,-18)
|
||||
-H
|
||||
select conv(10+'10'+'10'+X'0a',10,10) from dual;
|
||||
conv(10+'10'+'10'+X'0a',10,10)
|
||||
40
|
||||
select conv(null, 16, 2) from dual;
|
||||
conv(null, 16, 2)
|
||||
NULL
|
||||
select conv('6E',null,8) from dual;
|
||||
conv('6E',null,8)
|
||||
NULL
|
||||
select conv('6E',18, null) from dual;
|
||||
conv('6E',18, null)
|
||||
NULL
|
||||
connection sys;
|
@ -1,18 +0,0 @@
|
||||
connect sys, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection default;
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 varchar(2000));
|
||||
insert into t1 values("2019-10-11");
|
||||
connection sys;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select date(c1) from t1;
|
||||
date(c1)
|
||||
2019-10-11
|
||||
select date("2019-10-10") from dual;
|
||||
date("2019-10-10")
|
||||
2019-10-10
|
||||
select date(null) from dual;
|
||||
date(null)
|
||||
NULL
|
||||
connection sys;
|
@ -1,34 +0,0 @@
|
||||
connect sys, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection default;
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 varchar(30), c2 date, c3 date);
|
||||
insert into t1 values("2019-10-11", "2019-01-10", "2018-01-01");
|
||||
insert into t1 values(null, "2019-01-10", null);
|
||||
insert into t1 values("2019-10-11", "0000-00-00", "2019-10-19");
|
||||
connection sys;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select datediff(c1, c2), datediff(c2, c3) from t1;
|
||||
datediff(c1, c2) datediff(c2, c3)
|
||||
274 374
|
||||
NULL NULL
|
||||
NULL NULL
|
||||
select datediff(20080701, "2008-08-01");
|
||||
datediff(20080701, "2008-08-01")
|
||||
-31
|
||||
select datediff("20080701", "2012-05-25");
|
||||
datediff("20080701", "2012-05-25")
|
||||
-1424
|
||||
select datediff("2012-05-25","20080701");
|
||||
datediff("2012-05-25","20080701")
|
||||
1424
|
||||
select datediff(null,null);
|
||||
datediff(null,null)
|
||||
NULL
|
||||
select datediff(null,"2012-05-25");
|
||||
datediff(null,"2012-05-25")
|
||||
NULL
|
||||
select datediff("2012-05-25","0000-00-00");
|
||||
datediff("2012-05-25","0000-00-00")
|
||||
NULL
|
||||
connection sys;
|
@ -1,25 +0,0 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select des_hex_str("11053FFF80EAB6BADEE6F501");
|
||||
des_hex_str("11053FFF80EAB6BADEE6F501")
|
||||
2004-04-04 04:04:04.000000
|
||||
select des_hex_str("0C053FFFB8BD94DC9E8A8E8B40");
|
||||
des_hex_str("0C053FFFB8BD94DC9E8A8E8B40")
|
||||
5.555
|
||||
select des_hex_str("0C053FFFB8BD94DC9E8A8E8B40");
|
||||
des_hex_str("0C053FFFB8BD94DC9E8A8E8B40")
|
||||
5.555
|
||||
select des_hex_str("04053FFF05");
|
||||
des_hex_str("04053FFF05")
|
||||
5
|
||||
select des_hex_str("0C053FFFADE4F6FCFED4F1F83F");
|
||||
des_hex_str("0C053FFFADE4F6FCFED4F1F83F")
|
||||
1.111
|
||||
select des_hex_str("0B053FFF8080C08504");
|
||||
des_hex_str("0B053FFF8080C08504")
|
||||
5.5
|
||||
select des_hex_str(NULL);
|
||||
ERROR HY000: Invalid argument
|
||||
connection syscon;
|
@ -1,123 +0,0 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
alter system set enable_async_syslog = false;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
set @@ob_log_level='debug';
|
||||
drop view if exists v1;
|
||||
create view v1 as select connection_id() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
connection_id() int(10) unsigned NO
|
||||
drop view v1;
|
||||
create view v1 as select utc_timestamp() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
utc_timestamp() datetime NO
|
||||
drop view v1;
|
||||
create view v1 as select utc_timestamp(3) from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
utc_timestamp(3) datetime(3) NO
|
||||
drop view v1;
|
||||
create view v1 as select current_timestamp() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
current_timestamp() datetime NO
|
||||
drop view v1;
|
||||
create view v1 as select current_timestamp(3) from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
current_timestamp(3) datetime NO
|
||||
drop view v1;
|
||||
create view v1 as select sysdate() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
sysdate() datetime NO
|
||||
drop view v1;
|
||||
create view v1 as select sysdate(3) from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
sysdate(3) datetime NO
|
||||
drop view v1;
|
||||
create view v1 as select cur_date() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
cur_date() date NO
|
||||
drop view v1;
|
||||
create view v1 as select curtime() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
curtime() time NO
|
||||
drop view v1;
|
||||
create view v1 as select current_user() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
current_user() varchar(193) NO
|
||||
drop view v1;
|
||||
create view v1 as select database() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
database() varchar(128) NO
|
||||
drop view v1;
|
||||
create view v1 as select effective_tenant_id() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
effective_tenant_id() bigint(20) unsigned NO
|
||||
drop view v1;
|
||||
create view v1 as select effective_tenant() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
effective_tenant() varchar(64) NO
|
||||
drop view v1;
|
||||
create view v1 as select found_rows() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
found_rows() bigint(20) NO
|
||||
drop view v1;
|
||||
create view v1 as select host_ip() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
host_ip() varchar(46) NO
|
||||
drop view v1;
|
||||
create view v1 as select last_execution_id() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
last_execution_id() bigint NO
|
||||
drop view v1;
|
||||
create view v1 as select last_trace_id() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
last_trace_id() varchar(128) NO
|
||||
drop view v1;
|
||||
create view v1 as select mysql_port() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
mysql_port() bigint(20) NO
|
||||
drop view v1;
|
||||
create view v1 as select rpc_port() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
rpc_port() int(11) NO
|
||||
drop view v1;
|
||||
create view v1 as select row_count() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
row_count() bigint(20) NO
|
||||
drop view v1;
|
||||
create view v1 as select uuid() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
uuid() varchar(36) NO
|
||||
drop view v1;
|
||||
create view v1 as select user() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
user() varchar(193) NO
|
||||
drop view v1;
|
||||
create view v1 as select version() from dual limit 10;
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
version() varchar(18) NO
|
||||
drop view v1;
|
||||
connection conn_admin;
|
@ -1,29 +0,0 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select field(1, 3, 2, 1, NULL);
|
||||
field(1, 3, 2, 1, NULL)
|
||||
3
|
||||
select field(1, 3, 2, 1, NULL, 1);
|
||||
field(1, 3, 2, 1, NULL, 1)
|
||||
3
|
||||
select field(NULL, 3, 2, 1, NULL);
|
||||
field(NULL, 3, 2, 1, NULL)
|
||||
0
|
||||
select field(2, 3, NULL, 2, 1, NULL);
|
||||
field(2, 3, NULL, 2, 1, NULL)
|
||||
3
|
||||
select field(1, 3, 2, "1", NULL);
|
||||
field(1, 3, 2, "1", NULL)
|
||||
3
|
||||
select field(1, 3, 2.2, "1", NULL);
|
||||
field(1, 3, 2.2, "1", NULL)
|
||||
3
|
||||
select field("abc", 3.2, "def", 'abc');
|
||||
field("abc", 3.2, "def", 'abc')
|
||||
2
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'abc'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'def'
|
||||
connection syscon;
|
@ -1,30 +0,0 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,oceanbase,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
// res type is string
|
||||
select @@ob_log_level;
|
||||
@@ob_log_level
|
||||
disabled
|
||||
set @@ob_log_level='debug';
|
||||
select @@ob_log_level;
|
||||
@@ob_log_level
|
||||
debug
|
||||
set @@ob_log_level='info';
|
||||
// res type is bool
|
||||
set @@ob_enable_plan_cache = 1;
|
||||
select @@ob_enable_plan_cache = 0;
|
||||
@@ob_enable_plan_cache = 0
|
||||
0
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select @@ob_enable_plan_cache = 0;
|
||||
@@ob_enable_plan_cache = 0
|
||||
1
|
||||
// res type is int
|
||||
select @@ob_plan_cache_percentage;
|
||||
@@ob_plan_cache_percentage
|
||||
5
|
||||
// test null
|
||||
set character_set_results=NULL;
|
||||
select @@character_set_results;
|
||||
@@character_set_results
|
||||
NULL
|
@ -1,31 +0,0 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
alter system flush plan cache global;
|
||||
set ob_enable_plan_cache = 0;
|
||||
set @var1 = NULL;
|
||||
select @var1 from dual;
|
||||
@var1
|
||||
NULL
|
||||
set @var1 = 1;
|
||||
select @var1 from dual;
|
||||
@var1
|
||||
1
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 int);
|
||||
insert into t1 values(@var1);
|
||||
select * from t1;
|
||||
c1
|
||||
1
|
||||
set @a=0,@b=0;
|
||||
select @a:=10, @b:=1, @a > @b, @a < @b;
|
||||
@a:=10 @b:=1 @a > @b @a < @b
|
||||
10 1 1 0
|
||||
select @a:="10", @b:="1", @a > @b, @a < @b;
|
||||
@a:="10" @b:="1" @a > @b @a < @b
|
||||
10 1 1 0
|
||||
select @a:=10, @b:=2, @a > @b, @a < @b;
|
||||
@a:=10 @b:=2 @a > @b @a < @b
|
||||
10 2 0 1
|
||||
select @a:="10", @b:="2", @a > @b, @a < @b;
|
||||
@a:="10" @b:="2" @a > @b @a < @b
|
||||
10 2 1 0
|
@ -1,388 +0,0 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,oceanbase,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
connection default;
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 int, c2 int unsigned,
|
||||
c3 tinyint, c4 tinyint unsigned,
|
||||
c5 smallint, c6 smallint unsigned,
|
||||
c7 mediumint, c8 mediumint unsigned,
|
||||
c9 integer, c10 integer unsigned,
|
||||
c11 bigint, c12 bigint unsigned,
|
||||
c13 float, c14 float unsigned,
|
||||
c15 double, c16 double unsigned,
|
||||
c17 decimal, c18 decimal unsigned,
|
||||
c19 date, c20 date not null,
|
||||
c21 datetime, c22 datetime not null,
|
||||
c23 timestamp, c24 timestamp not null,
|
||||
c25 varchar(30), c26 char(30));
|
||||
select * from t1;
|
||||
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26
|
||||
insert into t1 values(NULL, NULL,
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
NULL, '0000-00-00',
|
||||
NULL, '0000-00-00 00:00:00',
|
||||
NULL, '0000-00-00 00:00:00',
|
||||
NULL, NULL);
|
||||
insert into t1 values(0, 0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0, 0,
|
||||
0.0, 0.0,
|
||||
0.0, 0.0,
|
||||
0.0, 0.0,
|
||||
'0000-00-00', '0000-00-00',
|
||||
'0000-00-00 00:00:00', '0000-00-00 00:00:00',
|
||||
'0000-00-00 00:00:00', '0000-00-00 00:00:00',
|
||||
'0', '0.0');
|
||||
insert into t1 values(1, 1,
|
||||
1, 1,
|
||||
1, 1,
|
||||
1, 1,
|
||||
1, 1,
|
||||
1, 1,
|
||||
-0.1, 0.1,
|
||||
-0.1, 0.1,
|
||||
-0.1, 0.1,
|
||||
'0001-01-01', '0001-01-01',
|
||||
'0001-01-01 00:00:00', '0001-01-01 00:00:00',
|
||||
'0001-01-01 00:00:00', '0001-01-01 00:00:00',
|
||||
'1', '1.0');
|
||||
insert into t1 values(11, 11,
|
||||
11, 11,
|
||||
11, 11,
|
||||
11, 11,
|
||||
11, 11,
|
||||
11, 11,
|
||||
11.0, 11.0,
|
||||
11.0, 11.0,
|
||||
11.0, 11.0,
|
||||
'2019-12-01 12:00:00', '2019-12-01 12:00:00',
|
||||
'2019-12-01 12:00:00', '2019-12-01 12:00:00',
|
||||
'2019-12-01 12:00:00', '2019-12-01 12:00:00',
|
||||
'11', '11.0');
|
||||
connection conn_admin;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select c1, c1 is true, c1 is false, c1 is null, c1 is unknown from t1;
|
||||
c1 c1 is true c1 is false c1 is null c1 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
1 1 0 0 0
|
||||
11 1 0 0 0
|
||||
select c1, c1 is not true, c1 is not false, c1 is not null, c1 is not unknown from t1;
|
||||
c1 c1 is not true c1 is not false c1 is not null c1 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
1 0 1 1 1
|
||||
11 0 1 1 1
|
||||
select c2, c2 is true, c2 is false, c2 is null, c2 is unknown from t1;
|
||||
c2 c2 is true c2 is false c2 is null c2 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
1 1 0 0 0
|
||||
11 1 0 0 0
|
||||
select c2, c2 is not true, c2 is not false, c2 is not null, c2 is not unknown from t1;
|
||||
c2 c2 is not true c2 is not false c2 is not null c2 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
1 0 1 1 1
|
||||
11 0 1 1 1
|
||||
select c3, c3 is true, c3 is false, c3 is null, c3 is unknown from t1;
|
||||
c3 c3 is true c3 is false c3 is null c3 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
1 1 0 0 0
|
||||
11 1 0 0 0
|
||||
select c3, c3 is not true, c3 is not false, c3 is not null, c3 is not unknown from t1;
|
||||
c3 c3 is not true c3 is not false c3 is not null c3 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
1 0 1 1 1
|
||||
11 0 1 1 1
|
||||
select c4, c4 is true, c4 is false, c4 is null, c4 is unknown from t1;
|
||||
c4 c4 is true c4 is false c4 is null c4 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
1 1 0 0 0
|
||||
11 1 0 0 0
|
||||
select c4, c4 is not true, c4 is not false, c4 is not null, c4 is not unknown from t1;
|
||||
c4 c4 is not true c4 is not false c4 is not null c4 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
1 0 1 1 1
|
||||
11 0 1 1 1
|
||||
select c5, c5 is true, c5 is false, c5 is null, c5 is unknown from t1;
|
||||
c5 c5 is true c5 is false c5 is null c5 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
1 1 0 0 0
|
||||
11 1 0 0 0
|
||||
select c5, c5 is not true, c5 is not false, c5 is not null, c5 is not unknown from t1;
|
||||
c5 c5 is not true c5 is not false c5 is not null c5 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
1 0 1 1 1
|
||||
11 0 1 1 1
|
||||
select c6, c6 is true, c6 is false, c6 is null, c6 is unknown from t1;
|
||||
c6 c6 is true c6 is false c6 is null c6 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
1 1 0 0 0
|
||||
11 1 0 0 0
|
||||
select c6, c6 is not true, c6 is not false, c6 is not null, c6 is not unknown from t1;
|
||||
c6 c6 is not true c6 is not false c6 is not null c6 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
1 0 1 1 1
|
||||
11 0 1 1 1
|
||||
select c7, c7 is true, c7 is false, c7 is null, c7 is unknown from t1;
|
||||
c7 c7 is true c7 is false c7 is null c7 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
1 1 0 0 0
|
||||
11 1 0 0 0
|
||||
select c7, c7 is not true, c7 is not false, c7 is not null, c7 is not unknown from t1;
|
||||
c7 c7 is not true c7 is not false c7 is not null c7 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
1 0 1 1 1
|
||||
11 0 1 1 1
|
||||
select c8, c8 is true, c8 is false, c8 is null, c8 is unknown from t1;
|
||||
c8 c8 is true c8 is false c8 is null c8 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
1 1 0 0 0
|
||||
11 1 0 0 0
|
||||
select c8, c8 is not true, c8 is not false, c8 is not null, c8 is not unknown from t1;
|
||||
c8 c8 is not true c8 is not false c8 is not null c8 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
1 0 1 1 1
|
||||
11 0 1 1 1
|
||||
select c9, c9 is true, c9 is false, c9 is null, c9 is unknown from t1;
|
||||
c9 c9 is true c9 is false c9 is null c9 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
1 1 0 0 0
|
||||
11 1 0 0 0
|
||||
select c9, c9 is not true, c9 is not false, c9 is not null, c9 is not unknown from t1;
|
||||
c9 c9 is not true c9 is not false c9 is not null c9 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
1 0 1 1 1
|
||||
11 0 1 1 1
|
||||
select c10, c10 is true, c10 is false, c10 is null, c10 is unknown from t1;
|
||||
c10 c10 is true c10 is false c10 is null c10 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
1 1 0 0 0
|
||||
11 1 0 0 0
|
||||
select c10, c10 is not true, c10 is not false, c10 is not null, c10 is not unknown from t1;
|
||||
c10 c10 is not true c10 is not false c10 is not null c10 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
1 0 1 1 1
|
||||
11 0 1 1 1
|
||||
select c11, c11 is true, c11 is false, c11 is null, c11 is unknown from t1;
|
||||
c11 c11 is true c11 is false c11 is null c11 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
1 1 0 0 0
|
||||
11 1 0 0 0
|
||||
select c11, c11 is not true, c11 is not false, c11 is not null, c11 is not unknown from t1;
|
||||
c11 c11 is not true c11 is not false c11 is not null c11 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
1 0 1 1 1
|
||||
11 0 1 1 1
|
||||
select c12, c12 is true, c12 is false, c12 is null, c12 is unknown from t1;
|
||||
c12 c12 is true c12 is false c12 is null c12 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
1 1 0 0 0
|
||||
11 1 0 0 0
|
||||
select c12, c12 is not true, c12 is not false, c12 is not null, c12 is not unknown from t1;
|
||||
c12 c12 is not true c12 is not false c12 is not null c12 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
1 0 1 1 1
|
||||
11 0 1 1 1
|
||||
select c13, c13 is true, c13 is false, c13 is null, c13 is unknown from t1;
|
||||
c13 c13 is true c13 is false c13 is null c13 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
-0.1 1 0 0 0
|
||||
11 1 0 0 0
|
||||
select c13, c13 is not true, c13 is not false, c13 is not null, c13 is not unknown from t1;
|
||||
c13 c13 is not true c13 is not false c13 is not null c13 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
-0.1 0 1 1 1
|
||||
11 0 1 1 1
|
||||
select c14, c14 is true, c14 is false, c14 is null, c14 is unknown from t1;
|
||||
c14 c14 is true c14 is false c14 is null c14 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
0.1 1 0 0 0
|
||||
11 1 0 0 0
|
||||
select c14, c14 is not true, c14 is not false, c14 is not null, c14 is not unknown from t1;
|
||||
c14 c14 is not true c14 is not false c14 is not null c14 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
0.1 0 1 1 1
|
||||
11 0 1 1 1
|
||||
select c15, c15 is true, c15 is false, c15 is null, c15 is unknown from t1;
|
||||
c15 c15 is true c15 is false c15 is null c15 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
-0.1 1 0 0 0
|
||||
11 1 0 0 0
|
||||
select c15, c15 is not true, c15 is not false, c15 is not null, c15 is not unknown from t1;
|
||||
c15 c15 is not true c15 is not false c15 is not null c15 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
-0.1 0 1 1 1
|
||||
11 0 1 1 1
|
||||
select c16, c16 is true, c16 is false, c16 is null, c16 is unknown from t1;
|
||||
c16 c16 is true c16 is false c16 is null c16 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
0.1 1 0 0 0
|
||||
11 1 0 0 0
|
||||
select c16, c16 is not true, c16 is not false, c16 is not null, c16 is not unknown from t1;
|
||||
c16 c16 is not true c16 is not false c16 is not null c16 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
0.1 0 1 1 1
|
||||
11 0 1 1 1
|
||||
select c17, c17 is true, c17 is false, c17 is null, c17 is unknown from t1;
|
||||
c17 c17 is true c17 is false c17 is null c17 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
0 0 1 0 0
|
||||
11 1 0 0 0
|
||||
select c17, c17 is not true, c17 is not false, c17 is not null, c17 is not unknown from t1;
|
||||
c17 c17 is not true c17 is not false c17 is not null c17 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
0 1 0 1 1
|
||||
11 0 1 1 1
|
||||
select c18, c18 is true, c18 is false, c18 is null, c18 is unknown from t1;
|
||||
c18 c18 is true c18 is false c18 is null c18 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
0 0 1 0 0
|
||||
11 1 0 0 0
|
||||
select c18, c18 is not true, c18 is not false, c18 is not null, c18 is not unknown from t1;
|
||||
c18 c18 is not true c18 is not false c18 is not null c18 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
0 1 0 1 1
|
||||
11 0 1 1 1
|
||||
select c19, c19 is true, c19 is false, c19 is null, c19 is unknown from t1;
|
||||
c19 c19 is true c19 is false c19 is null c19 is unknown
|
||||
NULL 0 0 1 1
|
||||
0000-00-00 0 1 0 0
|
||||
0001-01-01 1 0 0 0
|
||||
2019-12-01 1 0 0 0
|
||||
select c19, c19 is not true, c19 is not false, c19 is not null, c19 is not unknown from t1;
|
||||
c19 c19 is not true c19 is not false c19 is not null c19 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0000-00-00 1 0 1 1
|
||||
0001-01-01 0 1 1 1
|
||||
2019-12-01 0 1 1 1
|
||||
select c20, c20 is true, c20 is false, c20 is null, c20 is unknown from t1;
|
||||
c20 c20 is true c20 is false c20 is null c20 is unknown
|
||||
0000-00-00 0 1 0 0
|
||||
0000-00-00 0 1 0 0
|
||||
0001-01-01 1 0 0 0
|
||||
2019-12-01 1 0 0 0
|
||||
select c20, c20 is not true, c20 is not false, c20 is not null, c20 is not unknown from t1;
|
||||
c20 c20 is not true c20 is not false c20 is not null c20 is not unknown
|
||||
0000-00-00 1 0 1 1
|
||||
0000-00-00 1 0 1 1
|
||||
0001-01-01 0 1 1 1
|
||||
2019-12-01 0 1 1 1
|
||||
select c21, c21 is true, c21 is false, c21 is null, c21 is unknown from t1;
|
||||
c21 c21 is true c21 is false c21 is null c21 is unknown
|
||||
NULL 0 0 1 1
|
||||
0000-00-00 00:00:00 0 1 0 0
|
||||
0001-01-01 00:00:00 1 0 0 0
|
||||
2019-12-01 12:00:00 1 0 0 0
|
||||
select c21, c21 is not true, c21 is not false, c21 is not null, c21 is not unknown from t1;
|
||||
c21 c21 is not true c21 is not false c21 is not null c21 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0000-00-00 00:00:00 1 0 1 1
|
||||
0001-01-01 00:00:00 0 1 1 1
|
||||
2019-12-01 12:00:00 0 1 1 1
|
||||
select c22, c22 is true, c22 is false, c22 is null, c22 is unknown from t1;
|
||||
c22 c22 is true c22 is false c22 is null c22 is unknown
|
||||
0000-00-00 00:00:00 0 1 0 0
|
||||
0000-00-00 00:00:00 0 1 0 0
|
||||
0001-01-01 00:00:00 1 0 0 0
|
||||
2019-12-01 12:00:00 1 0 0 0
|
||||
select c22, c22 is not true, c22 is not false, c22 is not null, c22 is not unknown from t1;
|
||||
c22 c22 is not true c22 is not false c22 is not null c22 is not unknown
|
||||
0000-00-00 00:00:00 1 0 1 1
|
||||
0000-00-00 00:00:00 1 0 1 1
|
||||
0001-01-01 00:00:00 0 1 1 1
|
||||
2019-12-01 12:00:00 0 1 1 1
|
||||
select c23, c23 is true, c23 is false, c23 is null, c23 is unknown from t1;
|
||||
c23 c23 is true c23 is false c23 is null c23 is unknown
|
||||
NULL 0 0 1 1
|
||||
0000-00-00 00:00:00 0 1 0 0
|
||||
0001-01-01 00:00:00 1 0 0 0
|
||||
2019-12-01 12:00:00 1 0 0 0
|
||||
select c23, c23 is not true, c23 is not false, c23 is not null, c23 is not unknown from t1;
|
||||
c23 c23 is not true c23 is not false c23 is not null c23 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0000-00-00 00:00:00 1 0 1 1
|
||||
0001-01-01 00:00:00 0 1 1 1
|
||||
2019-12-01 12:00:00 0 1 1 1
|
||||
select c24, c24 is true, c24 is false, c24 is null, c24 is unknown from t1;
|
||||
c24 c24 is true c24 is false c24 is null c24 is unknown
|
||||
0000-00-00 00:00:00 0 1 0 0
|
||||
0000-00-00 00:00:00 0 1 0 0
|
||||
0001-01-01 00:00:00 1 0 0 0
|
||||
2019-12-01 12:00:00 1 0 0 0
|
||||
select c24, c24 is not true, c24 is not false, c24 is not null, c24 is not unknown from t1;
|
||||
c24 c24 is not true c24 is not false c24 is not null c24 is not unknown
|
||||
0000-00-00 00:00:00 1 0 1 1
|
||||
0000-00-00 00:00:00 1 0 1 1
|
||||
0001-01-01 00:00:00 0 1 1 1
|
||||
2019-12-01 12:00:00 0 1 1 1
|
||||
select c25, c25 is true, c25 is false, c25 is null, c25 is unknown from t1;
|
||||
c25 c25 is true c25 is false c25 is null c25 is unknown
|
||||
NULL 0 0 1 1
|
||||
0 0 1 0 0
|
||||
1 1 0 0 0
|
||||
11 1 0 0 0
|
||||
select c25, c25 is not true, c25 is not false, c25 is not null, c25 is not unknown from t1;
|
||||
c25 c25 is not true c25 is not false c25 is not null c25 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0 1 0 1 1
|
||||
1 0 1 1 1
|
||||
11 0 1 1 1
|
||||
select c26, c26 is true, c26 is false, c26 is null, c26 is unknown from t1;
|
||||
c26 c26 is true c26 is false c26 is null c26 is unknown
|
||||
NULL 0 0 1 1
|
||||
0.0 0 1 0 0
|
||||
1.0 1 0 0 0
|
||||
11.0 1 0 0 0
|
||||
select c26, c26 is not true, c26 is not false, c26 is not null, c26 is not unknown from t1;
|
||||
c26 c26 is not true c26 is not false c26 is not null c26 is not unknown
|
||||
NULL 1 1 0 0
|
||||
0.0 1 0 1 1
|
||||
1.0 0 1 1 1
|
||||
11.0 0 1 1 1
|
||||
drop table t1;
|
||||
connection conn_admin;
|
@ -1,23 +0,0 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select is_serving_tenant(host_ip(), rpc_port(), effective_tenant_id());
|
||||
is_serving_tenant(host_ip(), rpc_port(), effective_tenant_id())
|
||||
1
|
||||
select is_serving_tenant(host_ip(), rpc_port(), 1);
|
||||
is_serving_tenant(host_ip(), rpc_port(), 1)
|
||||
1
|
||||
select is_serving_tenant(host_ip(), rpc_port(), 888);
|
||||
is_serving_tenant(host_ip(), rpc_port(), 888)
|
||||
0
|
||||
select is_serving_tenant('abc', rpc_port(), effective_tenant_id());
|
||||
is_serving_tenant('abc', rpc_port(), effective_tenant_id())
|
||||
0
|
||||
select is_serving_tenant('abc', rpc_port(), 1);
|
||||
is_serving_tenant('abc', rpc_port(), 1)
|
||||
1
|
||||
select is_serving_tenant('abc', rpc_port(), 888);
|
||||
is_serving_tenant('abc', rpc_port(), 888)
|
||||
0
|
||||
connection syscon;
|
@ -1,143 +0,0 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,oceanbase,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
connection default;
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 int, c2 int unsigned,
|
||||
c3 tinyint, c4 tinyint unsigned,
|
||||
c5 bigint, c6 bigint unsigned,
|
||||
c7 float, c8 float unsigned,
|
||||
c9 double, c10 double unsigned,
|
||||
c11 decimal, c12 decimal unsigned,
|
||||
c13 date, c14 datetime, c15 timestamp,
|
||||
c16 varchar(30), c17 char(30));
|
||||
select * from t1;
|
||||
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17
|
||||
insert into t1 values(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null);
|
||||
insert into t1 values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0000-00-00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '');
|
||||
insert into t1 values(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, '0013-01-01', '0014-01-01', '0015-01-01', '16', '17');
|
||||
insert into t1 values(-1, 2, -3, 4, -5, 6, -7, 8, -9, 10, -11, 12, '0013-01-01', '0014-01-01 00:00:00', '0015-01-01 00:00:00', '-16', '-17');
|
||||
insert into t1 values(1234567, 7654321, -33, 44, 555555555, 666666666, 777.777, 8888.888, 99999.999999, 10000.00000, 1111, 121212121, '0013-01-01', '0014-01-01 00:00:11', '0015-01-01 00:00:11', 'sadfsadfdsafasasdf', 'asdffdsafadsfdsafsad');
|
||||
connection conn_admin;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select c1, length(c1) from t1;
|
||||
c1 length(c1)
|
||||
NULL NULL
|
||||
0 1
|
||||
1 1
|
||||
-1 2
|
||||
1234567 7
|
||||
select c2, length(c2) from t1;
|
||||
c2 length(c2)
|
||||
NULL NULL
|
||||
0 1
|
||||
2 1
|
||||
2 1
|
||||
7654321 7
|
||||
select c3, length(c3) from t1;
|
||||
c3 length(c3)
|
||||
NULL NULL
|
||||
0 1
|
||||
3 1
|
||||
-3 2
|
||||
-33 3
|
||||
select c4, length(c4) from t1;
|
||||
c4 length(c4)
|
||||
NULL NULL
|
||||
0 1
|
||||
4 1
|
||||
4 1
|
||||
44 2
|
||||
select c5, length(c5) from t1;
|
||||
c5 length(c5)
|
||||
NULL NULL
|
||||
0 1
|
||||
5 1
|
||||
-5 2
|
||||
555555555 9
|
||||
select c6, length(c6) from t1;
|
||||
c6 length(c6)
|
||||
NULL NULL
|
||||
0 1
|
||||
6 1
|
||||
6 1
|
||||
666666666 9
|
||||
select c7, length(c7) from t1;
|
||||
c7 length(c7)
|
||||
NULL NULL
|
||||
0 1
|
||||
7 1
|
||||
-7 2
|
||||
777.777 7
|
||||
select c8, length(c8) from t1;
|
||||
c8 length(c8)
|
||||
NULL NULL
|
||||
0 1
|
||||
8 1
|
||||
8 1
|
||||
8888.89 7
|
||||
select c9, length(c9) from t1;
|
||||
c9 length(c9)
|
||||
NULL NULL
|
||||
0 1
|
||||
9 1
|
||||
-9 2
|
||||
99999.999999 12
|
||||
select c10, length(c10) from t1;
|
||||
c10 length(c10)
|
||||
NULL NULL
|
||||
0 1
|
||||
10 2
|
||||
10 2
|
||||
10000 5
|
||||
select c11, length(c11) from t1;
|
||||
c11 length(c11)
|
||||
NULL NULL
|
||||
0 1
|
||||
11 2
|
||||
-11 3
|
||||
1111 4
|
||||
select c12, length(c12) from t1;
|
||||
c12 length(c12)
|
||||
NULL NULL
|
||||
0 1
|
||||
12 2
|
||||
12 2
|
||||
121212121 9
|
||||
select c13, length(c13) from t1;
|
||||
c13 length(c13)
|
||||
NULL NULL
|
||||
0000-00-00 10
|
||||
0013-01-01 10
|
||||
0013-01-01 10
|
||||
0013-01-01 10
|
||||
select c14, length(c14) from t1;
|
||||
c14 length(c14)
|
||||
NULL NULL
|
||||
0000-00-00 00:00:00 19
|
||||
0014-01-01 00:00:00 19
|
||||
0014-01-01 00:00:00 19
|
||||
0014-01-01 00:00:11 19
|
||||
select c15, length(c15) from t1;
|
||||
c15 length(c15)
|
||||
NULL NULL
|
||||
0000-00-00 00:00:00 19
|
||||
0015-01-01 00:00:00 19
|
||||
0015-01-01 00:00:00 19
|
||||
0015-01-01 00:00:11 19
|
||||
select c16, length(c16) from t1;
|
||||
c16 length(c16)
|
||||
NULL NULL
|
||||
0
|
||||
16 2
|
||||
-16 3
|
||||
sadfsadfdsafasasdf 18
|
||||
select c17, length(c17) from t1;
|
||||
c17 length(c17)
|
||||
NULL NULL
|
||||
0
|
||||
17 2
|
||||
-17 3
|
||||
asdffdsafadsfdsafsad 20
|
||||
drop table t1;
|
||||
connection conn_admin;
|
@ -1,20 +0,0 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select lnnvl(1) from dual;
|
||||
lnnvl(1)
|
||||
0
|
||||
select lnnvl(-1) from dual;
|
||||
lnnvl(-1)
|
||||
0
|
||||
select lnnvl(0) from dual;
|
||||
lnnvl(0)
|
||||
1
|
||||
select lnnvl(NULL) from dual;
|
||||
lnnvl(NULL)
|
||||
1
|
||||
select lnnvl('abc') from dual;
|
||||
lnnvl('abc')
|
||||
1
|
||||
connection syscon;
|
@ -1,64 +0,0 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,oceanbase,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
// locate(substr, oristr), instr(oristr, substr)
|
||||
select locate(null, 'a'), locate('a', null), locate('a', 'a', null);
|
||||
locate(null, 'a') locate('a', null) locate('a', 'a', null)
|
||||
NULL NULL 0
|
||||
select locate('abc', 'a'), instr('abc', 'a');
|
||||
locate('abc', 'a') instr('abc', 'a')
|
||||
0 1
|
||||
select locate('a', 'aaaa', 1), locate('a', 'aaaa', 0), locate('a', 'aaaa', -1);
|
||||
locate('a', 'aaaa', 1) locate('a', 'aaaa', 0) locate('a', 'aaaa', -1)
|
||||
1 0 0
|
||||
select locate('a', 'aaaa', '1.9'), locate('a', 'aaaa', '0.9'), locate('a', 'aaaa', '-1.9');
|
||||
locate('a', 'aaaa', '1.9') locate('a', 'aaaa', '0.9') locate('a', 'aaaa', '-1.9')
|
||||
1 0 0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: '1.9'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '0.9'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-1.9'
|
||||
select locate('a', 'aaaa', '1.1'), locate('a', 'aaaa', '0.1'), locate('a', 'aaaa', '-1.1');
|
||||
locate('a', 'aaaa', '1.1') locate('a', 'aaaa', '0.1') locate('a', 'aaaa', '-1.1')
|
||||
1 0 0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: '1.1'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '0.1'
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-1.1'
|
||||
select locate('中', 'a中测试', 1);
|
||||
locate('中', 'a中测试', 1)
|
||||
2
|
||||
select locate('a', 'abcdabcd', '2.a');
|
||||
locate('a', 'abcdabcd', '2.a')
|
||||
5
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: '2.a'
|
||||
select locate('a', 'abcdabcd', 'a');
|
||||
locate('a', 'abcdabcd', 'a')
|
||||
0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: 'a'
|
||||
select locate('a', 'abcdabcd', '-2.a');
|
||||
locate('a', 'abcdabcd', '-2.a')
|
||||
0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: '-2.a'
|
||||
select locate('a', 'a', 10000);
|
||||
locate('a', 'a', 10000)
|
||||
0
|
||||
select locate('a', 'a', 1000000000000000000000000000000000000000000000000000000000000000);
|
||||
locate('a', 'a', 1000000000000000000000000000000000000000000000000000000000000000)
|
||||
0
|
||||
select instr('abc', 'a'), instr('aaaa','a'), instr('a中测试', '中'), instr(null, 'a'), instr('a', null);
|
||||
instr('abc', 'a') instr('aaaa','a') instr('a中测试', '中') instr(null, 'a') instr('a', null)
|
||||
1 1 2 NULL NULL
|
||||
select reverse(''), reverse(null), reverse('你好abc中文'), reverse(12345.123), reverse(null);
|
||||
reverse('') reverse(null) reverse('你好abc中文') reverse(12345.123) reverse(null)
|
||||
NULL 文中cba好你 321.54321 NULL
|
||||
drop table if exists t1;
|
||||
create table t1(c1 bigint unsigned);
|
||||
insert into t1 values(locate('a','b',9223372036854775808));
|
||||
select * from t1;
|
||||
c1
|
||||
0
|
||||
drop table t1;
|
@ -1,143 +0,0 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,oceanbase,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
connection default;
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 int, c2 int unsigned,
|
||||
c3 tinyint, c4 tinyint unsigned,
|
||||
c5 bigint, c6 bigint unsigned,
|
||||
c7 float, c8 float unsigned,
|
||||
c9 double, c10 double unsigned,
|
||||
c11 decimal, c12 decimal unsigned,
|
||||
c13 date, c14 datetime, c15 timestamp,
|
||||
c16 varchar(60), c17 char(60));
|
||||
select * from t1;
|
||||
c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17
|
||||
insert into t1 values(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null);
|
||||
insert into t1 values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '0000-00-00', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '');
|
||||
insert into t1 values(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, '0013-01-01', '0014-01-01', '0015-01-01', '16abcDeFG00', '16abcDeFG00');
|
||||
insert into t1 values(-1, 2, -3, 4, -5, 6, -7, 8, -9, 10, -11, 12, '0013-01-01', '0014-01-01 00:00:00', '0015-01-01 00:00:00', '=[]-+,/;<>?.*~!@#$%^&*()', '=[]-+,/;<>?.*~!@#$%^&*()');
|
||||
insert into t1 values(1234567, 7654321, -33, 44, 555555555, 666666666, 777.777, 8888.888, 99999.999999, 10000.00000, 1111, 121212121, '0013-01-01', '0014-01-01 00:00:11', '0015-01-01 00:00:11', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ');
|
||||
connection conn_admin;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select c1, lower(c1), upper(c1) from t1;
|
||||
c1 lower(c1) upper(c1)
|
||||
NULL NULL NULL
|
||||
0 0 0
|
||||
1 1 1
|
||||
-1 -1 -1
|
||||
1234567 1234567 1234567
|
||||
select c2, lower(c2), upper(c2) from t1;
|
||||
c2 lower(c2) upper(c2)
|
||||
NULL NULL NULL
|
||||
0 0 0
|
||||
2 2 2
|
||||
2 2 2
|
||||
7654321 7654321 7654321
|
||||
select c3, lower(c3), upper(c3) from t1;
|
||||
c3 lower(c3) upper(c3)
|
||||
NULL NULL NULL
|
||||
0 0 0
|
||||
3 3 3
|
||||
-3 -3 -3
|
||||
-33 -33 -33
|
||||
select c4, lower(c4), upper(c4) from t1;
|
||||
c4 lower(c4) upper(c4)
|
||||
NULL NULL NULL
|
||||
0 0 0
|
||||
4 4 4
|
||||
4 4 4
|
||||
44 44 44
|
||||
select c5, lower(c5), upper(c5) from t1;
|
||||
c5 lower(c5) upper(c5)
|
||||
NULL NULL NULL
|
||||
0 0 0
|
||||
5 5 5
|
||||
-5 -5 -5
|
||||
555555555 555555555 555555555
|
||||
select c6, lower(c6), upper(c6) from t1;
|
||||
c6 lower(c6) upper(c6)
|
||||
NULL NULL NULL
|
||||
0 0 0
|
||||
6 6 6
|
||||
6 6 6
|
||||
666666666 666666666 666666666
|
||||
select c7, lower(c7), upper(c7) from t1;
|
||||
c7 lower(c7) upper(c7)
|
||||
NULL NULL NULL
|
||||
0 0 0
|
||||
7 7 7
|
||||
-7 -7 -7
|
||||
777.777 777.777 777.777
|
||||
select c8, lower(c8), upper(c8) from t1;
|
||||
c8 lower(c8) upper(c8)
|
||||
NULL NULL NULL
|
||||
0 0 0
|
||||
8 8 8
|
||||
8 8 8
|
||||
8888.89 8888.89 8888.89
|
||||
select c9, lower(c9), upper(c9) from t1;
|
||||
c9 lower(c9) upper(c9)
|
||||
NULL NULL NULL
|
||||
0 0 0
|
||||
9 9 9
|
||||
-9 -9 -9
|
||||
99999.999999 99999.999999 99999.999999
|
||||
select c10, lower(c10), upper(c10) from t1;
|
||||
c10 lower(c10) upper(c10)
|
||||
NULL NULL NULL
|
||||
0 0 0
|
||||
10 10 10
|
||||
10 10 10
|
||||
10000 10000 10000
|
||||
select c11, lower(c11), upper(c11) from t1;
|
||||
c11 lower(c11) upper(c11)
|
||||
NULL NULL NULL
|
||||
0 0 0
|
||||
11 11 11
|
||||
-11 -11 -11
|
||||
1111 1111 1111
|
||||
select c12, lower(c12), upper(c12) from t1;
|
||||
c12 lower(c12) upper(c12)
|
||||
NULL NULL NULL
|
||||
0 0 0
|
||||
12 12 12
|
||||
12 12 12
|
||||
121212121 121212121 121212121
|
||||
select c13, lower(c13), upper(c13) from t1;
|
||||
c13 lower(c13) upper(c13)
|
||||
NULL NULL NULL
|
||||
0000-00-00 0000-00-00 0000-00-00
|
||||
0013-01-01 0013-01-01 0013-01-01
|
||||
0013-01-01 0013-01-01 0013-01-01
|
||||
0013-01-01 0013-01-01 0013-01-01
|
||||
select c14, lower(c14), upper(c14) from t1;
|
||||
c14 lower(c14) upper(c14)
|
||||
NULL NULL NULL
|
||||
0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00
|
||||
0014-01-01 00:00:00 0014-01-01 00:00:00 0014-01-01 00:00:00
|
||||
0014-01-01 00:00:00 0014-01-01 00:00:00 0014-01-01 00:00:00
|
||||
0014-01-01 00:00:11 0014-01-01 00:00:11 0014-01-01 00:00:11
|
||||
select c15, lower(c15), upper(c15) from t1;
|
||||
c15 lower(c15) upper(c15)
|
||||
NULL NULL NULL
|
||||
0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00
|
||||
0015-01-01 00:00:00 0015-01-01 00:00:00 0015-01-01 00:00:00
|
||||
0015-01-01 00:00:00 0015-01-01 00:00:00 0015-01-01 00:00:00
|
||||
0015-01-01 00:00:11 0015-01-01 00:00:11 0015-01-01 00:00:11
|
||||
select c16, lower(c16), upper(c16) from t1;
|
||||
c16 lower(c16) upper(c16)
|
||||
NULL NULL NULL
|
||||
|
||||
16abcDeFG00 16abcdefg00 16ABCDEFG00
|
||||
=[]-+,/;<>?.*~!@#$%^&*() =[]-+,/;<>?.*~!@#$%^&*() =[]-+,/;<>?.*~!@#$%^&*()
|
||||
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ
|
||||
select c17, lower(c17), upper(c17) from t1;
|
||||
c17 lower(c17) upper(c17)
|
||||
NULL NULL NULL
|
||||
|
||||
16abcDeFG00 16abcdefg00 16ABCDEFG00
|
||||
=[]-+,/;<>?.*~!@#$%^&*() =[]-+,/;<>?.*~!@#$%^&*() =[]-+,/;<>?.*~!@#$%^&*()
|
||||
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ
|
||||
drop table t1;
|
||||
connection conn_admin;
|
@ -1,172 +0,0 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,oceanbase,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
alter system flush plan cache global;
|
||||
connection default;
|
||||
drop table if exists t;
|
||||
create table t (t1 tinyint,
|
||||
t2 smallint,
|
||||
t3 mediumint,
|
||||
t4 integer,
|
||||
t5 bigint,
|
||||
t6 tinyint unsigned,
|
||||
t7 smallint unsigned,
|
||||
t8 mediumint unsigned,
|
||||
t9 integer unsigned,
|
||||
t10 bigint unsigned,
|
||||
t11 float,
|
||||
t12 float unsigned,
|
||||
t13 double,
|
||||
t14 double unsigned,
|
||||
t15 number,
|
||||
t16 number unsigned,
|
||||
t17 datetime,
|
||||
t18 timestamp,
|
||||
t19 date,
|
||||
t20 time,
|
||||
t21 year,
|
||||
t22 varchar(255),
|
||||
t23 char(255),
|
||||
t24 tinytext,
|
||||
t25 mediumtext,
|
||||
t26 longtext,
|
||||
t27 bit,
|
||||
t28 enum('a', 'b', 'c'),
|
||||
t29 set('a', 'b', 'c'));
|
||||
insert into t values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7,
|
||||
'1993-03-20', '1993-03-20', '1993-03-20', '10:10:10', '1993', '0.8', '0.9', '1.0', '1.1',
|
||||
'1.2', 1, 'b', 'b');
|
||||
insert into t(t1) values (null);
|
||||
connection conn_admin;
|
||||
alter system flush plan cache global;
|
||||
connection default;
|
||||
set ob_enable_plan_cache = false;
|
||||
select not 1 from dual;
|
||||
not 1
|
||||
0
|
||||
select not 1.0 from dual;
|
||||
not 1.0
|
||||
0
|
||||
select not null from dual;
|
||||
not null
|
||||
NULL
|
||||
select not 'hello' from dual;
|
||||
not 'hello'
|
||||
1
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'hello'
|
||||
select not t1 from t;
|
||||
not t1
|
||||
0
|
||||
NULL
|
||||
select not t2 from t;
|
||||
not t2
|
||||
0
|
||||
NULL
|
||||
select not t3 from t;
|
||||
not t3
|
||||
0
|
||||
NULL
|
||||
select not t4 from t;
|
||||
not t4
|
||||
0
|
||||
NULL
|
||||
select not t5 from t;
|
||||
not t5
|
||||
0
|
||||
NULL
|
||||
select not t6 from t;
|
||||
not t6
|
||||
0
|
||||
NULL
|
||||
select not t7 from t;
|
||||
not t7
|
||||
0
|
||||
NULL
|
||||
select not t8 from t;
|
||||
not t8
|
||||
0
|
||||
NULL
|
||||
select not t9 from t;
|
||||
not t9
|
||||
0
|
||||
NULL
|
||||
select not t10 from t;
|
||||
not t10
|
||||
0
|
||||
NULL
|
||||
select not t11 from t;
|
||||
not t11
|
||||
0
|
||||
NULL
|
||||
select not t12 from t;
|
||||
not t12
|
||||
0
|
||||
NULL
|
||||
select not t13 from t;
|
||||
not t13
|
||||
0
|
||||
NULL
|
||||
select not t14 from t;
|
||||
not t14
|
||||
0
|
||||
NULL
|
||||
select not t15 from t;
|
||||
not t15
|
||||
0
|
||||
NULL
|
||||
select not t16 from t;
|
||||
not t16
|
||||
0
|
||||
NULL
|
||||
select not t17 from t;
|
||||
not t17
|
||||
0
|
||||
NULL
|
||||
select not t18 from t;
|
||||
not t18
|
||||
0
|
||||
NULL
|
||||
select not t19 from t;
|
||||
not t19
|
||||
0
|
||||
NULL
|
||||
select not t20 from t;
|
||||
not t20
|
||||
0
|
||||
NULL
|
||||
select not t21 from t;
|
||||
not t21
|
||||
0
|
||||
NULL
|
||||
select not t22 from t;
|
||||
not t22
|
||||
0
|
||||
NULL
|
||||
select not t23 from t;
|
||||
not t23
|
||||
0
|
||||
NULL
|
||||
select not t24 from t;
|
||||
not t24
|
||||
0
|
||||
NULL
|
||||
select not t25 from t;
|
||||
not t25
|
||||
0
|
||||
NULL
|
||||
select not t26 from t;
|
||||
not t26
|
||||
0
|
||||
NULL
|
||||
select not t27 from t;
|
||||
not t27
|
||||
0
|
||||
NULL
|
||||
select not t28 from t;
|
||||
not t28
|
||||
0
|
||||
NULL
|
||||
select not t29 from t;
|
||||
not t29
|
||||
0
|
||||
NULL
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,25 +0,0 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection default;
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 int, c2 bigint, c3 decimal);
|
||||
insert into t1 (c1, c2, c3) values (1, NULL, 1);
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select c1, partition_hash(c1) from t1;
|
||||
c1 partition_hash(c1)
|
||||
1 1
|
||||
select c2, partition_hash(c2) from t1;
|
||||
c2 partition_hash(c2)
|
||||
NULL 0
|
||||
select c3, partition_hash(c3) from t1;
|
||||
ERROR HY000: The PARTITION function returns the wrong type
|
||||
select partition_hash(c1, c2) from t1;
|
||||
ERROR HY000: Internal error
|
||||
select partition_hash(10) from t1;
|
||||
partition_hash(10)
|
||||
10
|
||||
select partition_hash(-10) from t1;
|
||||
partition_hash(-10)
|
||||
10
|
||||
connection syscon;
|
@ -1,76 +0,0 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection syscon;
|
||||
connection default;
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 int, c2 bigint, c3 decimal, c4 char(20), c5 varchar(20), c6 date, c7 datetime, c8 timestamp);
|
||||
insert into t1 (c1, c2, c3, c4, c5, c6, c7, c8) values (1, NULL, 1, "abc ", "abc ", '2020-01-01', '2020-01-01 01:01:01', '2020-01-01 01:01:01');
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select c1, partition_key(c1) from t1;
|
||||
c1 partition_key(c1)
|
||||
1 294837134935570197
|
||||
select c2, partition_key(c2) from t1;
|
||||
c2 partition_key(c2)
|
||||
NULL 6960269033020761575
|
||||
select c3, partition_key(c3) from t1;
|
||||
c3 partition_key(c3)
|
||||
1 4095890315155992887
|
||||
select c4, partition_key(c4) from t1;
|
||||
c4 partition_key(c4)
|
||||
abc 1801346201538688951
|
||||
select c5, partition_key(c5) from t1;
|
||||
c5 partition_key(c5)
|
||||
abc 1801346201538688951
|
||||
select c6, partition_key(c6) from t1;
|
||||
c6 partition_key(c6)
|
||||
2020-01-01 3780289746228831367
|
||||
select c7, partition_key(c7) from t1;
|
||||
c7 partition_key(c7)
|
||||
2020-01-01 01:01:01 6488855144877179734
|
||||
select c8, partition_key(c8) from t1;
|
||||
c8 partition_key(c8)
|
||||
2020-01-01 01:01:01 6375794890780556234
|
||||
select partition_key(c1, c2) from t1;
|
||||
partition_key(c1, c2)
|
||||
319562542098195289
|
||||
select partition_key(c1, c2, c3) from t1;
|
||||
partition_key(c1, c2, c3)
|
||||
3093204954362125526
|
||||
select partition_key(c1, c3) from t1;
|
||||
partition_key(c1, c3)
|
||||
9006715823204485749
|
||||
select c1, partition_key_v2(c1) from t1;
|
||||
c1 partition_key_v2(c1)
|
||||
1 8089716718896805586
|
||||
select c2, partition_key_v2(c2) from t1;
|
||||
c2 partition_key_v2(c2)
|
||||
NULL 6960269033020761575
|
||||
select c3, partition_key_v2(c3) from t1;
|
||||
c3 partition_key_v2(c3)
|
||||
1 5958971315933813165
|
||||
select c4, partition_key_v2(c4) from t1;
|
||||
c4 partition_key_v2(c4)
|
||||
abc 258901174748407223
|
||||
select c5, partition_key_v2(c5) from t1;
|
||||
c5 partition_key_v2(c5)
|
||||
abc 258901174748407223
|
||||
select c6, partition_key_v2(c6) from t1;
|
||||
c6 partition_key_v2(c6)
|
||||
2020-01-01 5558489265225801925
|
||||
select c7, partition_key_v2(c7) from t1;
|
||||
c7 partition_key_v2(c7)
|
||||
2020-01-01 01:01:01 3406840642020255355
|
||||
select c8, partition_key_v2(c8) from t1;
|
||||
c8 partition_key_v2(c8)
|
||||
2020-01-01 01:01:01 8121525409574338685
|
||||
select partition_key_v2(c1, c2) from t1;
|
||||
partition_key_v2(c1, c2)
|
||||
3042015303219230768
|
||||
select partition_key_v2(c1, c2, c3) from t1;
|
||||
partition_key_v2(c1, c2, c3)
|
||||
2899520937750054785
|
||||
select partition_key_v2(c1, c3) from t1;
|
||||
partition_key_v2(c1, c3)
|
||||
4685265492491719863
|
||||
connection syscon;
|
@ -1,42 +0,0 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection default;
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 varchar(50), c2 varchar(50));
|
||||
insert into t1 (c1, c2) values ('abc1', '^abc[0-9]?$');
|
||||
insert into t1 (c1, c2) values ('abc1', '^abd');
|
||||
drop table if exists t2;
|
||||
create table t2 (a varchar(50));
|
||||
insert into t2 values ("abc1");
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select 'abcdef' regexp '^abc.*';
|
||||
'abcdef' regexp '^abc.*'
|
||||
1
|
||||
select 'abcdef' regexp '^abd.*';
|
||||
'abcdef' regexp '^abd.*'
|
||||
0
|
||||
select '' regexp '^$';
|
||||
'' regexp '^$'
|
||||
1
|
||||
select 'a' regexp '';
|
||||
ERROR 42000: Got error 'empty (sub)expression' from regexp
|
||||
select NULL regexp 'a';
|
||||
NULL regexp 'a'
|
||||
NULL
|
||||
select 'a' regexp NULL;
|
||||
'a' regexp NULL
|
||||
NULL
|
||||
select c2, c2 regexp 'abc' from t1;
|
||||
c2 c2 regexp 'abc'
|
||||
^abc[0-9]?$ 1
|
||||
^abd 0
|
||||
select c2, (select a regexp c2 from t2) from t1;
|
||||
c2 (select a regexp c2 from t2)
|
||||
^abc[0-9]?$ 1
|
||||
^abd 0
|
||||
select c1, c2, c1 regexp c2 from t1;
|
||||
c1 c2 c1 regexp c2
|
||||
abc1 ^abc[0-9]?$ 1
|
||||
abc1 ^abd 0
|
||||
connection syscon;
|
@ -1,165 +0,0 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select regexp_like('abc', 'a.*') from dual;
|
||||
regexp_like('abc', 'a.*')
|
||||
1
|
||||
select regexp_like('abc', 'a.* ') from dual;
|
||||
regexp_like('abc', 'a.* ')
|
||||
0
|
||||
select regexp_like('abc', 'a.* ', NULL) from dual;
|
||||
regexp_like('abc', 'a.* ', NULL)
|
||||
NULL
|
||||
select regexp_like('abc', 'a.* ', 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_like('abc', NULL) from dual;
|
||||
regexp_like('abc', NULL)
|
||||
NULL
|
||||
select regexp_like(NULL, 'a.*') from dual;
|
||||
regexp_like(NULL, 'a.*')
|
||||
NULL
|
||||
select regexp_like(123, 123) from dual;
|
||||
regexp_like(123, 123)
|
||||
1
|
||||
select regexp_like('我是好人', '.是.*') from dual;
|
||||
regexp_like('我是好人', '.是.*')
|
||||
1
|
||||
select regexp_instr('abcadef', 'a.') from dual;
|
||||
regexp_instr('abcadef', 'a.')
|
||||
1
|
||||
select regexp_instr('abcadef', 'a.', 1, 2) from dual;
|
||||
regexp_instr('abcadef', 'a.', 1, 2)
|
||||
4
|
||||
select regexp_instr('abcadef', 'a.', 1, 2, 0) from dual;
|
||||
regexp_instr('abcadef', 'a.', 1, 2, 0)
|
||||
4
|
||||
select regexp_instr('abcadef', 'a.', 1, 2, 1) from dual;
|
||||
regexp_instr('abcadef', 'a.', 1, 2, 1)
|
||||
6
|
||||
select regexp_instr('abcadef', 'a.', 0, 2, 1) from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_instr('abcadef', 'a.', 1, 0, 1) from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_instr('abcadef', 'a.', 1, 2, -1) from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_instr('abcadef', 'a.', 100, 2) from dual;
|
||||
regexp_instr('abcadef', 'a.', 100, 2)
|
||||
0
|
||||
select regexp_instr('abcadef', 'a.', 1, 200) from dual;
|
||||
regexp_instr('abcadef', 'a.', 1, 200)
|
||||
0
|
||||
select regexp_instr('abcadef', 'a. ', 1, 2, 1, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_instr('', 'a. ', 1, 2, 1, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_instr('abcadef', '', 1, 2, 1, 'x') from dual;
|
||||
ERROR 42000: Got error 'empty (sub)expression' from regexp
|
||||
select regexp_instr('abcadef', 'a. ', NULL, 2, 1, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_instr('abcadef', 'a. ', 1, NULL, 1, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_instr('abcadef', 'a. ', 1, 2, NULL, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_instr('abcadef', 'a. ', 1, 2, 1, NULL) from dual;
|
||||
regexp_instr('abcadef', 'a. ', 1, 2, 1, NULL)
|
||||
NULL
|
||||
select regexp_instr(12341834, 1.3, '1', '2', 1) from dual;
|
||||
regexp_instr(12341834, 1.3, '1', '2', 1)
|
||||
8
|
||||
select regexp_instr('我是好人', '是.') from dual;
|
||||
regexp_instr('我是好人', '是.')
|
||||
2
|
||||
select regexp_substr('abcadef', 'a.', 1) from dual;
|
||||
regexp_substr('abcadef', 'a.', 1)
|
||||
ab
|
||||
select regexp_substr('abcadef', 'a.', 1, 2) from dual;
|
||||
regexp_substr('abcadef', 'a.', 1, 2)
|
||||
ad
|
||||
select regexp_substr('abcadef', 'a.', 0, 2) from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_substr('abcadef', 'a.', 1, 0) from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_substr('abcadef', 'a.', 10, 2) from dual;
|
||||
regexp_substr('abcadef', 'a.', 10, 2)
|
||||
NULL
|
||||
select regexp_substr('abcadef', 'a.', 1, 10) from dual;
|
||||
regexp_substr('abcadef', 'a.', 1, 10)
|
||||
NULL
|
||||
select regexp_substr('abcadef', 'a. ', 1, 2, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_substr('', 'a. ', 1, 2, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_substr('abcadef', '', 1, 2, 'x') from dual;
|
||||
ERROR 42000: Got error 'empty (sub)expression' from regexp
|
||||
select regexp_substr('abcadef', 'a. ', NULL, 2, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_substr('abcadef', 'a. ', 1, NULL, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_substr('abcadef', 'a. ', 1, 2, NULL) from dual;
|
||||
regexp_substr('abcadef', 'a. ', 1, 2, NULL)
|
||||
NULL
|
||||
select regexp_substr(12341834, 1.3, '1.9', '2') from dual;
|
||||
regexp_substr(12341834, 1.3, '1.9', '2')
|
||||
183
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect INTEGER value: '1.9'
|
||||
select regexp_replace('我是好人', '是.') from dual;
|
||||
regexp_replace('我是好人', '是.')
|
||||
我人
|
||||
select regexp_replace('abcadef', 'a.') from dual;
|
||||
regexp_replace('abcadef', 'a.')
|
||||
cef
|
||||
select regexp_replace('abcadef', 'a.*') from dual;
|
||||
regexp_replace('abcadef', 'a.*')
|
||||
|
||||
select regexp_replace('abcadef', 'a.', 'X') from dual;
|
||||
regexp_replace('abcadef', 'a.', 'X')
|
||||
XcXef
|
||||
select regexp_replace('abcadef', 'a.', 'X', 1) from dual;
|
||||
regexp_replace('abcadef', 'a.', 'X', 1)
|
||||
XcXef
|
||||
select regexp_replace('abcadef', 'a.', 'X', 1, 2) from dual;
|
||||
regexp_replace('abcadef', 'a.', 'X', 1, 2)
|
||||
abcXef
|
||||
select regexp_replace('abcadef', 'a.', 'X', 2, 1) from dual;
|
||||
regexp_replace('abcadef', 'a.', 'X', 2, 1)
|
||||
abcXef
|
||||
select regexp_replace('abcadef', 'a.', 'X', 2, 2) from dual;
|
||||
regexp_replace('abcadef', 'a.', 'X', 2, 2)
|
||||
abcadef
|
||||
select regexp_replace('abcadef', 'a.', 'X', 1, 0) from dual;
|
||||
regexp_replace('abcadef', 'a.', 'X', 1, 0)
|
||||
XcXef
|
||||
select regexp_replace('abcadef', 'a.', 'X', 1, -1) from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_replace('abcadef', 'a.', 'X', 10, 2) from dual;
|
||||
regexp_replace('abcadef', 'a.', 'X', 10, 2)
|
||||
abcadef
|
||||
select regexp_replace('abcadef', 'a.', 'X', 1, 100) from dual;
|
||||
regexp_replace('abcadef', 'a.', 'X', 1, 100)
|
||||
abcadef
|
||||
select regexp_replace('abcadef', 'a. ', 'X', 1, 2) from dual;
|
||||
regexp_replace('abcadef', 'a. ', 'X', 1, 2)
|
||||
abcadef
|
||||
select regexp_replace('abcadef', 'a. ', 'X', 1, 2, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_replace('', 'a. ', 'X', 1, 2, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_replace('abcadef', '', 'X', 1, 2, 'x') from dual;
|
||||
ERROR 42000: Got error 'empty (sub)expression' from regexp
|
||||
select regexp_replace('abcadef', 'a. ', NULL, 1, 2, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_replace('abcadef', 'a. ', 'X', NULL, 2, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_replace('abcadef', 'a. ', 'X', 1, NULL, 'x') from dual;
|
||||
ERROR HY000: Invalid argument
|
||||
select regexp_replace('abcadef', 'a. ', 'X', 1, 2, NULL) from dual;
|
||||
regexp_replace('abcadef', 'a. ', 'X', 1, 2, NULL)
|
||||
NULL
|
||||
select regexp_replace(12341834, 1.3, 99, '1', '2') from dual;
|
||||
regexp_replace(12341834, 1.3, 99, '1', '2')
|
||||
1234994
|
||||
select regexp_replace('我是好人', '是.', '.....') from dual;
|
||||
regexp_replace('我是好人', '是.', '.....')
|
||||
我.....人
|
||||
connection syscon;
|
@ -1,44 +0,0 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select repeat("abc", -1);
|
||||
repeat("abc", -1)
|
||||
|
||||
select repeat("abc", 0);
|
||||
repeat("abc", 0)
|
||||
|
||||
select repeat("abc", 1);
|
||||
repeat("abc", 1)
|
||||
abc
|
||||
select repeat("abc", 2);
|
||||
repeat("abc", 2)
|
||||
abcabc
|
||||
select repeat("abc", 3);
|
||||
repeat("abc", 3)
|
||||
abcabcabc
|
||||
select repeat("abc", "2.1");
|
||||
repeat("abc", "2.1")
|
||||
abcabc
|
||||
select repeat("abc", "2.9");
|
||||
repeat("abc", "2.9")
|
||||
abcabc
|
||||
select repeat("", 2);
|
||||
repeat("", 2)
|
||||
|
||||
select repeat(NULL, 2);
|
||||
repeat(NULL, 2)
|
||||
NULL
|
||||
select repeat("abc", NULL);
|
||||
repeat("abc", NULL)
|
||||
NULL
|
||||
select repeat(1.414, 1);
|
||||
repeat(1.414, 1)
|
||||
1.414
|
||||
select repeat(1.414, 2);
|
||||
repeat(1.414, 2)
|
||||
1.4141.414
|
||||
select repeat("abc", 200000000);
|
||||
repeat("abc", 200000000)
|
||||
NULL
|
||||
connection syscon;
|
@ -1,33 +0,0 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection default;
|
||||
drop table if exists t1;
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select replace('abcdbf', 'b', 'cc');
|
||||
replace('abcdbf', 'b', 'cc')
|
||||
acccdccf
|
||||
select replace('abcdbf', 'b');
|
||||
ERROR 42000: Incorrect parameter count in the call to native function 'replace'
|
||||
select replace('abcdbf', 'b', '');
|
||||
replace('abcdbf', 'b', '')
|
||||
acdf
|
||||
select replace('abcdbf', '', 'cc');
|
||||
replace('abcdbf', '', 'cc')
|
||||
abcdbf
|
||||
select replace('', 'b', 'cc');
|
||||
replace('', 'b', 'cc')
|
||||
|
||||
select replace(NULL, 'b', 'cc');
|
||||
replace(NULL, 'b', 'cc')
|
||||
NULL
|
||||
select replace('abcdbf', NULL, 'cc');
|
||||
replace('abcdbf', NULL, 'cc')
|
||||
NULL
|
||||
select replace('abcdbf', 'b', NULL);
|
||||
replace('abcdbf', 'b', NULL)
|
||||
NULL
|
||||
select replace('abc', 'abc', '');
|
||||
replace('abc', 'abc', '')
|
||||
|
||||
connection syscon;
|
@ -1,746 +0,0 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,oceanbase,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
drop table if exists t1, t2;
|
||||
create table t1 (c1 int, c2 int unsigned,
|
||||
c3 tinyint, c4 tinyint unsigned,
|
||||
c5 smallint, c6 smallint unsigned,
|
||||
c7 mediumint, c8 mediumint unsigned,
|
||||
c9 integer, c10 integer unsigned,
|
||||
c11 bigint, c12 bigint unsigned,
|
||||
c13 float, c14 float unsigned,
|
||||
c15 double, c16 double unsigned,
|
||||
c17 decimal, c18 decimal unsigned,
|
||||
c19 datetime, c20 timestamp,
|
||||
c21 varchar(30), c22 char(30), c_null int);
|
||||
insert into t1 values(1, 2,
|
||||
1, 2,
|
||||
1, 2,
|
||||
1, 2,
|
||||
1, 2,
|
||||
1, 2,
|
||||
3.5, 4.5,
|
||||
5.5, 6.5,
|
||||
7.5, 8.5,
|
||||
'2019-12-01 12:00:00', '2019-12-03 06:00:00',
|
||||
'9.5', '10.5', null);
|
||||
insert into t1 values(-1, 2,
|
||||
-1, 2,
|
||||
-1, 2,
|
||||
-1, 2,
|
||||
-1, 2,
|
||||
-1, 2,
|
||||
-3.5, 4.5,
|
||||
-5.5, 6.5,
|
||||
-7.5, 8.5,
|
||||
'2019-12-01 12:00:00', '2019-12-03 06:00:00',
|
||||
'-9.5', '10.5', null);
|
||||
create table t2(
|
||||
a1 char(3) primary key,
|
||||
a2 int,
|
||||
a3 char(3),
|
||||
a4 float,
|
||||
a5 datetime
|
||||
);
|
||||
insert into t2 values('AME',0,'SEA',0.100,date'1942-02-19');
|
||||
insert into t2 values('HBR',1,'SEA',0.085,date'1948-03-05');
|
||||
insert into t2 values('BOT',-2,'SEA',-0.085,date'1951-11-29');
|
||||
insert into t2 values('BMC',3,'SEA',-0.085,date'1958-09-08');
|
||||
insert into t2 values('TWU',+0,'LAX',-0.080,date'1969-10-05');
|
||||
insert into t2 values('BDL',-0,'DEN',-0.080,date'1960-11-27');
|
||||
insert into t2 values('DTX',1,'NYC',0.080,date'1961-05-04');
|
||||
insert into t2 values('PLS',-1,'WDC',-0.075,date'1949-01-02');
|
||||
insert into t2 values('ZAJ',2,'CHI',-0.075,date'1960-06-15');
|
||||
insert into t2 values('VVV',-2,'MON',0.075,date'1959-06-28');
|
||||
insert into t2 values('GTM',3,'DAL',-0.070,date'1977-09-23');
|
||||
insert into t2 values('SSJ',null,'CHI',null,date'1974-03-19');
|
||||
insert into t2 values('KKK',-3,'ATL',null,null);
|
||||
insert into t2 values('XXX',null,'MIN',null,null);
|
||||
insert into t2 values('WWW',1,'LED',null,null);
|
||||
insert into t2 values('GG3',-3,'DD3',-0.051,date'1974-03-19');
|
||||
insert into t2 values('GG2',-3,'DD2',0.052,date'1974-03-19');
|
||||
insert into t2 values('GG1',3,'DD1',0.053,date'1974-03-19');
|
||||
select sign(null) from dual;
|
||||
sign(null)
|
||||
NULL
|
||||
select c1, sign(c1) from t1;
|
||||
c1 sign(c1)
|
||||
1 1
|
||||
-1 -1
|
||||
select c2, sign(c2) from t1;
|
||||
c2 sign(c2)
|
||||
2 1
|
||||
2 1
|
||||
select c3, sign(c3) from t1;
|
||||
c3 sign(c3)
|
||||
1 1
|
||||
-1 -1
|
||||
select c4, sign(c4) from t1;
|
||||
c4 sign(c4)
|
||||
2 1
|
||||
2 1
|
||||
select c5, sign(c5) from t1;
|
||||
c5 sign(c5)
|
||||
1 1
|
||||
-1 -1
|
||||
select c6, sign(c6) from t1;
|
||||
c6 sign(c6)
|
||||
2 1
|
||||
2 1
|
||||
select c7, sign(c7) from t1;
|
||||
c7 sign(c7)
|
||||
1 1
|
||||
-1 -1
|
||||
select c8, sign(c8) from t1;
|
||||
c8 sign(c8)
|
||||
2 1
|
||||
2 1
|
||||
select c9, sign(c9) from t1;
|
||||
c9 sign(c9)
|
||||
1 1
|
||||
-1 -1
|
||||
select c10, sign(c10) from t1;
|
||||
c10 sign(c10)
|
||||
2 1
|
||||
2 1
|
||||
select c11, sign(c11) from t1;
|
||||
c11 sign(c11)
|
||||
1 1
|
||||
-1 -1
|
||||
select c12, sign(c12) from t1;
|
||||
c12 sign(c12)
|
||||
2 1
|
||||
2 1
|
||||
select c13, sign(c13) from t1;
|
||||
c13 sign(c13)
|
||||
3.5 1
|
||||
-3.5 -1
|
||||
select c14, sign(c14) from t1;
|
||||
c14 sign(c14)
|
||||
4.5 1
|
||||
4.5 1
|
||||
select c15, sign(c15) from t1;
|
||||
c15 sign(c15)
|
||||
5.5 1
|
||||
-5.5 -1
|
||||
select c16, sign(c16) from t1;
|
||||
c16 sign(c16)
|
||||
6.5 1
|
||||
6.5 1
|
||||
select c17, sign(c17) from t1;
|
||||
c17 sign(c17)
|
||||
8 1
|
||||
-8 -1
|
||||
select c18, sign(c18) from t1;
|
||||
c18 sign(c18)
|
||||
9 1
|
||||
9 1
|
||||
select c19, sign(c19) from t1;
|
||||
c19 sign(c19)
|
||||
2019-12-01 12:00:00 1
|
||||
2019-12-01 12:00:00 1
|
||||
select c20, sign(c20) from t1;
|
||||
c20 sign(c20)
|
||||
2019-12-03 06:00:00 1
|
||||
2019-12-03 06:00:00 1
|
||||
select c21, sign(c21) from t1;
|
||||
c21 sign(c21)
|
||||
9.5 1
|
||||
-9.5 -1
|
||||
select c22, sign(c22) from t1;
|
||||
c22 sign(c22)
|
||||
10.5 1
|
||||
10.5 1
|
||||
select sign(a1) from t2;
|
||||
sign(a1)
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'AME'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'BDL'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'BMC'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'BOT'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DTX'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'GG1'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'GG2'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'GG3'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'GTM'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'HBR'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'KKK'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'PLS'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'SSJ'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'TWU'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'VVV'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'WWW'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'XXX'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'ZAJ'
|
||||
select sign(a3) from t2;
|
||||
sign(a3)
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'SEA'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DEN'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'SEA'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'SEA'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'NYC'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DD1'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DD2'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DD3'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DAL'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'SEA'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'ATL'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'WDC'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'CHI'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'LAX'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'MON'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'LED'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'MIN'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'CHI'
|
||||
select sign(a1),a2 from t2;
|
||||
sign(a1) a2
|
||||
0 0
|
||||
0 0
|
||||
0 3
|
||||
0 -2
|
||||
0 1
|
||||
0 3
|
||||
0 -3
|
||||
0 -3
|
||||
0 3
|
||||
0 1
|
||||
0 -3
|
||||
0 -1
|
||||
0 NULL
|
||||
0 0
|
||||
0 -2
|
||||
0 1
|
||||
0 NULL
|
||||
0 2
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'AME'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'BDL'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'BMC'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'BOT'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DTX'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'GG1'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'GG2'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'GG3'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'GTM'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'HBR'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'KKK'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'PLS'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'SSJ'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'TWU'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'VVV'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'WWW'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'XXX'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'ZAJ'
|
||||
select sign(a2) from t2 where sign(a4) >= 0;
|
||||
sign(a2)
|
||||
0
|
||||
1
|
||||
1
|
||||
-1
|
||||
1
|
||||
-1
|
||||
select sign(a4) from t2 where sign(a2) <=0 AND a2 < 2;
|
||||
sign(a4)
|
||||
1
|
||||
-1
|
||||
-1
|
||||
1
|
||||
-1
|
||||
NULL
|
||||
-1
|
||||
-1
|
||||
1
|
||||
select * from t2 group by sign(a2);
|
||||
a1 a2 a3 a4 a5
|
||||
AME 0 SEA 0.1 timestamp
|
||||
BMC 3 SEA -0.085 timestamp
|
||||
BOT -2 SEA -0.085 timestamp
|
||||
SSJ NULL CHI NULL timestamp
|
||||
select * from t2 order by sign(a4) ;
|
||||
a1 a2 a3 a4 a5
|
||||
XXX NULL MIN NULL timestamp
|
||||
WWW 1 LED NULL timestamp
|
||||
SSJ NULL CHI NULL timestamp
|
||||
KKK -3 ATL NULL timestamp
|
||||
BDL 0 DEN -0.08 timestamp
|
||||
ZAJ 2 CHI -0.075 timestamp
|
||||
TWU 0 LAX -0.08 timestamp
|
||||
PLS -1 WDC -0.075 timestamp
|
||||
GTM 3 DAL -0.07 timestamp
|
||||
GG3 -3 DD3 -0.051 timestamp
|
||||
BOT -2 SEA -0.085 timestamp
|
||||
BMC 3 SEA -0.085 timestamp
|
||||
HBR 1 SEA 0.085 timestamp
|
||||
GG2 -3 DD2 0.052 timestamp
|
||||
GG1 3 DD1 0.053 timestamp
|
||||
DTX 1 NYC 0.08 timestamp
|
||||
VVV -2 MON 0.075 timestamp
|
||||
AME 0 SEA 0.1 timestamp
|
||||
select * from t2 order by sign(a4) , a4 ;
|
||||
a1 a2 a3 a4 a5
|
||||
XXX NULL MIN NULL timestamp
|
||||
WWW 1 LED NULL timestamp
|
||||
SSJ NULL CHI NULL timestamp
|
||||
KKK -3 ATL NULL timestamp
|
||||
BMC 3 SEA -0.085 timestamp
|
||||
BOT -2 SEA -0.085 timestamp
|
||||
BDL 0 DEN -0.08 timestamp
|
||||
TWU 0 LAX -0.08 timestamp
|
||||
ZAJ 2 CHI -0.075 timestamp
|
||||
PLS -1 WDC -0.075 timestamp
|
||||
GTM 3 DAL -0.07 timestamp
|
||||
GG3 -3 DD3 -0.051 timestamp
|
||||
GG2 -3 DD2 0.052 timestamp
|
||||
GG1 3 DD1 0.053 timestamp
|
||||
VVV -2 MON 0.075 timestamp
|
||||
DTX 1 NYC 0.08 timestamp
|
||||
HBR 1 SEA 0.085 timestamp
|
||||
AME 0 SEA 0.1 timestamp
|
||||
select * from t2 order by sign(a4) , a1 ;
|
||||
a1 a2 a3 a4 a5
|
||||
KKK -3 ATL NULL timestamp
|
||||
SSJ NULL CHI NULL timestamp
|
||||
WWW 1 LED NULL timestamp
|
||||
XXX NULL MIN NULL timestamp
|
||||
BDL 0 DEN -0.08 timestamp
|
||||
BMC 3 SEA -0.085 timestamp
|
||||
BOT -2 SEA -0.085 timestamp
|
||||
GG3 -3 DD3 -0.051 timestamp
|
||||
GTM 3 DAL -0.07 timestamp
|
||||
PLS -1 WDC -0.075 timestamp
|
||||
TWU 0 LAX -0.08 timestamp
|
||||
ZAJ 2 CHI -0.075 timestamp
|
||||
AME 0 SEA 0.1 timestamp
|
||||
DTX 1 NYC 0.08 timestamp
|
||||
GG1 3 DD1 0.053 timestamp
|
||||
GG2 -3 DD2 0.052 timestamp
|
||||
HBR 1 SEA 0.085 timestamp
|
||||
VVV -2 MON 0.075 timestamp
|
||||
select abs(a2) , sum(a4) from t2 group by abs(a2) having sum(sign(a4)) > 0;
|
||||
abs(a2) sum(a4)
|
||||
1 0.08999999612569809
|
||||
select * from t2 where a2 = sign ( floor(1.5) - ceil(1.5) + round(1.5) - abs(-1.5) + neg(-1) );
|
||||
a1 a2 a3 a4 a5
|
||||
DTX 1 NYC 0.08 timestamp
|
||||
HBR 1 SEA 0.085 timestamp
|
||||
WWW 1 LED NULL timestamp
|
||||
select sign( sum(a2) ) , sign( sum(a4) ) from t2;
|
||||
sign( sum(a2) ) sign( sum(a4) )
|
||||
0 -1
|
||||
select sign( avg(a2) ) , sign( avg(a4) ) from t2;
|
||||
sign( avg(a2) ) sign( avg(a4) )
|
||||
0 -1
|
||||
select sign( max(a2) ) , sign( min(a4) ) from t2;
|
||||
sign( max(a2) ) sign( min(a4) )
|
||||
1 -1
|
||||
select sign(count(*)) from t2;
|
||||
sign(count(*))
|
||||
1
|
||||
select * from t2 where sign( length(a1) ) = 1;
|
||||
a1 a2 a3 a4 a5
|
||||
AME 0 SEA 0.1 timestamp
|
||||
BDL 0 DEN -0.08 timestamp
|
||||
BMC 3 SEA -0.085 timestamp
|
||||
BOT -2 SEA -0.085 timestamp
|
||||
DTX 1 NYC 0.08 timestamp
|
||||
GG1 3 DD1 0.053 timestamp
|
||||
GG2 -3 DD2 0.052 timestamp
|
||||
GG3 -3 DD3 -0.051 timestamp
|
||||
GTM 3 DAL -0.07 timestamp
|
||||
HBR 1 SEA 0.085 timestamp
|
||||
KKK -3 ATL NULL timestamp
|
||||
PLS -1 WDC -0.075 timestamp
|
||||
SSJ NULL CHI NULL timestamp
|
||||
TWU 0 LAX -0.08 timestamp
|
||||
VVV -2 MON 0.075 timestamp
|
||||
WWW 1 LED NULL timestamp
|
||||
XXX NULL MIN NULL timestamp
|
||||
ZAJ 2 CHI -0.075 timestamp
|
||||
select sign( cast(a1 as char(1024)) ) , sign( cast(a3 as char(1024)) ) from t2;
|
||||
sign( cast(a1 as char(1024)) ) sign( cast(a3 as char(1024)) )
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'AME'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'SEA'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'BDL'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DEN'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'BMC'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'SEA'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'BOT'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'SEA'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DTX'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'NYC'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'GG1'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DD1'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'GG2'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DD2'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'GG3'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DD3'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'GTM'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DAL'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'HBR'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'SEA'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'KKK'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'ATL'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'PLS'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'WDC'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'SSJ'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'CHI'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'TWU'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'LAX'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'VVV'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'MON'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'WWW'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'LED'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'XXX'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'MIN'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'ZAJ'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'CHI'
|
||||
select sign( cast(a2 as char(1024)) ) , sign( cast(a4 as char(1024)) ) from t2;
|
||||
sign( cast(a2 as char(1024)) ) sign( cast(a4 as char(1024)) )
|
||||
0 1
|
||||
0 -1
|
||||
1 -1
|
||||
-1 -1
|
||||
1 1
|
||||
1 1
|
||||
-1 1
|
||||
-1 -1
|
||||
1 -1
|
||||
1 1
|
||||
-1 NULL
|
||||
-1 -1
|
||||
NULL NULL
|
||||
0 -1
|
||||
-1 1
|
||||
1 NULL
|
||||
NULL NULL
|
||||
1 -1
|
||||
select * from t2 as t21 join t2 as t22 on sign(t21.a2) = sign(t22.a4);
|
||||
a1 a2 a3 a4 a5 a1 a2 a3 a4 a5
|
||||
ZAJ 2 CHI -0.075 1960-06-15 00:00:00 AME 0 SEA 0.1 1942-02-19 00:00:00
|
||||
WWW 1 LED NULL NULL AME 0 SEA 0.1 1942-02-19 00:00:00
|
||||
HBR 1 SEA 0.085 1948-03-05 00:00:00 AME 0 SEA 0.1 1942-02-19 00:00:00
|
||||
GTM 3 DAL -0.07 1977-09-23 00:00:00 AME 0 SEA 0.1 1942-02-19 00:00:00
|
||||
GG1 3 DD1 0.053 1974-03-19 00:00:00 AME 0 SEA 0.1 1942-02-19 00:00:00
|
||||
DTX 1 NYC 0.08 1961-05-04 00:00:00 AME 0 SEA 0.1 1942-02-19 00:00:00
|
||||
BMC 3 SEA -0.085 1958-09-08 00:00:00 AME 0 SEA 0.1 1942-02-19 00:00:00
|
||||
VVV -2 MON 0.075 1959-06-28 00:00:00 BDL 0 DEN -0.08 1960-11-27 00:00:00
|
||||
PLS -1 WDC -0.075 1949-01-02 00:00:00 BDL 0 DEN -0.08 1960-11-27 00:00:00
|
||||
KKK -3 ATL NULL NULL BDL 0 DEN -0.08 1960-11-27 00:00:00
|
||||
GG3 -3 DD3 -0.051 1974-03-19 00:00:00 BDL 0 DEN -0.08 1960-11-27 00:00:00
|
||||
GG2 -3 DD2 0.052 1974-03-19 00:00:00 BDL 0 DEN -0.08 1960-11-27 00:00:00
|
||||
BOT -2 SEA -0.085 1951-11-29 00:00:00 BDL 0 DEN -0.08 1960-11-27 00:00:00
|
||||
VVV -2 MON 0.075 1959-06-28 00:00:00 BMC 3 SEA -0.085 1958-09-08 00:00:00
|
||||
PLS -1 WDC -0.075 1949-01-02 00:00:00 BMC 3 SEA -0.085 1958-09-08 00:00:00
|
||||
KKK -3 ATL NULL NULL BMC 3 SEA -0.085 1958-09-08 00:00:00
|
||||
GG3 -3 DD3 -0.051 1974-03-19 00:00:00 BMC 3 SEA -0.085 1958-09-08 00:00:00
|
||||
GG2 -3 DD2 0.052 1974-03-19 00:00:00 BMC 3 SEA -0.085 1958-09-08 00:00:00
|
||||
BOT -2 SEA -0.085 1951-11-29 00:00:00 BMC 3 SEA -0.085 1958-09-08 00:00:00
|
||||
VVV -2 MON 0.075 1959-06-28 00:00:00 BOT -2 SEA -0.085 1951-11-29 00:00:00
|
||||
PLS -1 WDC -0.075 1949-01-02 00:00:00 BOT -2 SEA -0.085 1951-11-29 00:00:00
|
||||
KKK -3 ATL NULL NULL BOT -2 SEA -0.085 1951-11-29 00:00:00
|
||||
GG3 -3 DD3 -0.051 1974-03-19 00:00:00 BOT -2 SEA -0.085 1951-11-29 00:00:00
|
||||
GG2 -3 DD2 0.052 1974-03-19 00:00:00 BOT -2 SEA -0.085 1951-11-29 00:00:00
|
||||
BOT -2 SEA -0.085 1951-11-29 00:00:00 BOT -2 SEA -0.085 1951-11-29 00:00:00
|
||||
ZAJ 2 CHI -0.075 1960-06-15 00:00:00 DTX 1 NYC 0.08 1961-05-04 00:00:00
|
||||
WWW 1 LED NULL NULL DTX 1 NYC 0.08 1961-05-04 00:00:00
|
||||
HBR 1 SEA 0.085 1948-03-05 00:00:00 DTX 1 NYC 0.08 1961-05-04 00:00:00
|
||||
GTM 3 DAL -0.07 1977-09-23 00:00:00 DTX 1 NYC 0.08 1961-05-04 00:00:00
|
||||
GG1 3 DD1 0.053 1974-03-19 00:00:00 DTX 1 NYC 0.08 1961-05-04 00:00:00
|
||||
DTX 1 NYC 0.08 1961-05-04 00:00:00 DTX 1 NYC 0.08 1961-05-04 00:00:00
|
||||
BMC 3 SEA -0.085 1958-09-08 00:00:00 DTX 1 NYC 0.08 1961-05-04 00:00:00
|
||||
ZAJ 2 CHI -0.075 1960-06-15 00:00:00 GG1 3 DD1 0.053 1974-03-19 00:00:00
|
||||
WWW 1 LED NULL NULL GG1 3 DD1 0.053 1974-03-19 00:00:00
|
||||
HBR 1 SEA 0.085 1948-03-05 00:00:00 GG1 3 DD1 0.053 1974-03-19 00:00:00
|
||||
GTM 3 DAL -0.07 1977-09-23 00:00:00 GG1 3 DD1 0.053 1974-03-19 00:00:00
|
||||
GG1 3 DD1 0.053 1974-03-19 00:00:00 GG1 3 DD1 0.053 1974-03-19 00:00:00
|
||||
DTX 1 NYC 0.08 1961-05-04 00:00:00 GG1 3 DD1 0.053 1974-03-19 00:00:00
|
||||
BMC 3 SEA -0.085 1958-09-08 00:00:00 GG1 3 DD1 0.053 1974-03-19 00:00:00
|
||||
ZAJ 2 CHI -0.075 1960-06-15 00:00:00 GG2 -3 DD2 0.052 1974-03-19 00:00:00
|
||||
WWW 1 LED NULL NULL GG2 -3 DD2 0.052 1974-03-19 00:00:00
|
||||
HBR 1 SEA 0.085 1948-03-05 00:00:00 GG2 -3 DD2 0.052 1974-03-19 00:00:00
|
||||
GTM 3 DAL -0.07 1977-09-23 00:00:00 GG2 -3 DD2 0.052 1974-03-19 00:00:00
|
||||
GG1 3 DD1 0.053 1974-03-19 00:00:00 GG2 -3 DD2 0.052 1974-03-19 00:00:00
|
||||
DTX 1 NYC 0.08 1961-05-04 00:00:00 GG2 -3 DD2 0.052 1974-03-19 00:00:00
|
||||
BMC 3 SEA -0.085 1958-09-08 00:00:00 GG2 -3 DD2 0.052 1974-03-19 00:00:00
|
||||
VVV -2 MON 0.075 1959-06-28 00:00:00 GG3 -3 DD3 -0.051 1974-03-19 00:00:00
|
||||
PLS -1 WDC -0.075 1949-01-02 00:00:00 GG3 -3 DD3 -0.051 1974-03-19 00:00:00
|
||||
KKK -3 ATL NULL NULL GG3 -3 DD3 -0.051 1974-03-19 00:00:00
|
||||
GG3 -3 DD3 -0.051 1974-03-19 00:00:00 GG3 -3 DD3 -0.051 1974-03-19 00:00:00
|
||||
GG2 -3 DD2 0.052 1974-03-19 00:00:00 GG3 -3 DD3 -0.051 1974-03-19 00:00:00
|
||||
BOT -2 SEA -0.085 1951-11-29 00:00:00 GG3 -3 DD3 -0.051 1974-03-19 00:00:00
|
||||
VVV -2 MON 0.075 1959-06-28 00:00:00 GTM 3 DAL -0.07 1977-09-23 00:00:00
|
||||
PLS -1 WDC -0.075 1949-01-02 00:00:00 GTM 3 DAL -0.07 1977-09-23 00:00:00
|
||||
KKK -3 ATL NULL NULL GTM 3 DAL -0.07 1977-09-23 00:00:00
|
||||
GG3 -3 DD3 -0.051 1974-03-19 00:00:00 GTM 3 DAL -0.07 1977-09-23 00:00:00
|
||||
GG2 -3 DD2 0.052 1974-03-19 00:00:00 GTM 3 DAL -0.07 1977-09-23 00:00:00
|
||||
BOT -2 SEA -0.085 1951-11-29 00:00:00 GTM 3 DAL -0.07 1977-09-23 00:00:00
|
||||
ZAJ 2 CHI -0.075 1960-06-15 00:00:00 HBR 1 SEA 0.085 1948-03-05 00:00:00
|
||||
WWW 1 LED NULL NULL HBR 1 SEA 0.085 1948-03-05 00:00:00
|
||||
HBR 1 SEA 0.085 1948-03-05 00:00:00 HBR 1 SEA 0.085 1948-03-05 00:00:00
|
||||
GTM 3 DAL -0.07 1977-09-23 00:00:00 HBR 1 SEA 0.085 1948-03-05 00:00:00
|
||||
GG1 3 DD1 0.053 1974-03-19 00:00:00 HBR 1 SEA 0.085 1948-03-05 00:00:00
|
||||
DTX 1 NYC 0.08 1961-05-04 00:00:00 HBR 1 SEA 0.085 1948-03-05 00:00:00
|
||||
BMC 3 SEA -0.085 1958-09-08 00:00:00 HBR 1 SEA 0.085 1948-03-05 00:00:00
|
||||
VVV -2 MON 0.075 1959-06-28 00:00:00 PLS -1 WDC -0.075 1949-01-02 00:00:00
|
||||
PLS -1 WDC -0.075 1949-01-02 00:00:00 PLS -1 WDC -0.075 1949-01-02 00:00:00
|
||||
KKK -3 ATL NULL NULL PLS -1 WDC -0.075 1949-01-02 00:00:00
|
||||
GG3 -3 DD3 -0.051 1974-03-19 00:00:00 PLS -1 WDC -0.075 1949-01-02 00:00:00
|
||||
GG2 -3 DD2 0.052 1974-03-19 00:00:00 PLS -1 WDC -0.075 1949-01-02 00:00:00
|
||||
BOT -2 SEA -0.085 1951-11-29 00:00:00 PLS -1 WDC -0.075 1949-01-02 00:00:00
|
||||
VVV -2 MON 0.075 1959-06-28 00:00:00 TWU 0 LAX -0.08 1969-10-05 00:00:00
|
||||
PLS -1 WDC -0.075 1949-01-02 00:00:00 TWU 0 LAX -0.08 1969-10-05 00:00:00
|
||||
KKK -3 ATL NULL NULL TWU 0 LAX -0.08 1969-10-05 00:00:00
|
||||
GG3 -3 DD3 -0.051 1974-03-19 00:00:00 TWU 0 LAX -0.08 1969-10-05 00:00:00
|
||||
GG2 -3 DD2 0.052 1974-03-19 00:00:00 TWU 0 LAX -0.08 1969-10-05 00:00:00
|
||||
BOT -2 SEA -0.085 1951-11-29 00:00:00 TWU 0 LAX -0.08 1969-10-05 00:00:00
|
||||
ZAJ 2 CHI -0.075 1960-06-15 00:00:00 VVV -2 MON 0.075 1959-06-28 00:00:00
|
||||
WWW 1 LED NULL NULL VVV -2 MON 0.075 1959-06-28 00:00:00
|
||||
HBR 1 SEA 0.085 1948-03-05 00:00:00 VVV -2 MON 0.075 1959-06-28 00:00:00
|
||||
GTM 3 DAL -0.07 1977-09-23 00:00:00 VVV -2 MON 0.075 1959-06-28 00:00:00
|
||||
GG1 3 DD1 0.053 1974-03-19 00:00:00 VVV -2 MON 0.075 1959-06-28 00:00:00
|
||||
DTX 1 NYC 0.08 1961-05-04 00:00:00 VVV -2 MON 0.075 1959-06-28 00:00:00
|
||||
BMC 3 SEA -0.085 1958-09-08 00:00:00 VVV -2 MON 0.075 1959-06-28 00:00:00
|
||||
VVV -2 MON 0.075 1959-06-28 00:00:00 ZAJ 2 CHI -0.075 1960-06-15 00:00:00
|
||||
PLS -1 WDC -0.075 1949-01-02 00:00:00 ZAJ 2 CHI -0.075 1960-06-15 00:00:00
|
||||
KKK -3 ATL NULL NULL ZAJ 2 CHI -0.075 1960-06-15 00:00:00
|
||||
GG3 -3 DD3 -0.051 1974-03-19 00:00:00 ZAJ 2 CHI -0.075 1960-06-15 00:00:00
|
||||
GG2 -3 DD2 0.052 1974-03-19 00:00:00 ZAJ 2 CHI -0.075 1960-06-15 00:00:00
|
||||
BOT -2 SEA -0.085 1951-11-29 00:00:00 ZAJ 2 CHI -0.075 1960-06-15 00:00:00
|
||||
select tmp.a1 , sign(tmp.a2) , tmp.a3 , sign(tmp.a4) from t2 as tmp;
|
||||
a1 sign(tmp.a2) a3 sign(tmp.a4)
|
||||
AME 0 SEA 1
|
||||
BDL 0 DEN -1
|
||||
BMC 1 SEA -1
|
||||
BOT -1 SEA -1
|
||||
DTX 1 NYC 1
|
||||
GG1 1 DD1 1
|
||||
GG2 -1 DD2 1
|
||||
GG3 -1 DD3 -1
|
||||
GTM 1 DAL -1
|
||||
HBR 1 SEA 1
|
||||
KKK -1 ATL NULL
|
||||
PLS -1 WDC -1
|
||||
SSJ NULL CHI NULL
|
||||
TWU 0 LAX -1
|
||||
VVV -1 MON 1
|
||||
WWW 1 LED NULL
|
||||
XXX NULL MIN NULL
|
||||
ZAJ 1 CHI -1
|
||||
select sign(a2) from t2 where sign(a4) >= 0 for update;
|
||||
sign(a2)
|
||||
0
|
||||
1
|
||||
1
|
||||
-1
|
||||
1
|
||||
-1
|
||||
select sign(a4) from t2 where sign(a2) <=0 AND a2 < 2 for update;
|
||||
sign(a4)
|
||||
1
|
||||
-1
|
||||
-1
|
||||
1
|
||||
-1
|
||||
NULL
|
||||
-1
|
||||
-1
|
||||
1
|
||||
select * from t2 group by sign(a2) for update;
|
||||
a1 a2 a3 a4 a5
|
||||
AME 0 SEA 0.1 1942-02-19 00:00:00
|
||||
BMC 3 SEA -0.085 1958-09-08 00:00:00
|
||||
BOT -2 SEA -0.085 1951-11-29 00:00:00
|
||||
SSJ NULL CHI NULL 1974-03-19 00:00:00
|
||||
select * from t2 order by sign(a4) for update;
|
||||
a1 a2 a3 a4 a5
|
||||
XXX NULL MIN NULL NULL
|
||||
WWW 1 LED NULL NULL
|
||||
SSJ NULL CHI NULL 1974-03-19 00:00:00
|
||||
KKK -3 ATL NULL NULL
|
||||
BDL 0 DEN -0.08 1960-11-27 00:00:00
|
||||
ZAJ 2 CHI -0.075 1960-06-15 00:00:00
|
||||
TWU 0 LAX -0.08 1969-10-05 00:00:00
|
||||
PLS -1 WDC -0.075 1949-01-02 00:00:00
|
||||
GTM 3 DAL -0.07 1977-09-23 00:00:00
|
||||
GG3 -3 DD3 -0.051 1974-03-19 00:00:00
|
||||
BOT -2 SEA -0.085 1951-11-29 00:00:00
|
||||
BMC 3 SEA -0.085 1958-09-08 00:00:00
|
||||
HBR 1 SEA 0.085 1948-03-05 00:00:00
|
||||
GG2 -3 DD2 0.052 1974-03-19 00:00:00
|
||||
GG1 3 DD1 0.053 1974-03-19 00:00:00
|
||||
DTX 1 NYC 0.08 1961-05-04 00:00:00
|
||||
VVV -2 MON 0.075 1959-06-28 00:00:00
|
||||
AME 0 SEA 0.1 1942-02-19 00:00:00
|
||||
select abs(a2) , sum(a4) from t2 group by abs(a2) having sum(sign(a4)) > 0 for update;
|
||||
abs(a2) sum(a4)
|
||||
1 0.08999999612569809
|
||||
select * from t2 where a2 = sign ( floor(1.5) - ceil(1.5) + round(1.5) - abs(-1.5) + neg(-1) ) for update;
|
||||
a1 a2 a3 a4 a5
|
||||
DTX 1 NYC 0.08 timestamp
|
||||
HBR 1 SEA 0.085 timestamp
|
||||
WWW 1 LED NULL timestamp
|
||||
select sign( sum(a2) ) , sign( sum(a4) ) from t2 for update;
|
||||
sign( sum(a2) ) sign( sum(a4) )
|
||||
0 -1
|
||||
select sign( avg(a2) ) , sign( avg(a4) ) from t2 for update;
|
||||
sign( avg(a2) ) sign( avg(a4) )
|
||||
0 -1
|
||||
select sign( max(a2) ) , sign( min(a4) ) from t2 for update;
|
||||
sign( max(a2) ) sign( min(a4) )
|
||||
1 -1
|
||||
select sign(count(*)) from t2 for update;
|
||||
sign(count(*))
|
||||
1
|
||||
select * from t2 where sign( length(a1) ) = 1 for update;
|
||||
a1 a2 a3 a4 a5
|
||||
AME 0 SEA 0.1 timestamp
|
||||
BDL 0 DEN -0.08 timestamp
|
||||
BMC 3 SEA -0.085 timestamp
|
||||
BOT -2 SEA -0.085 timestamp
|
||||
DTX 1 NYC 0.08 timestamp
|
||||
GG1 3 DD1 0.053 timestamp
|
||||
GG2 -3 DD2 0.052 timestamp
|
||||
GG3 -3 DD3 -0.051 timestamp
|
||||
GTM 3 DAL -0.07 timestamp
|
||||
HBR 1 SEA 0.085 timestamp
|
||||
KKK -3 ATL NULL timestamp
|
||||
PLS -1 WDC -0.075 timestamp
|
||||
SSJ NULL CHI NULL timestamp
|
||||
TWU 0 LAX -0.08 timestamp
|
||||
VVV -2 MON 0.075 timestamp
|
||||
WWW 1 LED NULL timestamp
|
||||
XXX NULL MIN NULL timestamp
|
||||
ZAJ 2 CHI -0.075 timestamp
|
||||
select sign( cast(a1 as char(1024)) ) , sign( cast(a3 as char(1024)) ) from t2 for update;
|
||||
sign( cast(a1 as char(1024)) ) sign( cast(a3 as char(1024)) )
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'AME'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'SEA'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'BDL'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DEN'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'BMC'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'SEA'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'BOT'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'SEA'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DTX'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'NYC'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'GG1'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DD1'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'GG2'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DD2'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'GG3'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DD3'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'GTM'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'DAL'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'HBR'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'SEA'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'KKK'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'ATL'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'PLS'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'WDC'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'SSJ'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'CHI'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'TWU'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'LAX'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'VVV'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'MON'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'WWW'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'LED'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'XXX'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'MIN'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'ZAJ'
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'CHI'
|
||||
select sign( cast(a2 as char(1024)) ) , sign( cast(a4 as char(1024)) ) from t2 for update;
|
||||
sign( cast(a2 as char(1024)) ) sign( cast(a4 as char(1024)) )
|
||||
0 1
|
||||
0 -1
|
||||
1 -1
|
||||
-1 -1
|
||||
1 1
|
||||
1 1
|
||||
-1 1
|
||||
-1 -1
|
||||
1 -1
|
||||
1 1
|
||||
-1 NULL
|
||||
-1 -1
|
||||
NULL NULL
|
||||
0 -1
|
||||
-1 1
|
||||
1 NULL
|
||||
NULL NULL
|
||||
1 -1
|
File diff suppressed because it is too large
Load Diff
@ -1,96 +0,0 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select substr('abcdef', 0) from dual;
|
||||
substr('abcdef', 0)
|
||||
|
||||
select substr('abcdef', -1) from dual;
|
||||
substr('abcdef', -1)
|
||||
f
|
||||
select substr('abcdef', 1) from dual;
|
||||
substr('abcdef', 1)
|
||||
abcdef
|
||||
select substr('abcdef', 2) from dual;
|
||||
substr('abcdef', 2)
|
||||
bcdef
|
||||
select substr('abcdef', 10) from dual;
|
||||
substr('abcdef', 10)
|
||||
|
||||
select substr('', 1) from dual;
|
||||
substr('', 1)
|
||||
|
||||
select substr('abcdef', 10) from dual;
|
||||
substr('abcdef', 10)
|
||||
|
||||
select substr('abcdef', 2, 1) from dual;
|
||||
substr('abcdef', 2, 1)
|
||||
b
|
||||
select substr('abcdef', 2, 2) from dual;
|
||||
substr('abcdef', 2, 2)
|
||||
bc
|
||||
select substr('abcdef', 2, 0) from dual;
|
||||
substr('abcdef', 2, 0)
|
||||
|
||||
select substr('abcdef', 2, -1) from dual;
|
||||
substr('abcdef', 2, -1)
|
||||
|
||||
select substr('abcdef', 2, 100) from dual;
|
||||
substr('abcdef', 2, 100)
|
||||
bcdef
|
||||
select substr('', 2, 100) from dual;
|
||||
substr('', 2, 100)
|
||||
|
||||
select substr(NULL, 2, 1) from dual;
|
||||
substr(NULL, 2, 1)
|
||||
NULL
|
||||
select substr('abcdef', NULL, 1) from dual;
|
||||
substr('abcdef', NULL, 1)
|
||||
NULL
|
||||
select substr('abcdef', 2, NULL) from dual;
|
||||
substr('abcdef', 2, NULL)
|
||||
NULL
|
||||
select substr(3.14159, 2, 3) from dual;
|
||||
substr(3.14159, 2, 3)
|
||||
.14
|
||||
explain select substr(3.14159, '2', '3') from dual;
|
||||
Query Plan
|
||||
===================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
-----------------------------------
|
||||
|0 |EXPRESSION| |1 |1 |
|
||||
===================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([?]), filter(nil)
|
||||
values({?})
|
||||
|
||||
select substr(3.14159, '2', '2.1') from dual;
|
||||
substr(3.14159, '2', '2.1')
|
||||
.1
|
||||
select substr(3.14159, '2', '2.9') from dual;
|
||||
substr(3.14159, '2', '2.9')
|
||||
.1
|
||||
select substr(3.14159, '2', '2.9') from dual;
|
||||
substr(3.14159, '2', '2.9')
|
||||
.1
|
||||
select substr(3.14159, '2.1', '2.9') from dual;
|
||||
substr(3.14159, '2.1', '2.9')
|
||||
.1
|
||||
select substr(3.14159, '2.9', '2.9') from dual;
|
||||
substr(3.14159, '2.9', '2.9')
|
||||
.1
|
||||
select substr(3.14159, 2.1, '2.9') from dual;
|
||||
substr(3.14159, 2.1, '2.9')
|
||||
.1
|
||||
select substr(3.14159, 2.9, '2.9') from dual;
|
||||
substr(3.14159, 2.9, '2.9')
|
||||
14
|
||||
select substr(3.14159, 2.9, 2.9) from dual;
|
||||
substr(3.14159, 2.9, 2.9)
|
||||
141
|
||||
select substr(3.14159, 2.1, 2.1) from dual;
|
||||
substr(3.14159, 2.1, 2.1)
|
||||
.1
|
||||
connection syscon;
|
@ -1,88 +0,0 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection default;
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 bigint, c2 bigint unsigned, c3 decimal(40,2), c4 varchar(40));
|
||||
insert into t1 (c1, c2, c3, c4) values (-1, 0, 1, "2.1");
|
||||
insert into t1 (c1, c2, c3, c4) values (-2, 0, 2.1, "2.9");
|
||||
insert into t1 (c1, c2, c3, c4) values (-2, 0, 2.9, "2.9");
|
||||
insert into t1 (c1, c2, c3, c4) values (-10, 0, 10, "10");
|
||||
insert into t1 (c1, c2, c3, c4) values (4294967296, 4294967296, 4294967296, "4294967296");
|
||||
insert into t1 (c1, c2, c3, c4) values (4294967297, 4294967297, 4294967295, "4294967295");
|
||||
insert into t1 (c1, c2, c3, c4) values (-4294967296, 4294967296, -4294967296, "-4294967296");
|
||||
insert into t1 (c1, c2, c3, c4) values (-4294967297, 4294967297, -4294967295, "-4294967295");
|
||||
insert into t1 (c1, c2, c3, c4) values (9223372036854775806, 9223372036854775808, 9223372036854775808, "9223372036854775808");
|
||||
insert into t1 (c1, c2, c3, c4) values (9223372036854775807, 9223372036854775807, 9223372036854775807, "9223372036854775807");
|
||||
insert into t1 (c1, c2, c3, c4) values (9223372036854775806, 9223372036854775809, 9223372036854775809, "9223372036854775809");
|
||||
insert into t1 (c1, c2, c3, c4) values (-9223372036854775807, 9223372036854775807, -9223372036854775807, "-9223372036854775807");
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select substring_index("a,b,c,d", ",", -1);
|
||||
substring_index("a,b,c,d", ",", -1)
|
||||
d
|
||||
select substring_index("a,b,c,d", ",", 0);
|
||||
substring_index("a,b,c,d", ",", 0)
|
||||
|
||||
select substring_index("a,b,c,d", ",", 1);
|
||||
substring_index("a,b,c,d", ",", 1)
|
||||
a
|
||||
select substring_index("a,b,c,d", ",", 2);
|
||||
substring_index("a,b,c,d", ",", 2)
|
||||
a,b
|
||||
select substring_index("", ",", 2);
|
||||
substring_index("", ",", 2)
|
||||
|
||||
select substring_index("a,b,c,d", "", 2);
|
||||
substring_index("a,b,c,d", "", 2)
|
||||
|
||||
select substring_index(NULL, ",", 2);
|
||||
substring_index(NULL, ",", 2)
|
||||
NULL
|
||||
select substring_index("a,b,c,d", NULL, 2);
|
||||
substring_index("a,b,c,d", NULL, 2)
|
||||
NULL
|
||||
select substring_index("a,b,c,d", ",", NULL);
|
||||
substring_index("a,b,c,d", ",", NULL)
|
||||
NULL
|
||||
select substring_index(1.414, 1, 2);
|
||||
substring_index(1.414, 1, 2)
|
||||
1.4
|
||||
select c1, substring_index("a,b,c,d", ",", c1), c2, substring_index("a,b,c,d", ",", c2), c3, substring_index("a,b,c,d", ",", c3), c4, substring_index("a,b,c,d", ",", c4) from t1;
|
||||
c1 substring_index("a,b,c,d", ",", c1) c2 substring_index("a,b,c,d", ",", c2) c3 substring_index("a,b,c,d", ",", c3) c4 substring_index("a,b,c,d", ",", c4)
|
||||
-1 d 0 1.00 a 2.1 a,b
|
||||
-2 c,d 0 2.10 a,b 2.9 a,b
|
||||
-2 c,d 0 2.90 a,b,c 2.9 a,b
|
||||
-10 a,b,c,d 0 10.00 a,b,c,d 10 a,b,c,d
|
||||
4294967296 4294967296 4294967296.00 4294967296
|
||||
4294967297 a 4294967297 a 4294967295.00 d 4294967295 d
|
||||
-4294967296 4294967296 -4294967296.00 -4294967296
|
||||
-4294967297 d 4294967297 a -4294967295.00 a -4294967295 a
|
||||
9223372036854775806 c,d 9223372036854775808 9223372036854775808.00 d 9223372036854775808 d
|
||||
9223372036854775807 d 9223372036854775807 d 9223372036854775807.00 d 9223372036854775807 d
|
||||
9223372036854775806 c,d 9223372036854775809 a 9223372036854775809.00 d 9223372036854775809 d
|
||||
-9223372036854775807 a 9223372036854775807 d -9223372036854775807.00 a -9223372036854775807 a
|
||||
drop table if exists t2, t3;
|
||||
create table t2(c1 varchar(20));
|
||||
create table t3(c1 varchar(20));
|
||||
insert into t2 values(null), (''), ('1');
|
||||
insert into t3 values(''), (null), ('1');
|
||||
//the result of next 2 sqls should be same
|
||||
select c1, substring_index(c1, 'vpprm', -47) from t2 order by c1;
|
||||
c1 substring_index(c1, 'vpprm', -47)
|
||||
NULL NULL
|
||||
|
||||
1 1
|
||||
select c1, substring_index(c1, 'vpprm', -47) from t3 order by c1;
|
||||
c1 substring_index(c1, 'vpprm', -47)
|
||||
NULL NULL
|
||||
|
||||
1 1
|
||||
drop table t1, t2,t3;
|
||||
drop table if exists t1;
|
||||
create table t1(c1 char(10));
|
||||
insert into t1 values(null), ('');
|
||||
select substring_index(c1, 'a', 1) from t1;
|
||||
substring_index(c1, 'a', 1)
|
||||
NULL
|
||||
|
||||
connection syscon;
|
@ -1,29 +0,0 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connect rootcon, $OBMYSQL_MS0,root@$TENANT,,test,$OBMYSQL_PORT;
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select sys_privilege_check('table_acc', effective_tenant_id(), 'oceanbase', '__all_user');
|
||||
sys_privilege_check('table_acc', effective_tenant_id(), 'oceanbase', '__all_user')
|
||||
0
|
||||
select sys_privilege_check('db_acc', effective_tenant_id(), 'oceanbase_', '__all_user_');
|
||||
sys_privilege_check('db_acc', effective_tenant_id(), 'oceanbase_', '__all_user_')
|
||||
0
|
||||
drop database if exists espcndb;
|
||||
create database espcndb;
|
||||
connection rootcon;
|
||||
create user espcnouser;
|
||||
grant all on test.* to espcnouser;
|
||||
connect con1, $OBMYSQL_MS0,espcnouser@$TENANT,,test,$OBMYSQL_PORT;
|
||||
connection con1;
|
||||
select sys_privilege_check('db_acc', effective_tenant_id(), 'test', 't');
|
||||
sys_privilege_check('db_acc', effective_tenant_id(), 'test', 't')
|
||||
0
|
||||
select sys_privilege_check('db_acc', effective_tenant_id(), 'espcndb', 't');
|
||||
sys_privilege_check('db_acc', effective_tenant_id(), 'espcndb', 't')
|
||||
-1
|
||||
connection default;
|
||||
drop user espcnouser;
|
||||
drop database espcnouser;
|
||||
ERROR HY000: Can't drop database 'espcnouser'; database doesn't exist
|
||||
connection syscon;
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,75 +0,0 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection default;
|
||||
drop table if exists t1;
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select trim(' abc ') x from dual;
|
||||
x
|
||||
abc
|
||||
select trim(leading from ' abc ') x from dual;
|
||||
x
|
||||
abc
|
||||
select trim(trailing from ' abc ') x from dual;
|
||||
x
|
||||
abc
|
||||
select trim(both from ' abc ') x from dual;
|
||||
x
|
||||
abc
|
||||
select trim(both '' from ' abc ') x from dual;
|
||||
x
|
||||
abc
|
||||
select trim(both ' ' from ' abc ') x from dual;
|
||||
x
|
||||
abc
|
||||
select trim(both 'abc' from 'abcabdefabcabc') x from dual;
|
||||
x
|
||||
abdef
|
||||
select trim(both ' ' from ' abc ') x from dual;
|
||||
x
|
||||
abc
|
||||
select trim(both NULL from ' abc ') x from dual;
|
||||
x
|
||||
NULL
|
||||
select trim(both ' ' from NULL) x from dual;
|
||||
x
|
||||
NULL
|
||||
select trim(both 1 from 112311) x from dual;
|
||||
x
|
||||
23
|
||||
select ltrim(' abc ') x from dual;
|
||||
x
|
||||
abc
|
||||
select ltrim(' ') x from dual;
|
||||
x
|
||||
|
||||
select ltrim(NULL) x from dual;
|
||||
x
|
||||
NULL
|
||||
select rtrim(' abc ') x from dual;
|
||||
x
|
||||
abc
|
||||
select rtrim(' ') x from dual;
|
||||
x
|
||||
|
||||
select rtrim(NULL) x from dual;
|
||||
x
|
||||
NULL
|
||||
drop table if exists t1;
|
||||
drop view if exists v1;
|
||||
create view v1 as select nullif(trim(repeat('abc', 1+1)), 'a');
|
||||
desc v1;
|
||||
Field Type Null Key Default Extra
|
||||
nullif(trim(repeat('abc', 1+1)), 'a') longtext NO
|
||||
select * from v1;
|
||||
nullif(trim(repeat('abc', 1+1)), 'a')
|
||||
abcabc
|
||||
create table t1(c1 longtext, c2 varchar(100));
|
||||
insert into t1 values('abababa', 'a');
|
||||
// c1 and c2 will cast to longtext
|
||||
select trim(leading c2 from c1) from t1;
|
||||
trim(leading c2 from c1)
|
||||
bababa
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
connection syscon;
|
File diff suppressed because it is too large
Load Diff
@ -1,16 +0,0 @@
|
||||
connect sys, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection default;
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 varchar(2000));
|
||||
insert into t1 values(hex("ABC")), (hex("123"));
|
||||
connection sys;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select unhex(c1) from t1;
|
||||
unhex(c1)
|
||||
ABC
|
||||
123
|
||||
select unhex("4142") from dual;
|
||||
unhex("4142")
|
||||
AB
|
||||
connection sys;
|
@ -1,83 +0,0 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,oceanbase,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
alter system flush plan cache global;
|
||||
set ob_enable_plan_cache = 0;
|
||||
select unix_timestamp(NULL);
|
||||
unix_timestamp(NULL)
|
||||
NULL
|
||||
select unix_timestamp('');
|
||||
unix_timestamp('')
|
||||
0.000000
|
||||
select unix_timestamp('2010-01-01 10:50:50.123');
|
||||
unix_timestamp('2010-01-01 10:50:50.123')
|
||||
1262314250.123
|
||||
select unix_timestamp(123);
|
||||
unix_timestamp(123)
|
||||
948556800
|
||||
drop table if exists t1;
|
||||
create table t1 (col_datetime_4_not_null datetime(4) not null);
|
||||
insert into t1 values
|
||||
('0000-00-00 00:00:00.0000'),('2006-05-12 07:06:44.0441'),('2007-11-08 00:00:00.0000'), ('2007-07-23 00:00:00.0000'),('2006-01-10 22:19:14.0158'),('2006-09-13 18:54:05.0013'), ('2002-03-26 00:00:00.0000'),('2002-10-22 10:53:06.0151'),('0000-00-00 00:00:00.0000'),('2001-06-04 00:00:00.0000'),('0000-00-00 00:00:00.0000'),('2000-12-11 10:47:58.0505'), ('2009-04-21 20:01:40.0570'),('2007-03-12 10:48:41.0031'),('0000-00-00 00:00:00.0000'), ('2009-06-22 00:00:00.0000'),('2008-01-21 15:28:44.0592'),('2003-10-05 00:43:55.0577'), ('2002-11-04 00:46:30.0630'),('2006-01-19 11:38:03.0378'),('0000-00-00 00:00:00.0000'), ('2001-02-04 00:00:00.0000'),('2004-10-22 21:59:04.0394'),('2006-03-20 18:54:13.0139'), ('2004-06-09 03:17:31.0403'),('0000-00-00 00:00:00.0000'),('2003-06-01 17:59:12.0365'), ('0000-00-00 00:00:00.0000'),('2009-06-15 08:58:58.0329'),('0000-00-00 00:00:00.0000'), ('2004-03-26 00:00:00.0000'),('2009-04-27 00:00:00.0000'),('2000-09-07 00:00:00.0000'), ('2006-11-04 00:51:03.0501'),('2005-02-20 00:30:47.0647'),('0000-00-00 00:00:00.0000'), ('2004-12-07 00:00:00.0000'),('0000-00-00 00:00:00.0000'),('0000-00-00 00:00:00.0000'), ('2002-08-17 00:27:20.0536'),('2006-10-12 12:12:28.0337'),('0000-00-00 00:00:00.0000'), ('0000-00-00 00:00:00.0000'),('2009-09-09 14:16:05.0354'),('2000-02-25 00:00:00.0000'), ('2003-12-16 05:38:37.0626'),('2000-10-05 03:46:43.0067'),('0000-00-00 00:00:00.0000'), ('2000-10-08 06:45:51.0547'),('0000-00-00 00:00:00.0000'),('2000-04-06 01:46:21.0620'), ('2001-08-10 23:15:40.0304'),('2001-06-24 10:14:00.0497'),('0000-00-00 00:00:00.0000'), ('0000-00-00 00:00:00.0000'),('2004-10-22 00:00:00.0000'),('0000-00-00 00:00:00.0000'), ('0000-00-00 00:00:00.0000'),('2005-08-23 06:34:23.0058'),('2005-03-28 18:34:18.0138'),('2004-05-18 00:00:00.0000');
|
||||
select col_datetime_4_not_null, unix_timestamp(col_datetime_4_not_null) from t1 order by 1;
|
||||
col_datetime_4_not_null unix_timestamp(col_datetime_4_not_null)
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
0000-00-00 00:00:00.0000 0.0000
|
||||
2000-02-25 00:00:00.0000 951408000.0000
|
||||
2000-04-06 01:46:21.0620 954956781.0620
|
||||
2000-09-07 00:00:00.0000 968256000.0000
|
||||
2000-10-05 03:46:43.0067 970688803.0067
|
||||
2000-10-08 06:45:51.0547 970958751.0547
|
||||
2000-12-11 10:47:58.0505 976502878.0505
|
||||
2001-02-04 00:00:00.0000 981216000.0000
|
||||
2001-06-04 00:00:00.0000 991584000.0000
|
||||
2001-06-24 10:14:00.0497 993348840.0497
|
||||
2001-08-10 23:15:40.0304 997456540.0304
|
||||
2002-03-26 00:00:00.0000 1017072000.0000
|
||||
2002-08-17 00:27:20.0536 1029515240.0536
|
||||
2002-10-22 10:53:06.0151 1035255186.0151
|
||||
2002-11-04 00:46:30.0630 1036341990.0630
|
||||
2003-06-01 17:59:12.0365 1054461552.0365
|
||||
2003-10-05 00:43:55.0577 1065285835.0577
|
||||
2003-12-16 05:38:37.0626 1071524317.0626
|
||||
2004-03-26 00:00:00.0000 1080230400.0000
|
||||
2004-05-18 00:00:00.0000 1084809600.0000
|
||||
2004-06-09 03:17:31.0403 1086722251.0403
|
||||
2004-10-22 00:00:00.0000 1098374400.0000
|
||||
2004-10-22 21:59:04.0394 1098453544.0394
|
||||
2004-12-07 00:00:00.0000 1102348800.0000
|
||||
2005-02-20 00:30:47.0647 1108830647.0647
|
||||
2005-03-28 18:34:18.0138 1112006058.0138
|
||||
2005-08-23 06:34:23.0058 1124750063.0058
|
||||
2006-01-10 22:19:14.0158 1136902754.0158
|
||||
2006-01-19 11:38:03.0378 1137641883.0378
|
||||
2006-03-20 18:54:13.0139 1142852053.0139
|
||||
2006-05-12 07:06:44.0441 1147388804.0441
|
||||
2006-09-13 18:54:05.0013 1158144845.0013
|
||||
2006-10-12 12:12:28.0337 1160626348.0337
|
||||
2006-11-04 00:51:03.0501 1162572663.0501
|
||||
2007-03-12 10:48:41.0031 1173667721.0031
|
||||
2007-07-23 00:00:00.0000 1185120000.0000
|
||||
2007-11-08 00:00:00.0000 1194451200.0000
|
||||
2008-01-21 15:28:44.0592 1200900524.0592
|
||||
2009-04-21 20:01:40.0570 1240315300.0570
|
||||
2009-04-27 00:00:00.0000 1240761600.0000
|
||||
2009-06-15 08:58:58.0329 1245027538.0329
|
||||
2009-06-22 00:00:00.0000 1245600000.0000
|
||||
2009-09-09 14:16:05.0354 1252476965.0354
|
@ -1,103 +0,0 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection default;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t111_var;
|
||||
create table t1(c1 int,c2 int,c3 int);
|
||||
create table t2(c1 int,c2 int,c3 int);
|
||||
insert into t1 values(1,2,3);
|
||||
insert into t1 values(1,2,3);
|
||||
insert into t1 values(0,2,3);
|
||||
insert into t1 values(2,2,3);
|
||||
insert into t1 values(3,2,3);
|
||||
insert into t2 values(2,2,3);
|
||||
insert into t2 values(2,0,3);
|
||||
insert into t2 values(0,2,3);
|
||||
insert into t2 values(1,2,3);
|
||||
insert into t2 values(null,2,3);
|
||||
insert into t2 values(1,2,3);
|
||||
insert into t2 values(0,2,1);
|
||||
insert into t2 values(2,2,3);
|
||||
commit;
|
||||
create table t111_var(c0 bigint,c1 varchar(4000), c2 varchar(4000), c3 varchar(4000), c4 varchar(4000), c5 varchar(4000),c6 varchar(4000), c7 longtext);
|
||||
insert into t111_var values(1,repeat('ab',2000),repeat('ab',2000),repeat('ab',2000),repeat('ab',2000),repeat('ab',2000),repeat('ab',2000),repeat('abcdefghij',4000));
|
||||
insert into t111_var select c0+1,c1,c2,c3,c4,c5,c6,c7 from t111_var;
|
||||
insert into t111_var select c0+10,c1,c2,c3,c4,c5,c6,c7 from t111_var;
|
||||
insert into t111_var select c0+100,c1,c2,c3,c4,c5,c6,c7 from t111_var;
|
||||
insert into t111_var select c0+1000,c1,c2,c3,c4,c5,c6,c7 from t111_var;
|
||||
insert into t111_var select c0+10000,c1,c2,c3,c4,c5,c6,c7 from t111_var;
|
||||
insert into t111_var select c0+100000,c1,c2,c3,c4,c5,c6,c7 from t111_var;
|
||||
insert into t111_var select c0+1000000,c1,c2,c3,c4,c5,c6,c7 from t111_var;
|
||||
insert into t111_var select c0+10000000,c1,c2,c3,c4,c5,c6,c7 from t111_var;
|
||||
insert into t111_var select c0+100000000,c1,c2,c3,c4,c5,c6,c7 from t111_var;
|
||||
insert into t111_var values(null,null,null,null,null,null,null,null);
|
||||
insert into t111_var select * from t111_var;
|
||||
commit;
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select /*+ USE_HASH_AGGREGATION */distinct c1,c2 from t2;
|
||||
c1 c2
|
||||
2 2
|
||||
2 0
|
||||
0 2
|
||||
1 2
|
||||
NULL 2
|
||||
select /*+ USE_HASH_AGGREGATION */distinct c2,c1 from t2;
|
||||
c2 c1
|
||||
2 2
|
||||
0 2
|
||||
2 0
|
||||
2 1
|
||||
2 NULL
|
||||
select /*+ USE_HASH_AGGREGATION */distinct c2,c1,c1+c2 from t2;
|
||||
c2 c1 c1+c2
|
||||
2 2 4
|
||||
0 2 2
|
||||
2 0 2
|
||||
2 1 3
|
||||
2 NULL NULL
|
||||
select /*+ USE_HASH_AGGREGATION */distinct c1+c2,abs(c1) from t2;
|
||||
c1+c2 abs(c1)
|
||||
4 2
|
||||
2 2
|
||||
2 0
|
||||
3 1
|
||||
NULL NULL
|
||||
select /*+ USE_HASH_AGGREGATION */distinct c1+c2 from t2;
|
||||
c1+c2
|
||||
4
|
||||
2
|
||||
3
|
||||
NULL
|
||||
select /*+ USE_HASH_AGGREGATION */distinct c2,c1,c3 from t2;
|
||||
c2 c1 c3
|
||||
2 2 3
|
||||
0 2 3
|
||||
2 0 3
|
||||
2 1 3
|
||||
2 NULL 3
|
||||
2 0 1
|
||||
select /*+ USE_HASH_AGGREGATION */distinct 1,2,3,5,'ab' from t2;
|
||||
1 2 3 5 ab
|
||||
1 2 3 5 ab
|
||||
select /*+ USE_HASH_AGGREGATION */distinct 1,c2,2,3,c1,5,'ab' from t2;
|
||||
1 c2 2 3 c1 5 ab
|
||||
1 2 2 3 2 5 ab
|
||||
1 0 2 3 2 5 ab
|
||||
1 2 2 3 0 5 ab
|
||||
1 2 2 3 1 5 ab
|
||||
1 2 2 3 NULL 5 ab
|
||||
select /*+ USE_HASH_AGGREGATION */distinct 1,c2,2,3,c1,5,'ab' from t2 where c2=0;
|
||||
1 c2 2 3 c1 5 ab
|
||||
1 0 2 3 2 5 ab
|
||||
set ob_query_timeout=30000000;
|
||||
select /*+ use_merge(a b) */SQL_CALC_FOUND_ROWS sum(c0),sum(length(c1)),count(c2),count(c3),count(c4),count(c5),count(c6),count(c7)
|
||||
from (select /*+ USE_HASH_AGGREGATION */ distinct * from t111_var) order by c1 limit 1;
|
||||
sum(c0) sum(length(c1)) count(c2) count(c3) count(c4) count(c5) count(c6) count(c7)
|
||||
28444444928 2048000 512 512 512 512 512 512
|
||||
connection syscon;
|
||||
connection default;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t111_var;
|
@ -1,128 +0,0 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
drop tenant dump_tenant force;
|
||||
drop resource pool new_pool1;
|
||||
drop resource unit new_box1;
|
||||
connect conn1,$OBMYSQL_MS0,root@dump_tenant,,test,$OBMYSQL_PORT;
|
||||
set global parallel_max_servers=10;
|
||||
set global parallel_servers_target=10;
|
||||
alter system set _sort_area_size='2M';
|
||||
alter system set _hash_area_size='4M';
|
||||
drop table t11_set;
|
||||
drop table t22_set;
|
||||
drop table t111_var;
|
||||
drop table t333_var;
|
||||
create table t11_set(c1 int,c2 int);
|
||||
create table t22_set(c1 int,c2 int);
|
||||
insert into t11_set values(null,null);
|
||||
insert into t11_set values(1,1);
|
||||
insert into t11_set values(5,5);
|
||||
insert into t11_set values(1,1);
|
||||
insert into t11_set values(5,5);
|
||||
insert into t11_set values(12,12);
|
||||
insert into t11_set values(12,12);
|
||||
insert into t11_set values(22,22);
|
||||
insert into t11_set values(26,26);
|
||||
insert into t11_set values(22,22);
|
||||
insert into t11_set values(26,26);
|
||||
insert into t22_set select * from t11_set;
|
||||
create table t111_var(c0 bigint primary key,c1 varchar(4000), c2 varchar(4000), c3 varchar(4000), c4 varchar(4000), c5 varchar(4000),c6 varchar(4000), c7 longtext);
|
||||
insert into t111_var values(1,repeat('ab',1000),repeat('ab',1000),repeat('ab',1000),repeat('ab',1000),repeat('ab',1000),repeat('ab',1000),repeat('a',4000));
|
||||
insert into t111_var select c0+1,c1,c2,c3,c4,c5,c6,c7 from t111_var;
|
||||
insert into t111_var select c0+10,c1,c2,c3,c4,c5,c6,c7 from t111_var;
|
||||
insert into t111_var select c0+100,c1,c2,c3,c4,c5,c6,c7 from t111_var;
|
||||
insert into t111_var select c0+1000,c1,c2,c3,c4,c5,c6,c7 from t111_var;
|
||||
insert into t111_var select c0+10000,c1,c2,c3,c4,c5,c6,c7 from t111_var;
|
||||
insert into t111_var select c0+100000,c1,c2,c3,c4,c5,c6,c7 from t111_var;
|
||||
insert into t111_var select c0+1000000,c1,c2,c3,c4,c5,c6,c7 from t111_var;
|
||||
insert into t111_var select c0+10000000,c1,c2,c3,c4,c5,c6,c7 from t111_var;
|
||||
insert into t111_var select c0+100000000,c1,c2,c3,c4,c5,c6,c7 from t111_var;
|
||||
commit;
|
||||
create table t333_var(c0 bigint ,c1 varchar(4000), c2 varchar(4000), c3 varchar(4000), c4 varchar(4000), c5 varchar(4000),c6 varchar(4000), c7 longtext);
|
||||
insert into t333_var values(1,repeat('ab',1000),repeat('ab',1000),repeat('ab',1000),repeat('ab',1000),repeat('ab',1000),repeat('ab',1000),repeat('a',4000));
|
||||
insert into t333_var select c0+1,c1,c2,c3,c4,c5,c6,c7 from t333_var;
|
||||
insert into t333_var select c0+10,c1,c2,c3,c4,c5,c6,c7 from t333_var;
|
||||
insert into t333_var select c0+100,c1,c2,c3,c4,c5,c6,c7 from t333_var;
|
||||
insert into t333_var select c0+1000,c1,c2,c3,c4,c5,c6,c7 from t333_var;
|
||||
insert into t333_var select c0+10000,c1,c2,c3,c4,c5,c6,c7 from t333_var;
|
||||
insert into t333_var select c0+100000,c1,c2,c3,c4,c5,c6,c7 from t333_var;
|
||||
insert into t333_var select c0+1000000,c1,c2,c3,c4,c5,c6,c7 from t333_var;
|
||||
insert into t333_var select c0+10000000,c1,c2,c3,c4,c5,c6,c7 from t333_var;
|
||||
insert into t333_var select c0+100000000,c1,c2,c3,c4,c5,c6,c7 from t333_var;
|
||||
insert into t333_var values(null,null,null,null,null,null,null,null);
|
||||
commit;
|
||||
select c1,c2 from t11_set union select c1,c2 from t22_set where c1 > 5 and c1 != 12;
|
||||
c1 c2
|
||||
NULL NULL
|
||||
1 1
|
||||
5 5
|
||||
12 12
|
||||
22 22
|
||||
26 26
|
||||
select c1,c2 from t11_set intersect select c1,c2 from t22_set where c1 > 5 and c1 != 12;
|
||||
c1 c2
|
||||
22 22
|
||||
26 26
|
||||
select c1,c2 from t11_set minus select c1,c2 from t22_set where c1 > 5 and c1 != 12;
|
||||
c1 c2
|
||||
NULL NULL
|
||||
1 1
|
||||
5 5
|
||||
12 12
|
||||
select c1,c2 from t11_set where c1 > 5 and c1 != 12 union select c1,c2 from t22_set;
|
||||
c1 c2
|
||||
22 22
|
||||
26 26
|
||||
NULL NULL
|
||||
1 1
|
||||
5 5
|
||||
12 12
|
||||
select c1,c2 from t11_set where c1 > 5 and c1 != 12 intersect select c1,c2 from t22_set;
|
||||
c1 c2
|
||||
22 22
|
||||
26 26
|
||||
select c1,c2 from t11_set where c1 > 5 and c1 != 12 minus select c1,c2 from t22_set;
|
||||
c1 c2
|
||||
select c1,c2 from t11_set union select c1,c2 from t22_set where c1 <22;
|
||||
c1 c2
|
||||
NULL NULL
|
||||
1 1
|
||||
5 5
|
||||
12 12
|
||||
22 22
|
||||
26 26
|
||||
select c1,c2 from t11_set intersect select c1,c2 from t22_set where c1 <22;
|
||||
c1 c2
|
||||
1 1
|
||||
5 5
|
||||
12 12
|
||||
select c1,c2 from t11_set minus select c1,c2 from t22_set where c1 <22;
|
||||
c1 c2
|
||||
NULL NULL
|
||||
22 22
|
||||
26 26
|
||||
set ob_query_timeout=30000000;
|
||||
select /*+ use_merge(a b) */SQL_CALC_FOUND_ROWS sum(c0),sum(length(c1)),count(c2),count(c3),count(c4),count(c5),count(c6),count(c7)
|
||||
from (select * from t111_var a union select * from t333_var b) order by c1 limit 1;
|
||||
sum(c0) sum(length(c1)) count(c2) count(c3) count(c4) count(c5) count(c6) count(c7)
|
||||
28444444928 1024000 512 512 512 512 512 512
|
||||
select /*+ use_merge(a b) */SQL_CALC_FOUND_ROWS sum(c0),sum(length(c1)),count(c2),count(c3),count(c4),count(c5),count(c6),count(c7)
|
||||
from (select * from t111_var a intersect select * from t333_var b) order by c1 limit 1;
|
||||
sum(c0) sum(length(c1)) count(c2) count(c3) count(c4) count(c5) count(c6) count(c7)
|
||||
28444444928 1024000 512 512 512 512 512 512
|
||||
select /*+ use_merge(a b) */SQL_CALC_FOUND_ROWS sum(c0),sum(length(c1)),count(c2),count(c3),count(c4),count(c5),count(c6),count(c7)
|
||||
from (select * from t111_var a minus select * from t333_var b) order by c1 limit 1;
|
||||
sum(c0) sum(length(c1)) count(c2) count(c3) count(c4) count(c5) count(c6) count(c7)
|
||||
NULL NULL 0 0 0 0 0 0
|
||||
select operation_type,
|
||||
case when sum(optimal_executions)>0 then 1 else 0 end pass1,
|
||||
case when sum(onepass_executions)>0 then 1 else 0 end pass2,
|
||||
case when sum(multipasses_executions)>0 then 1 else 0 end pass3
|
||||
from oceanbase.gv$sql_workarea where con_id =xxx group by operation_type order by 1,2,3,4;
|
||||
operation_type pass1 pass2 pass3
|
||||
PHY_HASH_EXCEPT 0 1 0
|
||||
PHY_HASH_INTERSECT 0 1 0
|
||||
PHY_HASH_UNION 0 1 0
|
||||
connection syscon;
|
||||
drop tenant dump_tenant force;
|
||||
drop resource pool new_pool1;
|
||||
drop resource unit new_box1;
|
@ -1,69 +0,0 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection default;
|
||||
drop table if exists t1;
|
||||
drop table if exists t2;
|
||||
create table t1(c1 int,c2 int,c3 int);
|
||||
create table t2(c1 int,c2 int,c3 int);
|
||||
insert into t1 values(1,2,3);
|
||||
insert into t1 values(1,2,3);
|
||||
insert into t1 values(0,2,3);
|
||||
insert into t1 values(2,2,3);
|
||||
insert into t1 values(3,2,3);
|
||||
insert into t2 values(2,2,3);
|
||||
insert into t2 values(2,2,3);
|
||||
insert into t2 values(0,2,3);
|
||||
insert into t2 values(1,2,3);
|
||||
insert into t2 values(null,2,3);
|
||||
commit;
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
explain select * from t1,t2;
|
||||
Query Plan
|
||||
===================================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
---------------------------------------------------
|
||||
|0 |NESTED-LOOP JOIN CARTESIAN| |25 |95 |
|
||||
|1 | TABLE SCAN |t1 |5 |37 |
|
||||
|2 | MATERIAL | |5 |40 |
|
||||
|3 | TABLE SCAN |t2 |5 |37 |
|
||||
===================================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([t1.c1], [t1.c2], [t1.c3], [t2.c1], [t2.c2], [t2.c3]), filter(nil),
|
||||
conds(nil), nl_params_(nil)
|
||||
1 - output([t1.c1], [t1.c2], [t1.c3]), filter(nil),
|
||||
access([t1.c1], [t1.c2], [t1.c3]), partitions(p0)
|
||||
2 - output([t2.c1], [t2.c2], [t2.c3]), filter(nil)
|
||||
3 - output([t2.c1], [t2.c2], [t2.c3]), filter(nil),
|
||||
access([t2.c1], [t2.c2], [t2.c3]), partitions(p0)
|
||||
|
||||
select * from t1,t2;
|
||||
c1 c2 c3 c1 c2 c3
|
||||
1 2 3 2 2 3
|
||||
1 2 3 2 2 3
|
||||
1 2 3 0 2 3
|
||||
1 2 3 1 2 3
|
||||
1 2 3 NULL 2 3
|
||||
1 2 3 2 2 3
|
||||
1 2 3 2 2 3
|
||||
1 2 3 0 2 3
|
||||
1 2 3 1 2 3
|
||||
1 2 3 NULL 2 3
|
||||
0 2 3 2 2 3
|
||||
0 2 3 2 2 3
|
||||
0 2 3 0 2 3
|
||||
0 2 3 1 2 3
|
||||
0 2 3 NULL 2 3
|
||||
2 2 3 2 2 3
|
||||
2 2 3 2 2 3
|
||||
2 2 3 0 2 3
|
||||
2 2 3 1 2 3
|
||||
2 2 3 NULL 2 3
|
||||
3 2 3 2 2 3
|
||||
3 2 3 2 2 3
|
||||
3 2 3 0 2 3
|
||||
3 2 3 1 2 3
|
||||
3 2 3 NULL 2 3
|
||||
connection syscon;
|
@ -1,128 +0,0 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection default;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
drop table t4;
|
||||
drop table t5;
|
||||
create table t3(c1 int primary key,c2 int) partition by hash(c1) partitions 5;
|
||||
create table t4(c1 int primary key,c2 int) partition by hash(c1) partitions 6;
|
||||
insert into t3 values(0,0);
|
||||
insert into t3 values(1,0);
|
||||
insert into t3 values(2,1);
|
||||
insert into t3 values(3,2);
|
||||
insert into t3 values(4,3);
|
||||
insert into t3 values(5,4);
|
||||
insert into t3 values(6,5);
|
||||
insert into t4 values(1,0);
|
||||
insert into t4 values(2,1);
|
||||
insert into t4 values(3,2);
|
||||
insert into t4 values(4,3);
|
||||
insert into t4 values(5,4);
|
||||
insert into t4 values(6,5);
|
||||
insert into t4 values(7,5);
|
||||
commit;
|
||||
create table t5(c1 int primary key,c2 int);
|
||||
insert into t5 values(1,1);
|
||||
insert into t5 values(2,2);
|
||||
insert into t5 values(3,3);
|
||||
insert into t5 values(4,4);
|
||||
insert into t5 values(5,5);
|
||||
insert into t5 values(6,6);
|
||||
commit;
|
||||
create table t1(c1 int,c2 int) partition by hash(c1) partitions 5;
|
||||
create table t2(c1 int,c2 int) partition by hash(c2) partitions 6;
|
||||
insert into t1 values(1,1);
|
||||
insert into t1 values(2,2);
|
||||
insert into t1 values(3,3);
|
||||
insert into t1 values(4,4);
|
||||
insert into t1 values(5,5);
|
||||
insert into t1 values(6,6);
|
||||
insert into t2 values(1,1);
|
||||
insert into t2 values(2,2);
|
||||
insert into t2 values(3,3);
|
||||
insert into t2 values(4,4);
|
||||
insert into t2 values(5,5);
|
||||
insert into t2 values(6,6);
|
||||
commit;
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select * from t3 a ;
|
||||
c1 c2
|
||||
0 0
|
||||
5 4
|
||||
1 0
|
||||
6 5
|
||||
2 1
|
||||
3 2
|
||||
4 3
|
||||
select /*+ parallel(2) NO_USE_HASH_AGGREGATION */ a.c1,a.c2+a.c1 from t3 a group by a.c1,a.c2 order by a.c2+1+a.c1;
|
||||
c1 a.c2+a.c1
|
||||
0 0
|
||||
1 1
|
||||
2 3
|
||||
3 5
|
||||
4 7
|
||||
5 9
|
||||
6 11
|
||||
select /*+ parallel(2) pq_distribute(a hash hash) NO_USE_HASH_AGGREGATION */ a.c1,a.c2 from t3 a right outer join t3 b on a.c2=b.c1 order by a.c1,a.c2;
|
||||
c1 c2
|
||||
NULL NULL
|
||||
0 0
|
||||
1 0
|
||||
2 1
|
||||
3 2
|
||||
4 3
|
||||
5 4
|
||||
6 5
|
||||
select /*+ parallel(2) pq_distribute(a hash hash) NO_USE_HASH_AGGREGATION */ a.c1,a.c2 from t3 a right outer join t3 b on a.c2+2=b.c1+1 order by a.c1,a.c2+2;
|
||||
c1 c2
|
||||
NULL NULL
|
||||
0 0
|
||||
1 0
|
||||
2 1
|
||||
3 2
|
||||
4 3
|
||||
5 4
|
||||
6 5
|
||||
select /*+ parallel(2) pq_distribute(a hash hash) NO_USE_HASH_AGGREGATION */ a.c1,a.c2 from t3 a right outer join t3 b on abs(a.c2)+2=b.c1 order by a.c1,a.c2+2;
|
||||
c1 c2
|
||||
NULL NULL
|
||||
NULL NULL
|
||||
0 0
|
||||
1 0
|
||||
2 1
|
||||
3 2
|
||||
4 3
|
||||
5 4
|
||||
select /*+ parallel(2) pq_distribute(b broadcast none) */ * from t1 a, t2 b where a.c1=b.c2 order by a.c1,b.c1;
|
||||
c1 c2 c1 c2
|
||||
1 1 1 1
|
||||
2 2 2 2
|
||||
3 3 3 3
|
||||
4 4 4 4
|
||||
5 5 5 5
|
||||
6 6 6 6
|
||||
select /*+ parallel(2) pq_distribute(b broadcast none) */ * from t1 a, t2 b where a.c1+2=b.c2 + 1 order by a.c1,b.c1+2;
|
||||
c1 c2 c1 c2
|
||||
1 1 2 2
|
||||
2 2 3 3
|
||||
3 3 4 4
|
||||
4 4 5 5
|
||||
5 5 6 6
|
||||
select /*+ use_px parallel(2) */ c2,sum(c1) from (select a.c1,b.c2 from t5 a , t5 b where a.c1=b.c2) group by c2 order by 1,2;
|
||||
c2 sum(c1)
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
4 4
|
||||
5 5
|
||||
6 6
|
||||
connection syscon;
|
||||
connection default;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
drop table t4;
|
||||
drop table t5;
|
@ -1,128 +0,0 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
// Case1: normal test,测试是否将带参数的case转为不带参数的case
|
||||
// Case2: 测试case表达式里面有列的情况
|
||||
// Case3: 测试空串以及NULL的情况
|
||||
connection conn_admin;
|
||||
alter system flush plan cache global;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
// Case1: normal test.
|
||||
// 所有带参数的case表达式都被转为不带参数的case表达式
|
||||
select case 1 when 1 then 'a' when 2 then 'b' else 'c' end from dual;
|
||||
case 1 when 1 then 'a' when 2 then 'b' else 'c' end
|
||||
a
|
||||
// 应该命中else expr
|
||||
select case 100 when 1 then 'a' when 2 then 'b' else 'c' end from dual;
|
||||
case 100 when 1 then 'a' when 2 then 'b' else 'c' end
|
||||
c
|
||||
|
||||
// MySQL允许各个when/then expr结果类型不一致
|
||||
// 1和'1'的类型不一致,会被加上cast,都被转为decimal再进行比较,返回'a'
|
||||
select case 1 when '1' then 'a' when 2 then 'b' else 'c' end from dual;
|
||||
case 1 when '1' then 'a' when 2 then 'b' else 'c' end
|
||||
a
|
||||
// 第二个then 应该要加cast,返回'a'
|
||||
select case 1 when 1 then 'a' when 2 then 'b' else 3 end from dual;
|
||||
case 1 when 1 then 'a' when 2 then 'b' else 3 end
|
||||
a
|
||||
// 不带参数的case的测试
|
||||
// normal test
|
||||
// 应该返回'a'
|
||||
select case when 1=1 then 'a' when 2 then 'b' else 'c' end from dual;
|
||||
case when 1=1 then 'a' when 2 then 'b' else 'c' end
|
||||
a
|
||||
// 应该返回'c'
|
||||
select case when 0=1 then 'a' when 0.0 then 'b' else 'c' end from dual;
|
||||
case when 0=1 then 'a' when 0.0 then 'b' else 'c' end
|
||||
c
|
||||
// 应该返回'a',且0='1'中要加cast
|
||||
select case when 1='1' then 'a' when 2 then 'b' else 'c' end from dual;
|
||||
case when 1='1' then 'a' when 2 then 'b' else 'c' end
|
||||
a
|
||||
// 应该返回'c',且0='1'中要加cast
|
||||
select case when 0='1' then 'a' when 0.0 then 'b' else 'c' end from dual;
|
||||
case when 0='1' then 'a' when 0.0 then 'b' else 'c' end
|
||||
c
|
||||
// Case2: 测试建表的情况
|
||||
drop table if exists t1;
|
||||
create table t1 (col_null int, col_int int, col_char char);
|
||||
insert into t1 values(null, 1, 'a');
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
alter system flush plan cache global;
|
||||
// 测试int的normal case,应该返回'a'
|
||||
select case col_int when 1 then 'a' when 2 then 'b' else 'c' end from t1;
|
||||
case col_int when 1 then 'a' when 2 then 'b' else 'c' end
|
||||
a
|
||||
// 测试int需要加cast的情况,第一个when需要加cast, 第二个when不需要
|
||||
select case col_int when '1' then 'a' when 2 then 'b' else 'c' end from t1;
|
||||
case col_int when '1' then 'a' when 2 then 'b' else 'c' end
|
||||
a
|
||||
// 测试null的情况,应该返回'c',而且没有cast出现
|
||||
select case col_null when 1 then 'a' when 2 then 'b' else 'c' end from t1;
|
||||
case col_null when 1 then 'a' when 2 then 'b' else 'c' end
|
||||
c
|
||||
// Case3: 测试空串以及NULL的情况
|
||||
// 应该返回1, MySQL没有把空串看成NULL
|
||||
select case '' when '' then 1 when 'here' then 2 else 'hh' end from dual;
|
||||
case '' when '' then 1 when 'here' then 2 else 'hh' end
|
||||
1
|
||||
// 应该返回'hh'
|
||||
select case NULL when NULL then 1 when 'here' then 2 else 'hh' end from dual;
|
||||
case NULL when NULL then 1 when 'here' then 2 else 'hh' end
|
||||
hh
|
||||
// 应该返回1, MySQL没有把空串看成NULL
|
||||
select case when '' = '' then 1 when 'here' then 2 else 'hh' end from dual;
|
||||
case when '' = '' then 1 when 'here' then 2 else 'hh' end
|
||||
1
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'here'
|
||||
// 应该返回'hh', 因为'here'cast为double会失败,返回值应该是0
|
||||
select case when NULL=NULL then 1 when 'here' then 2 else 'hh' end from dual;
|
||||
case when NULL=NULL then 1 when 'here' then 2 else 'hh' end
|
||||
hh
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect DOUBLE value: 'here'
|
||||
// Case4: 测试不同字符集,大小写问题
|
||||
drop table t1;
|
||||
create table t1 (a varchar(100) collate utf8_general_ci, cond1 varchar(100) collate utf8_bin, cond2 varchar(100) collate utf8_general_ci);
|
||||
insert into t1 values('cond', 'COND', 'COND');
|
||||
// 返回Null,a和cond1以及a和cond2比较都会使用utf8_bin作为collation type(因为有aggregate collation的过程)
|
||||
select case a when cond1 then '1' when cond2 then '2' end from t1;
|
||||
case a when cond1 then '1' when cond2 then '2' end
|
||||
NULL
|
||||
// 返回'neq', a和cond1比较使用的是utf8_bin
|
||||
select case a when cond1 then 'eq' else 'neq' end from t1;
|
||||
case a when cond1 then 'eq' else 'neq' end
|
||||
neq
|
||||
// 返回'eq', a和cond1比较使用的是utf8_general_ci
|
||||
select case a when cond2 then 'eq' else 'neq' end from t1;
|
||||
case a when cond2 then 'eq' else 'neq' end
|
||||
eq
|
||||
// arg case子节点也是arg case的情况测试,应该都被改为case expr(应该返回'ok')
|
||||
select case case a when 'cond' then 'eq' else 'neq' end when 'eq' then 'ok' else 'not ok' end from t1;
|
||||
case case a when 'cond' then 'eq' else 'neq' end when 'eq' then 'ok' else 'not ok' end
|
||||
ok
|
||||
// Case5: show create view/table
|
||||
drop view if exists v1;
|
||||
drop table if exists t2;
|
||||
create view v1 as select case case a when 'cond' then 'eq' else 'neq' end when 'eq' then 'ok' else 'not ok' end from t1;
|
||||
select * from v1;
|
||||
Name_exp_1
|
||||
ok
|
||||
// arg case expr的改写不应该影响show create view,结果应该还是arg case expr 而非改写后的case expr
|
||||
show create view v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE VIEW `v1` AS select (case (case `test`.`t1`.`a` when 'cond' then 'eq' else 'neq' end) when 'eq' then 'ok' else 'not ok' end) AS `Name_exp_1` from `test`.`t1` utf8mb4 utf8mb4_general_ci
|
||||
drop view v1;
|
||||
create table t2 as select case case a when 'cond' then 'eq' else 'neq' end when 'eq' then 'ok' else 'not ok' end from t1;
|
||||
select * from t2;
|
||||
case case a when 'cond' then 'eq' else 'neq' end when 'eq' then 'ok' else 'not ok' end
|
||||
ok
|
||||
// arg case expr的改写不应该影响show create table,结果应该还是arg case expr 而非改写后的case expr
|
||||
show create table t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`case case a when 'cond' then 'eq' else 'neq' end when 'eq' then 'ok' else 'not ok' end` varchar(6) NOT NULL
|
||||
) DEFAULT CHARSET = utf8mb4 ROW_FORMAT = COMPACT COMPRESSION = 'lz4_1.0' REPLICA_NUM = NUM BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 0
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
alter system set _enable_static_typing_engine = false;
|
@ -1,288 +0,0 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
alter system flush plan cache global;
|
||||
connection default;
|
||||
set ob_enable_plan_cache=false;
|
||||
drop table if exists t;
|
||||
create table t (tinyint_t tinyint,
|
||||
smallint_t smallint,
|
||||
mediumint_t mediumint,
|
||||
int32_t integer,
|
||||
bigint_t bigint,
|
||||
utinyint_t tinyint unsigned,
|
||||
usmallint_t smallint unsigned,
|
||||
umedium_t mediumint unsigned,
|
||||
uint32_t integer unsigned,
|
||||
ubigint_t bigint unsigned,
|
||||
float_t float,
|
||||
ufloat_t float unsigned,
|
||||
double_t double,
|
||||
udouble_t double unsigned,
|
||||
number_t number,
|
||||
unumber_t number unsigned,
|
||||
datetime_t datetime,
|
||||
timestamp_t timestamp,
|
||||
date_t date,
|
||||
time_t time,
|
||||
year_t year,
|
||||
varchar_t varchar(255),
|
||||
char_t char(255),
|
||||
tinytext_t tinytext,
|
||||
mediumtext_t mediumtext,
|
||||
longtext_t longtext,
|
||||
bit_t bit,
|
||||
enum_t enum('a', 'b', 'c'),
|
||||
set_t set('a', 'b', 'c'));
|
||||
insert into t values (NULL, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.0, 1.00, 1.000, 1.0000, 1.00000, 1.000000,
|
||||
'1993-03-20', '1993-03-20', '1993-03-20', '10:10:10', '1993', '1.0', '1.00', '1.000', '1.0000',
|
||||
'1.00000', 1, 'b', 'b');
|
||||
connection conn_admin;
|
||||
connection default;
|
||||
select NULL = tinyint_t from t limit 1;
|
||||
NULL = tinyint_t
|
||||
NULL
|
||||
select NULL = smallint_t from t limit 1;
|
||||
NULL = smallint_t
|
||||
NULL
|
||||
select NULL = mediumint_t from t limit 1;
|
||||
NULL = mediumint_t
|
||||
NULL
|
||||
select NULL = int32_t from t limit 1;
|
||||
NULL = int32_t
|
||||
NULL
|
||||
select NULL = bigint_t from t limit 1;
|
||||
NULL = bigint_t
|
||||
NULL
|
||||
select NULL = utinyint_t from t limit 1;
|
||||
NULL = utinyint_t
|
||||
NULL
|
||||
select NULL = usmallint_t from t limit 1;
|
||||
NULL = usmallint_t
|
||||
NULL
|
||||
select NULL = umedium_t from t limit 1;
|
||||
NULL = umedium_t
|
||||
NULL
|
||||
select NULL = uint32_t from t limit 1;
|
||||
NULL = uint32_t
|
||||
NULL
|
||||
select NULL = ubigint_t from t limit 1;
|
||||
NULL = ubigint_t
|
||||
NULL
|
||||
select NULL = float_t from t limit 1;
|
||||
NULL = float_t
|
||||
NULL
|
||||
select NULL = ufloat_t from t limit 1;
|
||||
NULL = ufloat_t
|
||||
NULL
|
||||
select NULL = double_t from t limit 1;
|
||||
NULL = double_t
|
||||
NULL
|
||||
select NULL = udouble_t from t limit 1;
|
||||
NULL = udouble_t
|
||||
NULL
|
||||
select NULL = number_t from t limit 1;
|
||||
NULL = number_t
|
||||
NULL
|
||||
select NULL = unumber_t from t limit 1;
|
||||
NULL = unumber_t
|
||||
NULL
|
||||
select NULL = datetime_t from t limit 1;
|
||||
NULL = datetime_t
|
||||
NULL
|
||||
select NULL = timestamp_t from t limit 1;
|
||||
NULL = timestamp_t
|
||||
NULL
|
||||
select NULL = date_t from t limit 1;
|
||||
NULL = date_t
|
||||
NULL
|
||||
select NULL = time_t from t limit 1;
|
||||
NULL = time_t
|
||||
NULL
|
||||
select NULL = year_t from t limit 1;
|
||||
NULL = year_t
|
||||
NULL
|
||||
select NULL = varchar_t from t limit 1;
|
||||
NULL = varchar_t
|
||||
NULL
|
||||
select NULL = char_t from t limit 1;
|
||||
NULL = char_t
|
||||
NULL
|
||||
select NULL = tinytext_t from t limit 1;
|
||||
NULL = tinytext_t
|
||||
NULL
|
||||
select NULL = mediumtext_t from t limit 1;
|
||||
NULL = mediumtext_t
|
||||
NULL
|
||||
select NULL = longtext_t from t limit 1;
|
||||
NULL = longtext_t
|
||||
NULL
|
||||
select NULL = bit_t from t limit 1;
|
||||
NULL = bit_t
|
||||
NULL
|
||||
select NULL = enum_t from t limit 1;
|
||||
NULL = enum_t
|
||||
NULL
|
||||
select NULL = set_t from t limit 1;
|
||||
NULL = set_t
|
||||
NULL
|
||||
select tinyint_t = tinyint_t from t limit 1;
|
||||
tinyint_t = tinyint_t
|
||||
NULL
|
||||
select tinyint_t = smallint_t from t limit 1;
|
||||
tinyint_t = smallint_t
|
||||
NULL
|
||||
select tinyint_t = mediumint_t from t limit 1;
|
||||
tinyint_t = mediumint_t
|
||||
NULL
|
||||
select tinyint_t = int32_t from t limit 1;
|
||||
tinyint_t = int32_t
|
||||
NULL
|
||||
select tinyint_t = bigint_t from t limit 1;
|
||||
tinyint_t = bigint_t
|
||||
NULL
|
||||
select tinyint_t = utinyint_t from t limit 1;
|
||||
tinyint_t = utinyint_t
|
||||
NULL
|
||||
select tinyint_t = usmallint_t from t limit 1;
|
||||
tinyint_t = usmallint_t
|
||||
NULL
|
||||
select tinyint_t = umedium_t from t limit 1;
|
||||
tinyint_t = umedium_t
|
||||
NULL
|
||||
select tinyint_t = uint32_t from t limit 1;
|
||||
tinyint_t = uint32_t
|
||||
NULL
|
||||
select tinyint_t = ubigint_t from t limit 1;
|
||||
tinyint_t = ubigint_t
|
||||
NULL
|
||||
select tinyint_t = float_t from t limit 1;
|
||||
tinyint_t = float_t
|
||||
NULL
|
||||
select tinyint_t = ufloat_t from t limit 1;
|
||||
tinyint_t = ufloat_t
|
||||
NULL
|
||||
select tinyint_t = double_t from t limit 1;
|
||||
tinyint_t = double_t
|
||||
NULL
|
||||
select tinyint_t = udouble_t from t limit 1;
|
||||
tinyint_t = udouble_t
|
||||
NULL
|
||||
select tinyint_t = number_t from t limit 1;
|
||||
tinyint_t = number_t
|
||||
NULL
|
||||
select tinyint_t = unumber_t from t limit 1;
|
||||
tinyint_t = unumber_t
|
||||
NULL
|
||||
select tinyint_t = datetime_t from t limit 1;
|
||||
tinyint_t = datetime_t
|
||||
NULL
|
||||
select tinyint_t = timestamp_t from t limit 1;
|
||||
tinyint_t = timestamp_t
|
||||
NULL
|
||||
select tinyint_t = date_t from t limit 1;
|
||||
tinyint_t = date_t
|
||||
NULL
|
||||
select tinyint_t = time_t from t limit 1;
|
||||
tinyint_t = time_t
|
||||
NULL
|
||||
select tinyint_t = year_t from t limit 1;
|
||||
tinyint_t = year_t
|
||||
NULL
|
||||
select tinyint_t = varchar_t from t limit 1;
|
||||
tinyint_t = varchar_t
|
||||
NULL
|
||||
select tinyint_t = char_t from t limit 1;
|
||||
tinyint_t = char_t
|
||||
NULL
|
||||
select tinyint_t = tinytext_t from t limit 1;
|
||||
tinyint_t = tinytext_t
|
||||
NULL
|
||||
select tinyint_t = mediumtext_t from t limit 1;
|
||||
tinyint_t = mediumtext_t
|
||||
NULL
|
||||
select tinyint_t = longtext_t from t limit 1;
|
||||
tinyint_t = longtext_t
|
||||
NULL
|
||||
select tinyint_t = bit_t from t limit 1;
|
||||
tinyint_t = bit_t
|
||||
NULL
|
||||
select tinyint_t = enum_t from t limit 1;
|
||||
tinyint_t = enum_t
|
||||
NULL
|
||||
select tinyint_t = set_t from t limit 1;
|
||||
tinyint_t = set_t
|
||||
NULL
|
||||
Row With NULL
|
||||
select (1, 1) = (1, null) from dual;
|
||||
(1, 1) = (1, null)
|
||||
NULL
|
||||
select (1, 1) = (2, null) from dual;
|
||||
(1, 1) = (2, null)
|
||||
0
|
||||
select (1, 1) < (1, null) from dual;
|
||||
(1, 1) < (1, null)
|
||||
NULL
|
||||
select (1, 1) < (2, null) from dual;
|
||||
(1, 1) < (2, null)
|
||||
1
|
||||
select (1, 1) <= (1, null) from dual;
|
||||
(1, 1) <= (1, null)
|
||||
NULL
|
||||
select (1, 1) <= (2, null) from dual;
|
||||
(1, 1) <= (2, null)
|
||||
1
|
||||
select (1, 1) > (1, null) from dual;
|
||||
(1, 1) > (1, null)
|
||||
NULL
|
||||
select (1, 1) > (2, null) from dual;
|
||||
(1, 1) > (2, null)
|
||||
0
|
||||
select (1, 1) >= (1, null) from dual;
|
||||
(1, 1) >= (1, null)
|
||||
NULL
|
||||
select (1, 1) >= (2, null) from dual;
|
||||
(1, 1) >= (2, null)
|
||||
0
|
||||
select (1, 1) != (1, null) from dual;
|
||||
(1, 1) != (1, null)
|
||||
NULL
|
||||
select (1, 1) != (2, null) from dual;
|
||||
(1, 1) != (2, null)
|
||||
1
|
||||
select (1, 1) = (1, tinyint_t) from t limit 1;
|
||||
(1, 1) = (1, tinyint_t)
|
||||
NULL
|
||||
select (1, 1) = (2, tinyint_t) from t limit 1;
|
||||
(1, 1) = (2, tinyint_t)
|
||||
0
|
||||
select (1, 1) < (1, tinyint_t) from t limit 1;
|
||||
(1, 1) < (1, tinyint_t)
|
||||
NULL
|
||||
select (1, 1) < (2, tinyint_t) from t limit 1;
|
||||
(1, 1) < (2, tinyint_t)
|
||||
1
|
||||
select (1, 1) <= (1, tinyint_t) from t limit 1;
|
||||
(1, 1) <= (1, tinyint_t)
|
||||
NULL
|
||||
select (1, 1) <= (2, tinyint_t) from t limit 1;
|
||||
(1, 1) <= (2, tinyint_t)
|
||||
1
|
||||
select (1, 1) > (1, tinyint_t) from t limit 1;
|
||||
(1, 1) > (1, tinyint_t)
|
||||
NULL
|
||||
select (1, 1) > (2, tinyint_t) from t limit 1;
|
||||
(1, 1) > (2, tinyint_t)
|
||||
0
|
||||
select (1, 1) >= (1, tinyint_t) from t limit 1;
|
||||
(1, 1) >= (1, tinyint_t)
|
||||
NULL
|
||||
select (1, 1) >= (2, tinyint_t) from t limit 1;
|
||||
(1, 1) >= (2, tinyint_t)
|
||||
0
|
||||
select (1, 1) != (1, tinyint_t) from t limit 1;
|
||||
(1, 1) != (1, tinyint_t)
|
||||
NULL
|
||||
select (1, 1) != (2, tinyint_t) from t limit 1;
|
||||
(1, 1) != (2, tinyint_t)
|
||||
1
|
||||
connection conn_admin;
|
@ -1,46 +0,0 @@
|
||||
connect conn_admin, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection conn_admin;
|
||||
alter system set enable_async_syslog = false;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
drop table if exists t1;
|
||||
drop table if exists t2;
|
||||
drop table if exists t3;
|
||||
create table t1(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);
|
||||
insert into t1 values(null,null,null,null,null,null,null,null,null,null,null,null,null,null);
|
||||
insert into t1 values(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11.1, 12.2, 13.3, 14.4);
|
||||
create table t2(c1 date, c2 time, c3 datetime, c4 timestamp, c5 year);
|
||||
insert into t2 values(null,null,null,null,null);
|
||||
insert into t2 values('0000-00-00', '12:34:56', '2019-12-25 12:34:56', '2019-12-25 12:34:56', 2020);
|
||||
create table t3(c1 char(10), c2 varchar(10), c3 binary(10), c4 varbinary(10), c5 blob, c6 text, c7 enum('','abc'), c8 set('','abc'));
|
||||
insert into t3 values(null,null,null,null,null,null,null,null);
|
||||
insert into t3 values('abc', 'abc', 'abc', 'abc', 'abc', 'abc', 'abc', 'abc');
|
||||
connection conn_admin;
|
||||
connection default;
|
||||
select c1, partition_key_v2(null), partition_key_v2(c1), partition_key_v2(c2), partition_key_v2(c3), partition_key_v2(c4), partition_key_v2(c5), partition_key_v2(c6), partition_key_v2(c7), partition_key_v2(c8), partition_key_v2(c9), partition_key_v2(c10), partition_key_v2(c11), partition_key_v2(c12), partition_key_v2(c13), partition_key_v2(c14) from t1;
|
||||
c1 partition_key_v2(null) partition_key_v2(c1) partition_key_v2(c2) partition_key_v2(c3) partition_key_v2(c4) partition_key_v2(c5) partition_key_v2(c6) partition_key_v2(c7) partition_key_v2(c8) partition_key_v2(c9) partition_key_v2(c10) partition_key_v2(c11) partition_key_v2(c12) partition_key_v2(c13) partition_key_v2(c14)
|
||||
NULL 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575
|
||||
1 6960269033020761575 8089716718896805586 4083905729319787502 5173830478357570162 4802761344231991206 208465272938114760 3091397795597481564 6469252686979372057 5312865287321056581 3253817828616337504 7188666914263997357 554171766401687642 1209923708429642637 3652659264439090126 1116622728199546839
|
||||
select partition_key_v2(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14) from t1;
|
||||
partition_key_v2(c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14)
|
||||
8669936285899323595
|
||||
3319342296135249634
|
||||
select c1, partition_key_v2(c1), partition_key_v2(c2), partition_key_v2(c3), partition_key_v2(c4), partition_key_v2(c5) from t2;
|
||||
c1 partition_key_v2(c1) partition_key_v2(c2) partition_key_v2(c3) partition_key_v2(c4) partition_key_v2(c5)
|
||||
NULL 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575
|
||||
0000-00-00 4118494407655268559 7068692680032799961 905094948208870081 6483578642322323262 1051853082033653591
|
||||
select partition_key_v2(c1, c2, c3, c4, c5 from t2;
|
||||
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 'from t2' at line 1
|
||||
select c1, partition_key_v2(c1), partition_key_v2(c2), partition_key_v2(c3), partition_key_v2(c4), partition_key_v2(c5), partition_key_v2(c6), partition_key_v2(c7), partition_key_v2(c8) from t3;
|
||||
c1 partition_key_v2(c1) partition_key_v2(c2) partition_key_v2(c3) partition_key_v2(c4) partition_key_v2(c5) partition_key_v2(c6) partition_key_v2(c7) partition_key_v2(c8)
|
||||
NULL 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575 6960269033020761575
|
||||
abc 258901174748407223 258901174748407223 1050281475281956529 7076783908008484943 7076783908008484943 258901174748407223 4083905729319787502 4083905729319787502
|
||||
select partition_key_v2(c1, c2, c3, c4, c5, c6, c7, c8) from t3;
|
||||
partition_key_v2(c1, c2, c3, c4, c5, c6, c7, c8)
|
||||
6029179996760524639
|
||||
644396205906272596
|
||||
connection conn_admin;
|
||||
connection default;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
@ -1,258 +0,0 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection default;
|
||||
drop table if exists t1;
|
||||
drop table if exists t2;
|
||||
create table t1 (c1 int primary key, c2 decimal, c3 int, c4 varchar(20));
|
||||
create table t2 (c1 int primary key, c2 decimal, c3 int, c4 varchar(20));
|
||||
insert into t1 (c1, c2, c3, c4) values (1, 1, 1, 'a');
|
||||
insert into t1 (c1, c2, c3, c4) values (2, 2, null, 'a');
|
||||
insert into t1 (c1, c2, c3, c4) values (3, 3, null, 'a');
|
||||
insert into t2 (c1, c2, c3, c4) values (1, 1, 1, 'a');
|
||||
insert into t2 (c1, c2, c3, c4) values (2, 2, null, 'a');
|
||||
insert into t2 (c1, c2, c3, c4) values (3, 3, null, 'a');
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
set ob_enable_transformation = off;
|
||||
select (1, 1) = (1, 0);
|
||||
(1, 1) = (1, 0)
|
||||
0
|
||||
select (1, 1) = (1, 1);
|
||||
(1, 1) = (1, 1)
|
||||
1
|
||||
select 1 <=> 1;
|
||||
1 <=> 1
|
||||
1
|
||||
select 1 <=> 0;
|
||||
1 <=> 0
|
||||
0
|
||||
select 1 <=> null;
|
||||
1 <=> null
|
||||
0
|
||||
select null <=> 1;
|
||||
null <=> 1
|
||||
0
|
||||
select null <=> null;
|
||||
null <=> null
|
||||
1
|
||||
select (1, 1) <=> (1, 1);
|
||||
(1, 1) <=> (1, 1)
|
||||
1
|
||||
select (1, null) <=> (1, 1);
|
||||
(1, null) <=> (1, 1)
|
||||
0
|
||||
select (1, null) <=> (1, null);
|
||||
(1, null) <=> (1, null)
|
||||
1
|
||||
select (1, null) <=> (null, null);
|
||||
(1, null) <=> (null, null)
|
||||
0
|
||||
select (null, null) <=> (null, null);
|
||||
(null, null) <=> (null, null)
|
||||
1
|
||||
select (select c1, c2 from t1 where c1 = 1) = (1, 1) from t2 where c1 = 1;
|
||||
(select c1, c2 from t1 where c1 = 1) = (1, 1)
|
||||
1
|
||||
select (select c1, c2 from t1 where c1 = 1) = (c2, c1) from t2 where c1 = 1;
|
||||
(select c1, c2 from t1 where c1 = 1) = (c2, c1)
|
||||
1
|
||||
select (select c1 from t1 where c1 = 1) + 1 from t2 where c1 = 1;
|
||||
(select c1 from t1 where c1 = 1) + 1
|
||||
2
|
||||
select (select c1 from t1 where 1 = 0) + 1 from t2 where c1 = 1;
|
||||
(select c1 from t1 where 1 = 0) + 1
|
||||
NULL
|
||||
select c2 in (select c2 from t2) from t1;
|
||||
c2 in (select c2 from t2)
|
||||
1
|
||||
1
|
||||
1
|
||||
select c2 = any(select c2 from t2) from t1;
|
||||
c2 = any(select c2 from t2)
|
||||
1
|
||||
1
|
||||
1
|
||||
select c2 != any(select c2 from t2) from t1;
|
||||
c2 != any(select c2 from t2)
|
||||
1
|
||||
1
|
||||
1
|
||||
select c2 < any(select c2 from t2) from t1;
|
||||
c2 < any(select c2 from t2)
|
||||
1
|
||||
1
|
||||
0
|
||||
select c2 <= any(select c2 from t2) from t1;
|
||||
c2 <= any(select c2 from t2)
|
||||
1
|
||||
1
|
||||
1
|
||||
select c2 > any(select c2 from t2) from t1;
|
||||
c2 > any(select c2 from t2)
|
||||
0
|
||||
1
|
||||
1
|
||||
select c2 >= any(select c2 from t2) from t1;
|
||||
c2 >= any(select c2 from t2)
|
||||
1
|
||||
1
|
||||
1
|
||||
select c2 <=> any(select c2 from t2) from t1;
|
||||
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 '(select c2 from t2) from t1' at line 1
|
||||
select exists (select * from t2), not exists (select * from t2) from t1;
|
||||
exists (select * from t2) not exists (select * from t2)
|
||||
1 0
|
||||
1 0
|
||||
1 0
|
||||
select exists (select * from t2 where 1 = 0), not exists (select * from t2 where 1 = 0) from t1;
|
||||
exists (select * from t2 where 1 = 0) not exists (select * from t2 where 1 = 0)
|
||||
0 1
|
||||
0 1
|
||||
0 1
|
||||
select c2 = all (select c2 from t2) from t1;
|
||||
c2 = all (select c2 from t2)
|
||||
0
|
||||
0
|
||||
0
|
||||
select c2 = any (select c2 from t2) from t1;
|
||||
c2 = any (select c2 from t2)
|
||||
1
|
||||
1
|
||||
1
|
||||
select c2 = all (select c3 from t2) from t1;
|
||||
c2 = all (select c3 from t2)
|
||||
NULL
|
||||
0
|
||||
0
|
||||
select c2 = any (select c3 from t2) from t1;
|
||||
c2 = any (select c3 from t2)
|
||||
1
|
||||
NULL
|
||||
NULL
|
||||
select c3 = all (select c2 from t2) from t1;
|
||||
c3 = all (select c2 from t2)
|
||||
0
|
||||
NULL
|
||||
NULL
|
||||
select c3 = any (select c2 from t2) from t1;
|
||||
c3 = any (select c2 from t2)
|
||||
1
|
||||
NULL
|
||||
NULL
|
||||
select c3 <=> (select c2 from t2) from t1;
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
select (c1, c3) = all (select c1, c2 from t2) from t1;
|
||||
(c1, c3) = all (select c1, c2 from t2)
|
||||
0
|
||||
0
|
||||
0
|
||||
select (c1, c3) = any (select c1, c2 from t2) from t1;
|
||||
(c1, c3) = any (select c1, c2 from t2)
|
||||
1
|
||||
NULL
|
||||
NULL
|
||||
select (c1, c3) <=> (select c1, c2 from t2) from t1;
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
select exists (select 1);
|
||||
exists (select 1)
|
||||
1
|
||||
select not exists (select 1);
|
||||
not exists (select 1)
|
||||
0
|
||||
select 1 from dual where exists (select c1 from t2);
|
||||
1
|
||||
1
|
||||
select 1 from dual where not exists (select c1 from t2);
|
||||
1
|
||||
select * from t1 where exists (select * from t2 where c1 < 0);
|
||||
c1 c2 c3 c4
|
||||
select * from t1 where exists (select * from t2 where c1 > 0);
|
||||
c1 c2 c3 c4
|
||||
1 1 1 a
|
||||
2 2 NULL a
|
||||
3 3 NULL a
|
||||
select (select c1, c2 from t1 where c1 = 1) = (select c1, c2 from t2 where c1 = 1);
|
||||
(select c1, c2 from t1 where c1 = 1) = (select c1, c2 from t2 where c1 = 1)
|
||||
1
|
||||
select (select c1, c2 from t1 where c1 = 0) = (select c1, c2 from t2 where c1 = 1);
|
||||
(select c1, c2 from t1 where c1 = 0) = (select c1, c2 from t2 where c1 = 1)
|
||||
NULL
|
||||
select (select c1, c2 from t1 where c1 = 1) = (select c1, c2 from t2 where c1 = 0);
|
||||
(select c1, c2 from t1 where c1 = 1) = (select c1, c2 from t2 where c1 = 0)
|
||||
NULL
|
||||
select (select c1, c2 from t1 where c1 = 0) = (select c1, c2 from t2 where c1 = 0);
|
||||
(select c1, c2 from t1 where c1 = 0) = (select c1, c2 from t2 where c1 = 0)
|
||||
NULL
|
||||
select (select c1, c2 from t1 where c1 = 1) <=> (select c1, c2 from t2 where c1 = 1);
|
||||
(select c1, c2 from t1 where c1 = 1) <=> (select c1, c2 from t2 where c1 = 1)
|
||||
1
|
||||
select (select c1, c2 from t1 where c1 = 0) <=> (select c1, c2 from t2 where c1 = 1);
|
||||
(select c1, c2 from t1 where c1 = 0) <=> (select c1, c2 from t2 where c1 = 1)
|
||||
0
|
||||
select (select c1, c2 from t1 where c1 = 1) <=> (select c1, c2 from t2 where c1 = 0);
|
||||
(select c1, c2 from t1 where c1 = 1) <=> (select c1, c2 from t2 where c1 = 0)
|
||||
0
|
||||
select (select c1, c2 from t1 where c1 = 0) <=> (select c1, c2 from t2 where c1 = 0);
|
||||
(select c1, c2 from t1 where c1 = 0) <=> (select c1, c2 from t2 where c1 = 0)
|
||||
1
|
||||
select (select c1, c2 from t1 where c1 > 1) = (select c1, c2 from t2 where c1 = 1);
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
select (select c1, c2 from t1 where c1 = 1) = (select c1, c2 from t2 where c1 > 1);
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
select (select c1, c2 from t1 where c1 > 1) = (select c1, c2 from t2 where c1 > 1);
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
select c1 + (select c2 from t2 where c1 = 2), c2 in (select c3 from t2) from t1;
|
||||
c1 + (select c2 from t2 where c1 = 2) c2 in (select c3 from t2)
|
||||
3 1
|
||||
4 NULL
|
||||
5 NULL
|
||||
select c1 + (select c2 from t2 where c1 = t1.c2 and c3 <= t1.c2) from t1;
|
||||
c1 + (select c2 from t2 where c1 = t1.c2 and c3 <= t1.c2)
|
||||
2
|
||||
NULL
|
||||
NULL
|
||||
select * from t1 where c1 + (select c2 from t2 where c1 = t1.c2 and c3 <= t1.c2) < 10;
|
||||
c1 c2 c3 c4
|
||||
1 1 1 a
|
||||
select (select c1, c2 from t2 where c1 = 1) = (c2, c1) from t1;
|
||||
(select c1, c2 from t2 where c1 = 1) = (c2, c1)
|
||||
1
|
||||
0
|
||||
0
|
||||
select (select c1, c2 from t2 where c1 = 1) = (c1, c2) from t1;
|
||||
(select c1, c2 from t2 where c1 = 1) = (c1, c2)
|
||||
1
|
||||
0
|
||||
0
|
||||
select (c2, c1) <= (select c1, c2 from t2 where c1 = 1) from t1;
|
||||
(c2, c1) <= (select c1, c2 from t2 where c1 = 1)
|
||||
1
|
||||
0
|
||||
0
|
||||
select (c1, c2) <= (select c1, c2 from t2 where c1 = 1) from t1;
|
||||
(c1, c2) <= (select c1, c2 from t2 where c1 = 1)
|
||||
1
|
||||
0
|
||||
0
|
||||
select (select c2, c1 from t2 where c1 = 2) >= (select c1, c2 from t2 where c1 = 1) from t1;
|
||||
(select c2, c1 from t2 where c1 = 2) >= (select c1, c2 from t2 where c1 = 1)
|
||||
1
|
||||
1
|
||||
1
|
||||
select (select c1, c1 from t2 where c1 = 2) >= (select c1, c2 from t2 where c1 = 1) from t1;
|
||||
(select c1, c1 from t2 where c1 = 2) >= (select c1, c2 from t2 where c1 = 1)
|
||||
1
|
||||
1
|
||||
1
|
||||
select c2 > (select c1 from t2 where c3 is not null) from t1;
|
||||
c2 > (select c1 from t2 where c3 is not null)
|
||||
0
|
||||
1
|
||||
1
|
||||
select * from t1 where c2 + (select c1 from t2 where c1 = t1.c2) < 10;
|
||||
c1 c2 c3 c4
|
||||
1 1 1 a
|
||||
2 2 NULL a
|
||||
3 3 NULL a
|
||||
set ob_enable_transformation = on;
|
||||
connection syscon;
|
@ -1,86 +0,0 @@
|
||||
connect syscon, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT;
|
||||
connection default;
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 number, c2 number, c3 char(20), c4 varchar(20), primary key(c1, c2), index i1 (c2));
|
||||
insert into t1 (c1, c2, c3, c4) values (1, 2, 'a', 'b');
|
||||
insert into t1 (c1, c2, c3, c4) values (3, 4, 'c', 'd');
|
||||
insert into t1 (c1, c2, c3, c4) values (5, 1, 'xx', 'yy');
|
||||
insert into t1 (c1, c2, c3, c4) values (5, 2, 'xx', 'yy');
|
||||
insert into t1 (c1, c2, c3, c4) values (7, 5, 'xx1', 'yy2');
|
||||
insert into t1 (c1, c2, c3, c4) values (7, 6, 'xx1', 'yy2');
|
||||
insert into t1 (c1, c2, c3, c4) values (8, 7, 'xx1', 'yy2');
|
||||
alter table t1 add column c5 varchar(20) default 'c5_default';
|
||||
connection syscon;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select * from t1;
|
||||
c1 c2 c3 c4 c5
|
||||
1 2 a b c5_default
|
||||
3 4 c d c5_default
|
||||
5 1 xx yy c5_default
|
||||
5 2 xx yy c5_default
|
||||
7 5 xx1 yy2 c5_default
|
||||
7 6 xx1 yy2 c5_default
|
||||
8 7 xx1 yy2 c5_default
|
||||
select * from t1 order by c1 desc, c2 desc;
|
||||
c1 c2 c3 c4 c5
|
||||
8 7 xx1 yy2 c5_default
|
||||
7 6 xx1 yy2 c5_default
|
||||
7 5 xx1 yy2 c5_default
|
||||
5 2 xx yy c5_default
|
||||
5 1 xx yy c5_default
|
||||
3 4 c d c5_default
|
||||
1 2 a b c5_default
|
||||
select * from t1 where c1 + c2 < 10;
|
||||
c1 c2 c3 c4 c5
|
||||
1 2 a b c5_default
|
||||
3 4 c d c5_default
|
||||
5 1 xx yy c5_default
|
||||
5 2 xx yy c5_default
|
||||
select * from t1 limit 2;
|
||||
c1 c2 c3 c4 c5
|
||||
1 2 a b c5_default
|
||||
3 4 c d c5_default
|
||||
select * from t1 where c1 = 5;
|
||||
c1 c2 c3 c4 c5
|
||||
5 1 xx yy c5_default
|
||||
5 2 xx yy c5_default
|
||||
select * from t1 where c1 = 5 or c1 = 7;
|
||||
c1 c2 c3 c4 c5
|
||||
5 1 xx yy c5_default
|
||||
5 2 xx yy c5_default
|
||||
7 5 xx1 yy2 c5_default
|
||||
7 6 xx1 yy2 c5_default
|
||||
select * from t1 where (c1 = 2 and c2 = 4) or (c1 = 7 and c2 = 5) or (c1 = 8 and c2 = 7);
|
||||
c1 c2 c3 c4 c5
|
||||
7 5 xx1 yy2 c5_default
|
||||
8 7 xx1 yy2 c5_default
|
||||
select * from t1 where c2 = 2 and c1 + c2 < 10 and c4 > c3;
|
||||
c1 c2 c3 c4 c5
|
||||
1 2 a b c5_default
|
||||
5 2 xx yy c5_default
|
||||
select c1, c2 from t1 where c2 > 4;
|
||||
c1 c2
|
||||
7 5
|
||||
7 6
|
||||
8 7
|
||||
***** test index back
|
||||
drop table t1;
|
||||
create table t1(c1 int primary key, c2 int, c3 int, index idx(c2));
|
||||
insert into t1 values(1,1,1), (2,2,2), (3,3,3), (4,4,4),(5,5,5), (6,6,6), (7,7,7);
|
||||
|
||||
select /*+index(t1 idx)*/ c1, c2, c3 from t1 where c2 > 1 and c1 < 4;
|
||||
c1 c2 c3
|
||||
2 2 2
|
||||
3 3 3
|
||||
|
||||
select /*+index(t1 idx)*/ c1, c2, c3 from t1 where c2 > 1 and c3 < 4;
|
||||
c1 c2 c3
|
||||
2 2 2
|
||||
3 3 3
|
||||
select /*+index(t1 idx)*/ c1, c2, c3 from t1 where c3 != 1 limit 2;
|
||||
c1 c2 c3
|
||||
2 2 2
|
||||
3 3 3
|
||||
drop table t1;
|
||||
connection syscon;
|
@ -1,22 +0,0 @@
|
||||
|
||||
--disable_abort_on_error
|
||||
|
||||
|
||||
connect (sys, $OBMYSQL_MS0,admin,$OBMYSQL_PWD,test,$OBMYSQL_PORT);
|
||||
connection default;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
create table t1 (c1 varchar(2000));
|
||||
insert into t1 values(hex("ABC")), (hex("123"));
|
||||
|
||||
connection sys;
|
||||
sleep 2;
|
||||
connection default;
|
||||
set @@ob_enable_plan_cache = 0;
|
||||
select unhex(c1) from t1;
|
||||
select unhex("4142") from dual;
|
||||
|
||||
connection sys;
|
||||
|
||||
--sleep 2
|
File diff suppressed because it is too large
Load Diff
@ -1,505 +0,0 @@
|
||||
DROP DATABASE IF EXISTS DB_PREDICATE_DEDUCE;
|
||||
CREATE DATABASE DB_PREDICATE_DEDUCE;
|
||||
USE DB_PREDICATE_DEDUCE;
|
||||
create table t1(c1 int, c2 int);
|
||||
create table t2(c1 int , c2 int, c3 int, c4 int);
|
||||
create table t3(c1 bigint, c2 varchar(64), c3 datetime);
|
||||
create table is_t1(c1 int);
|
||||
create table is_t2(c1 int, c2 int);
|
||||
create table is_t3(c1 bigint, c2 varchar(64), c3 datetime);
|
||||
insert/*trace*/into t3 values(20101010000000, '020101010000000', '2010-10-10 00:00:00');
|
||||
insert/*trace*/into t1 values(NULL, NULL);
|
||||
insert/*trace*/into t2 values(NULL, NULL, NULL, NULL);
|
||||
= basic test =
|
||||
|
||||
== basic compare: case 1
|
||||
select /*+no_rewrite*/* from t1 a where a.c1 = a.c2 and a.c1 = 2;
|
||||
c1 c2
|
||||
select * from t1 a where a.c1 = a.c2 and a.c1 = 2;
|
||||
c1 c2
|
||||
start transaction;
|
||||
update t1 a set c1 = c2 + 1 where a.c1 = a.c2 and a.c1 = 2;
|
||||
delete from t1 a where a.c1 = a.c2 and a.c1 = 2;
|
||||
insert into is_t2 select * from t1 a where a.c1 = a.c2 and a.c1 = 2;
|
||||
rollback;
|
||||
|
||||
== basic compare: case 2
|
||||
select /*+no_rewrite*/* from t1 a where a.c1 = a.c2 and a.c1 > 2;
|
||||
c1 c2
|
||||
select * from t1 a where a.c1 = a.c2 and a.c1 > 2;
|
||||
c1 c2
|
||||
start transaction;
|
||||
update t1 a set a.c1 = a.c2 + 1 where a.c1 = a.c2 and a.c1 > 2;
|
||||
delete from t1 a where a.c1 = a.c2 and a.c1 > 2;
|
||||
insert into is_t2 select * from t1 a where a.c1 = a.c2 and a.c1 > 2;
|
||||
rollback;
|
||||
|
||||
== basic compare: case 3
|
||||
select /*+no_rewrite*/* from t1 a where a.c1 = a.c2 and a.c1 >= 2;
|
||||
c1 c2
|
||||
select * from t1 a where a.c1 = a.c2 and a.c1 >= 2;
|
||||
c1 c2
|
||||
start transaction;
|
||||
update t1 a set a.c1 = a.c2 + 1 where a.c1 = a.c2 and a.c1 >= 2;
|
||||
delete from t1 a where a.c1 = a.c2 and a.c1 >= 2;
|
||||
insert into is_t2 select * from t1 a where a.c1 = a.c2 and a.c1 >= 2;
|
||||
rollback;
|
||||
|
||||
== basic compare: case 4
|
||||
select /*+no_rewrite*/* from t1 a where a.c1 = a.c2 and a.c1 < 2;
|
||||
c1 c2
|
||||
select * from t1 a where a.c1 = a.c2 and a.c1 < 2;
|
||||
c1 c2
|
||||
start transaction;
|
||||
update t1 a set a.c1 = a.c2 + 1 where a.c1 = a.c2 and a.c1 < 2;
|
||||
delete from t1 a where a.c1 = a.c2 and a.c1 < 2;
|
||||
insert into is_t2 select * from t1 a where a.c1 = a.c2 and a.c1 < 2;
|
||||
rollback;
|
||||
|
||||
== basic compare: case 5
|
||||
select /*+no_rewrite*/* from t1 a where a.c1 = a.c2 and a.c1 <= 2;
|
||||
c1 c2
|
||||
select * from t1 a where a.c1 = a.c2 and a.c1 <= 2;
|
||||
c1 c2
|
||||
start transaction;
|
||||
update t1 a set a.c1 = a.c2 + 1 where a.c1 = a.c2 and a.c1 <= 2;
|
||||
delete from t1 a where a.c1 = a.c2 and a.c1 <= 2;
|
||||
insert into is_t2 select * from t1 a where a.c1 = a.c2 and a.c1 <= 2;
|
||||
rollback;
|
||||
|
||||
== basic compare: case 6
|
||||
select /*+no_rewrite*/* from t1 a where a.c1 = a.c2 and a.c1 like '2%';
|
||||
c1 c2
|
||||
select * from t1 a where a.c1 = a.c2 and a.c1 like '2%';
|
||||
c1 c2
|
||||
start transaction;
|
||||
update t1 a set a.c1 = a.c2 + 1 where a.c1 = a.c2 and a.c1 like '2%';
|
||||
delete from t1 a where a.c1 = a.c2 and a.c1 like '2%';
|
||||
insert into is_t2 select * from t1 a where a.c1 = a.c2 and a.c1 like '2%';
|
||||
rollback;
|
||||
|
||||
== basic compare: case 7
|
||||
select /*+no_rewrite*/* from t1 a where a.c1 = a.c2 and a.c1 between 2 and 3;
|
||||
c1 c2
|
||||
select * from t1 a where a.c1 = a.c2 and a.c1 between 2 and 3;
|
||||
c1 c2
|
||||
start transaction;
|
||||
update t1 a set a.c1 = a.c2 + 1 where a.c1 = a.c2 and a.c1 between 2 and 3;
|
||||
delete from t1 a where a.c1 = a.c2 and a.c1 between 2 and 3;
|
||||
insert into is_t2 select * from t1 a where a.c1 = a.c2 and a.c1 between 2 and 3;
|
||||
rollback;
|
||||
|
||||
== basic compare: case 7
|
||||
select /*+no_rewrite*/* from t1 a where a.c1 = a.c2 and a.c1 in (2, 3);
|
||||
c1 c2
|
||||
select * from t1 a where a.c1 = a.c2 and a.c1 in (2, 3);
|
||||
c1 c2
|
||||
start transaction;
|
||||
update t1 a set a.c1 = a.c2 + 1 where a.c1 = a.c2 and a.c1 in (2, 3);
|
||||
delete from t1 a where a.c1 = a.c2 and a.c1 in (2, 3);
|
||||
insert into is_t2 select * from t1 a where a.c1 = a.c2 and a.c1 in (2, 3);
|
||||
rollback;
|
||||
************************** deduce on function *******************************
|
||||
|
||||
== deduce on function: case 1
|
||||
select /*+no_rewrite*/* from t1 a where round(a.c1) = round(a.c2) and round(a.c1) = 1;
|
||||
c1 c2
|
||||
select * from t1 a where round(a.c1) = round(a.c2) and round(a.c1) = 1;
|
||||
c1 c2
|
||||
start transaction;
|
||||
update t1 a set a.c1 = a.c2 + 1 where round(a.c1) = round(a.c2) and round(a.c1) = 1;
|
||||
delete from t1 a where round(a.c1) = round(a.c2) and round(a.c1) = 1;
|
||||
insert into is_t2 select * from t1 a where round(a.c1) = round(a.c2) and round(a.c1) = 1;
|
||||
rollback;
|
||||
|
||||
== deduce on function: case 2
|
||||
select /*+no_rewrite*/* from t1 a where round(a.c1) = a.c2 and round(a.c1) = 1;
|
||||
c1 c2
|
||||
select * from t1 a where round(a.c1) = a.c2 and round(a.c1) = 1;
|
||||
c1 c2
|
||||
start transaction;
|
||||
update t1 a set a.c1 = a.c2 + 1 where round(a.c1) = a.c2 and round(a.c1) = 1;
|
||||
delete from t1 a where round(a.c1) = a.c2 and round(a.c1) = 1;
|
||||
insert into is_t2 select * from t1 a where round(a.c1) = a.c2 and round(a.c1) = 1;
|
||||
rollback;
|
||||
***************************** subquery *********************************
|
||||
|
||||
== subquery:case 1
|
||||
select /*+no_rewrite*/* from t1 a where exists (select 1 from t2 b where a.c1 = b.c1 and b.c1 = 1);
|
||||
c1 c2
|
||||
select * from t1 a where exists (select 1 from t2 b where a.c1 = b.c1 and b.c1 = 1);
|
||||
c1 c2
|
||||
start transaction;
|
||||
update t1 a set a.c1 = a.c2 + 1 where exists (select 1 from t2 b where a.c1 = b.c1 and b.c1 = 1);
|
||||
delete from t1 a where exists (select 1 from t2 b where a.c1 = b.c1 and b.c1 = 1);
|
||||
insert into is_t2 select * from t1 a where exists (select 1 from t2 b where a.c1 = b.c1 and b.c1 = 1);
|
||||
rollback;
|
||||
|
||||
== subquery:case 2
|
||||
select /*+no_rewrite*/* from t1 a where exists (select 1 from t2 b where a.c1 = b.c1) and a.c1 = 2;
|
||||
c1 c2
|
||||
select * from t1 a where exists (select 1 from t2 b where a.c1 = b.c1) and a.c1 = 2;
|
||||
c1 c2
|
||||
start transaction;
|
||||
update t1 a set a.c1 = a.c2 + 1 where exists (select 1 from t2 b where a.c1 = b.c1) and a.c1 = 2;
|
||||
delete from t1 a where exists (select 1 from t2 b where a.c1 = b.c1) and a.c1 = 2;
|
||||
insert into is_t2 select * from t1 a where exists (select 1 from t2 b where a.c1 = b.c1) and a.c1 = 2;
|
||||
rollback;
|
||||
|
||||
== subquery:case 3
|
||||
select /*+no_rewrite*/* from t1 a where a.c1 in (select c1 from t2 b where b.c1 = 2);
|
||||
c1 c2
|
||||
select * from t1 a where a.c1 in (select c1 from t2 b where b.c1 = 2);
|
||||
c1 c2
|
||||
start transaction;
|
||||
update t1 a set a.c1 = a.c2 + 1 where a.c1 in (select c1 from t2 b where b.c1 = 2);
|
||||
delete from t1 a where a.c1 in (select c1 from t2 b where b.c1 = 2);
|
||||
insert into is_t2 select * from t1 a where a.c1 in (select c1 from t2 b where b.c1 = 2);
|
||||
rollback;
|
||||
***************************** type check *******************************
|
||||
|
||||
== type check: case 1
|
||||
select /*+no_rewrite*/* from t3 where c1=c2 and c1=cast('2010-10-10 00:00:00' as datetime);
|
||||
c1 c2 c3
|
||||
20101010000000 020101010000000 2010-10-10 00:00:00
|
||||
select * from t3 where c1=c2 and c1=cast('2010-10-10 00:00:00' as datetime);
|
||||
c1 c2 c3
|
||||
20101010000000 020101010000000 2010-10-10 00:00:00
|
||||
start transaction;
|
||||
update t3 set c1 = 1 where c1=c2 and c1=cast('2010-10-10 00:00:00' as datetime);
|
||||
rollback;
|
||||
****************************** remove redundant predicates *************
|
||||
|
||||
== remove redundant predicates: case 1
|
||||
select /*+no_rewrite*/* from t1 a where a.c1 = a.c2 and a.c1 = a.c2;
|
||||
c1 c2
|
||||
select * from t1 a where a.c1 = a.c2 and a.c1 = a.c2;
|
||||
c1 c2
|
||||
start transaction;
|
||||
update t1 a set a.c1 = a.c2 + 1 where a.c1 = a.c2 and a.c1 = a.c2;
|
||||
delete from t1 a where a.c1 = a.c2 and a.c1 = a.c2;
|
||||
insert into is_t2 select * from t1 a where a.c1 = a.c2 and a.c1 = a.c2;
|
||||
rollback;
|
||||
|
||||
== remove redundant predicates: case 2
|
||||
select /*+no_rewrite*/* from t1 a where a.c1 = a.c2 and a.c2 = a.c1;
|
||||
c1 c2
|
||||
select * from t1 a where a.c1 = a.c2 and a.c2 = a.c1;
|
||||
c1 c2
|
||||
start transaction;
|
||||
update t1 a set a.c1 = a.c2 + 1 where a.c1 = a.c2 and a.c2 = a.c1;
|
||||
delete from t1 a where a.c1 = a.c2 and a.c2 = a.c1;
|
||||
insert into is_t2 select * from t1 a where a.c1 = a.c2 and a.c2 = a.c1;
|
||||
rollback;
|
||||
|
||||
== remove redundant predicates: case 3
|
||||
select /*+no_rewrite*/* from t1 a where a.c1 >= a.c2 and a.c1 >= a.c2;
|
||||
c1 c2
|
||||
select * from t1 a where a.c1 >= a.c2 and a.c1 >= a.c2;
|
||||
c1 c2
|
||||
start transaction;
|
||||
update t1 a set a.c1 = a.c2 + 1 where a.c1 >= a.c2 and a.c1 >= a.c2;
|
||||
delete from t1 a where a.c1 >= a.c2 and a.c1 >= a.c2;
|
||||
insert into is_t2 select * from t1 a where a.c1 >= a.c2 and a.c1 >= a.c2;
|
||||
rollback;
|
||||
|
||||
== remove redundant predicates: case 4
|
||||
select /*+no_rewrite*/* from t1 a where a.c1 >= a.c2 and a.c2 <= a.c1;
|
||||
c1 c2
|
||||
select * from t1 a where a.c1 >= a.c2 and a.c2 <= a.c1;
|
||||
c1 c2
|
||||
start transaction;
|
||||
update t1 a set a.c1 = a.c2 + 1 where a.c1 >= a.c2 and a.c2 <= a.c1;
|
||||
delete from t1 a where a.c1 >= a.c2 and a.c2 <= a.c1;
|
||||
insert into is_t2 select * from t1 a where a.c1 >= a.c2 and a.c2 <= a.c1;
|
||||
rollback;
|
||||
|
||||
== remove redundant predicates: case 5
|
||||
select /*+no_rewrite*/* from t1 a where (a.c1 between 1 and 2) and (a.c1 between 1 and 2);
|
||||
c1 c2
|
||||
select * from t1 a where (a.c1 between 1 and 2) and (a.c1 between 1 and 2);
|
||||
c1 c2
|
||||
start transaction;
|
||||
update t1 a set a.c1 = a.c2 + 1 where (a.c1 between 1 and 2) and (a.c1 between 1 and 2);
|
||||
delete from t1 a where (a.c1 between 1 and 2) and (a.c1 between 1 and 2);
|
||||
insert into is_t2 select * from t1 a where (a.c1 between 1 and 2) and (a.c1 between 1 and 2);
|
||||
rollback;
|
||||
|
||||
== remove redundant predicates: case 6
|
||||
select /*+no_rewrite*/* from t1 a where a.c1 in (2, 3) and a.c1 in (2, 3);
|
||||
c1 c2
|
||||
select * from t1 a where a.c1 in (2, 3) and a.c1 in (2, 3);
|
||||
c1 c2
|
||||
start transaction;
|
||||
update t1 a set a.c1 = a.c2 + 1 where a.c1 in (2, 3) and a.c1 in (2, 3);
|
||||
delete from t1 a where a.c1 in (2, 3) and a.c1 in (2, 3);
|
||||
insert into is_t2 select * from t1 a where a.c1 in (2, 3) and a.c1 in (2, 3);
|
||||
rollback;
|
||||
|
||||
== remove redundant predicates: case 7
|
||||
select /*+no_rewrite*/* from t1 a where a.c1 not in (2, 3) and a.c1 not in (2, 3);
|
||||
c1 c2
|
||||
select * from t1 a where a.c1 not in (2, 3) and a.c1 not in (2, 3);
|
||||
c1 c2
|
||||
start transaction;
|
||||
update t1 a set a.c1 = a.c2 + 1 where a.c1 not in (2, 3) and a.c1 not in (2, 3);
|
||||
delete from t1 a where a.c1 not in (2, 3) and a.c1 not in (2, 3);
|
||||
insert into is_t2 select * from t1 a where a.c1 not in (2, 3) and a.c1 not in (2, 3);
|
||||
rollback;
|
||||
************************* can not deduce ******************
|
||||
|
||||
== can not deduce: case 1
|
||||
select /*+no_rewrite*/* from t1 a where a.c1 = a.c2 and a.c1 not like '2%';
|
||||
c1 c2
|
||||
select * from t1 a where a.c1 = a.c2 and a.c1 not like '2%';
|
||||
c1 c2
|
||||
start transaction;
|
||||
update t1 a set a.c1 = a.c2 + 1 where a.c1 = a.c2 and a.c1 not like '2%';
|
||||
delete from t1 a where a.c1 = a.c2 and a.c1 not like '2%';
|
||||
insert into is_t2 select * from t1 a where a.c1 = a.c2 and a.c1 not like '2%';
|
||||
rollback;
|
||||
|
||||
== can not deduce: case 2
|
||||
select /*+no_rewrite*/* from t1 a where a.c1 = a.c2 and a.c1 not in (2, 3);
|
||||
c1 c2
|
||||
select * from t1 a where a.c1 = a.c2 and a.c1 not in (2, 3);
|
||||
c1 c2
|
||||
start transaction;
|
||||
update t1 a set a.c1 = a.c2 + 1 where a.c1 = a.c2 and a.c1 not in (2, 3);
|
||||
delete from t1 a where a.c1 = a.c2 and a.c1 not in (2, 3);
|
||||
insert into is_t2 select * from t1 a where a.c1 = a.c2 and a.c1 not in (2, 3);
|
||||
rollback;
|
||||
************************* 不能推导 anti semi join ***************
|
||||
|
||||
== 不能推导 anti semi join:case 1
|
||||
select /*+no_rewrite*/* from t1 a where not exists (select 1 from t2 b where a.c1 = b.c1 and b.c1 = 1);
|
||||
c1 c2
|
||||
NULL NULL
|
||||
select * from t1 a where not exists (select 1 from t2 b where a.c1 = b.c1 and b.c1 = 1);
|
||||
c1 c2
|
||||
NULL NULL
|
||||
start transaction;
|
||||
update t1 a set a.c1 = a.c2 + 1 where not exists (select 1 from t2 b where a.c1 = b.c1 and b.c1 = 1);
|
||||
delete from t1 a where not exists (select 1 from t2 b where a.c1 = b.c1 and b.c1 = 1);
|
||||
insert into is_t2 select * from t1 a where not exists (select 1 from t2 b where a.c1 = b.c1 and b.c1 = 1);
|
||||
rollback;
|
||||
|
||||
== 能推导 anti semi join:case 2
|
||||
select /*+no_rewrite*/* from t1 a where not exists (select 1 from t2 b where a.c1 = b.c1) and a.c1 = 2;
|
||||
c1 c2
|
||||
select * from t1 a where not exists (select 1 from t2 b where a.c1 = b.c1) and a.c1 = 2;
|
||||
c1 c2
|
||||
start transaction;
|
||||
update t1 a set a.c1 = a.c2 + 1 where not exists (select 1 from t2 b where a.c1 = b.c1) and a.c1 = 2;
|
||||
delete from t1 a where not exists (select 1 from t2 b where a.c1 = b.c1) and a.c1 = 2;
|
||||
insert into is_t2 select * from t1 a where not exists (select 1 from t2 b where a.c1 = b.c1) and a.c1 = 2;
|
||||
rollback;
|
||||
|
||||
== 不能推导 anti semi join:case 3
|
||||
select /*+no_rewrite*/* from t1 a where a.c1 not in (select c1 from t2 b) and a.c1 = 1;
|
||||
c1 c2
|
||||
select * from t1 a where a.c1 not in (select c1 from t2 b) and a.c1 = 1;
|
||||
c1 c2
|
||||
start transaction;
|
||||
update t1 a set a.c1 = a.c2 + 1 where a.c1 not in (select c1 from t2 b) and a.c1 = 1;
|
||||
delete from t1 a where a.c1 not in (select c1 from t2 b) and a.c1 = 1;
|
||||
insert into is_t2 select * from t1 a where a.c1 not in (select c1 from t2 b) and a.c1 = 1;
|
||||
rollback;
|
||||
************************* 不能推导 anti semi join ***************
|
||||
|
||||
select /*+ NO_REWRITE */ * from t1 a, t2 b where a.c1 = b.c1 and b.c1 is not null;
|
||||
c1 c2 c1 c2 c3 c4
|
||||
select * from t1 a, t2 b where a.c1 = b.c1 and b.c1 is not null;
|
||||
c1 c2 c1 c2 c3 c4
|
||||
|
||||
select /*+ NO_REWRITE */ * from t1 a, t2 b where a.c1 = b.c1 and b.c1 is not null;
|
||||
c1 c2 c1 c2 c3 c4
|
||||
select * from t1 a, t2 b where a.c1 = b.c1 and b.c1 is not null;
|
||||
c1 c2 c1 c2 c3 c4
|
||||
|
||||
select /*+ NO_REWRITE */ * from t1 a, t2 b where a.c1 = b.c1 and b.c1 is null;
|
||||
c1 c2 c1 c2 c3 c4
|
||||
select * from t1 a, t2 b where a.c1 = b.c1 and b.c1 is null;
|
||||
c1 c2 c1 c2 c3 c4
|
||||
|
||||
select /*+ NO_REWRITE */ * from t1 a, t2 b where a.c1 = b.c1 and b.c1 <=> null;
|
||||
c1 c2 c1 c2 c3 c4
|
||||
select * from t1 a, t2 b where a.c1 = b.c1 and b.c1 <=> null;
|
||||
c1 c2 c1 c2 c3 c4
|
||||
|
||||
select /*+ NO_REWRITE */ * from t1 a, t2 b where a.c1 = b.c1 and b.c1 <=> 1;
|
||||
c1 c2 c1 c2 c3 c4
|
||||
select * from t1 a, t2 b where a.c1 = b.c1 and b.c1 <=> 1;
|
||||
c1 c2 c1 c2 c3 c4
|
||||
|
||||
select /*+ NO_REWRITE */ * from t1 a, t2 b where a.c1 <=> b.c1 and b.c1 <=> 1;
|
||||
c1 c2 c1 c2 c3 c4
|
||||
select * from t1 a, t2 b where a.c1 <=> b.c1 and b.c1 <=> 1;
|
||||
c1 c2 c1 c2 c3 c4
|
||||
drop table if exists tt1, tt2, tt3;
|
||||
create table tt1 (c1 int primary key, c2 varchar(10));
|
||||
create table tt2 (c1 int primary key, c2 varchar(10));
|
||||
create table tt3 (c1 int primary key, c2 varchar(10));
|
||||
select /*+use_merge(tt1 tt2)*/ * from tt1 left join tt2 on tt1.c1 = tt2.c1 where tt1.c1 = 1;
|
||||
c1 c2 c1 c2
|
||||
1 a1 NULL NULL
|
||||
select /*+no_rewrite, use_merge(tt1 tt2)*/ * from tt1 left join tt2 on tt1.c1 = tt2.c1 where tt1.c1 = 1;
|
||||
c1 c2 c1 c2
|
||||
1 a1 NULL NULL
|
||||
select /*+use_merge(tt1 tt2 tt3)*/ * from tt1 left join tt2 on tt1.c1 = tt2.c1 left join tt3 on tt1.c1 = tt3.c1 where tt1.c1 = 1;
|
||||
c1 c2 c1 c2 c1 c2
|
||||
1 a1 NULL NULL NULL NULL
|
||||
select /*+no_rewrite, use_merge(tt1 tt2 tt3)*/ * from tt1 left join tt2 on tt1.c1 = tt2.c1 left join tt3 on tt1.c1 = tt3.c1 where tt1.c1 = 1;
|
||||
c1 c2 c1 c2 c1 c2
|
||||
1 a1 NULL NULL NULL NULL
|
||||
select /*+use_merge(tt1 tt2 tt3)*/ * from tt1 left join tt2 on tt1.c1 = tt2.c1 left join tt3 on tt2.c1 = tt3.c1 where tt1.c1 = 1;
|
||||
c1 c2 c1 c2 c1 c2
|
||||
1 a1 NULL NULL NULL NULL
|
||||
select /*+no_rewrite, use_merge(tt1 tt2 tt3)*/ * from tt1 left join tt2 on tt1.c1 = tt2.c1 left join tt3 on tt2.c1 = tt3.c1 where tt1.c1 = 1;
|
||||
c1 c2 c1 c2 c1 c2
|
||||
1 a1 NULL NULL NULL NULL
|
||||
select /*+use_merge(tt1 tt2 tt3)*/ * from tt1 left join tt2 on tt1.c1 = tt2.c1 right join tt3 on tt1.c1 = tt3.c1 where tt1.c1 = 1;
|
||||
c1 c2 c1 c2 c1 c2
|
||||
select /*+no_rewrite, use_merge(tt1 tt2 tt3)*/ * from tt1 left join tt2 on tt1.c1 = tt2.c1 right join tt3 on tt1.c1 = tt3.c1 where tt1.c1 = 1;
|
||||
c1 c2 c1 c2 c1 c2
|
||||
select /*+use_merge(tt1 tt2 tt3)*/ * from tt1 left join tt2 on tt1.c1 = tt2.c1 right join tt3 on tt2.c1 = tt3.c1 where tt1.c1 = 1;
|
||||
c1 c2 c1 c2 c1 c2
|
||||
select /*+no_rewrite, use_merge(tt1 tt2 tt3)*/ * from tt1 left join tt2 on tt1.c1 = tt2.c1 right join tt3 on tt2.c1 = tt3.c1 where tt1.c1 = 1;
|
||||
c1 c2 c1 c2 c1 c2
|
||||
drop table if exists cghldinf, puzdjypf, pujydypf;
|
||||
CREATE TABLE `cghldinf` (
|
||||
`HLDGDDM` char(10) NOT NULL,
|
||||
`HLDZXWH` char(5) NOT NULL,
|
||||
`HLDTGDM` decimal(9, 0) NOT NULL,
|
||||
`HLDKMLB` char(2) NOT NULL,
|
||||
PRIMARY KEY (`HLDTGDM`, `HLDGDDM`),
|
||||
KEY `HLDINDEX` (`HLDKMLB`) LOCAL
|
||||
) partition by key (hldgddm) partitions 13;
|
||||
CREATE TABLE `puzdjypf` (
|
||||
`PZJZQZH` char(20) NOT NULL,
|
||||
`PZJZDJYDY` char(6) NOT NULL,
|
||||
`PZJSXRQ` decimal(8,0) NOT NULL,
|
||||
PRIMARY KEY (`PZJZQZH`)
|
||||
) partition by key (pzjzqzh) partitions 13;
|
||||
CREATE TABLE `pujydypf` (
|
||||
`PJYSCDM` char(2) NOT NULL,
|
||||
`PJYJYDY` char(6) NOT NULL,
|
||||
`PJYJYDYLB` char(3) NOT NULL,
|
||||
`PJYQSBH` char(8) NOT NULL
|
||||
) partition by key (pjyjydy) partitions 2;
|
||||
select /*+use_merge(t1 t2), leading(t1 t2 t3)*/ t1.hldgddm, t2.pzjzqzh, t2.pzjzdjydy, t3.pjyjydy, t3.pjyscdm from cghldinf t1 left join puzdjypf t2 on t2.pzjzqzh = t1.hldgddm left join pujydypf t3 on t2.pzjzdjydy = t3.pjyjydy and t3.pjyscdm = '01' where hldgddm = 'A100013208';
|
||||
hldgddm pzjzqzh pzjzdjydy pjyjydy pjyscdm
|
||||
A100013208 A100013208 20605 NULL NULL
|
||||
A100013208 A100013208 20605 NULL NULL
|
||||
select /*+no_rewrite, use_merge(t1 t2), leading(t1 t2 t3)*/ t1.hldgddm, t2.pzjzqzh, t2.pzjzdjydy, t3.pjyjydy, t3.pjyscdm from cghldinf t1 left join puzdjypf t2 on t2.pzjzqzh = t1.hldgddm left join pujydypf t3 on t2.pzjzdjydy = t3.pjyjydy and t3.pjyscdm = '01' where hldgddm = 'A100013208';
|
||||
hldgddm pzjzqzh pzjzdjydy pjyjydy pjyscdm
|
||||
A100013208 A100013208 20605 NULL NULL
|
||||
A100013208 A100013208 20605 NULL NULL
|
||||
drop table if exists t1, t2;
|
||||
create table t1 (c1 int, c2 int, primary key(c1));
|
||||
create table t2 (c1 int, c2 int, primary key(c2));
|
||||
explain extended_noaddr select count(*) from t1 A, t2 B where A.c1 >= 5630905 and A.c1 < 5631105 and A.c1 = B.c2 and A.c2 = B.c2;
|
||||
Query Plan
|
||||
==========================================
|
||||
|ID|OPERATOR |NAME|EST. ROWS|COST|
|
||||
------------------------------------------
|
||||
|0 |SCALAR GROUP BY | |1 |4476|
|
||||
|1 | NESTED-LOOP JOIN| |3 |4475|
|
||||
|2 | TABLE SCAN |A |3 |4383|
|
||||
|3 | TABLE GET |B |1 |36 |
|
||||
==========================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([T_FUN_COUNT(*)]), filter(nil),
|
||||
group(nil), agg_func([T_FUN_COUNT(*)])
|
||||
1 - output([1]), filter(nil),
|
||||
conds(nil), nl_params_([A.c1]), batch_join=true
|
||||
2 - output([A.c1]), filter([A.c1 = A.c2], [A.c2 < 5631105]),
|
||||
access([A.c1], [A.c2]), partitions(p0),
|
||||
is_index_back=false, filter_before_indexback[false,false],
|
||||
range_key([A.c1]), range[5630905 ; 5631105),
|
||||
range_cond([A.c1 >= 5630905], [A.c1 < 5631105])
|
||||
3 - output([1]), filter(nil),
|
||||
access([B.c2]), partitions(p0),
|
||||
is_index_back=false,
|
||||
range_key([B.c2]), range(MIN ; MAX),
|
||||
range_cond([B.c2 < 5631105], [B.c2 >= 5630905], [? = B.c2])
|
||||
|
||||
drop table t1, t2;
|
||||
create table t1 (c1 int, c2 int, index (c1));
|
||||
create table t2 (c1 int, c2 int, index (c2));
|
||||
explain extended_noaddr select count(*) from t1 A, t2 B where A.c1 >= 5630905 and A.c1 < 5631105 and A.c1 = B.c2 and A.c2 = B.c2;
|
||||
Query Plan
|
||||
============================================
|
||||
|ID|OPERATOR |NAME |EST. ROWS|COST |
|
||||
--------------------------------------------
|
||||
|0 |SCALAR GROUP BY | |1 |31312|
|
||||
|1 | NESTED-LOOP JOIN| |123 |31289|
|
||||
|2 | TABLE SCAN |A(c1)|3 |31096|
|
||||
|3 | TABLE SCAN |B(c2)|50 |45 |
|
||||
============================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([T_FUN_COUNT(*)]), filter(nil),
|
||||
group(nil), agg_func([T_FUN_COUNT(*)])
|
||||
1 - output([1]), filter(nil),
|
||||
conds(nil), nl_params_([A.c1]), batch_join=true
|
||||
2 - output([A.c1]), filter([A.c1 = A.c2], [A.c2 < 5631105]),
|
||||
access([A.c1], [A.c2]), partitions(p0),
|
||||
is_index_back=true, filter_before_indexback[false,false],
|
||||
range_key([A.c1], [A.__pk_increment]), range(5630905,MIN ; 5631105,MIN),
|
||||
range_cond([A.c1 >= 5630905], [A.c1 < 5631105])
|
||||
3 - output([1]), filter(nil),
|
||||
access([B.c2]), partitions(p0),
|
||||
is_index_back=false,
|
||||
range_key([B.c2], [B.__pk_increment]), range(MIN ; MAX),
|
||||
range_cond([B.c2 < 5631105], [B.c2 >= 5630905], [? = B.c2])
|
||||
|
||||
drop table t1, t2;
|
||||
create table t1 (c1 int, c2 int) partition by hash(c1) partitions 4;
|
||||
create table t2 (c1 int, c2 int) partition by hash(c2) partitions 4;
|
||||
explain extended_noaddr select count(*) from t1 A, t2 B where A.c1 >= 5630905 and A.c1 < 5631105 and A.c1 = B.c2 and A.c2 = B.c2;
|
||||
Query Plan
|
||||
=======================================================
|
||||
|ID|OPERATOR |NAME |EST. ROWS|COST |
|
||||
-------------------------------------------------------
|
||||
|0 |SCALAR GROUP BY | |1 |21331|
|
||||
|1 | PX COORDINATOR | |1 |20956|
|
||||
|2 | EXCHANGE OUT DISTR |:EX10000|1 |20956|
|
||||
|3 | MERGE GROUP BY | |1 |20956|
|
||||
|4 | PX PARTITION ITERATOR| |1961 |20582|
|
||||
|5 | NESTED-LOOP JOIN | |1961 |20582|
|
||||
|6 | TABLE SCAN |A |10 |17866|
|
||||
|7 | TABLE SCAN |B |198 |144 |
|
||||
=======================================================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([T_FUN_COUNT_SUM(T_FUN_COUNT(*))]), filter(nil),
|
||||
group(nil), agg_func([T_FUN_COUNT_SUM(T_FUN_COUNT(*))])
|
||||
1 - output([T_FUN_COUNT(*)]), filter(nil)
|
||||
2 - output([T_FUN_COUNT(*)]), filter(nil), dop=1
|
||||
3 - output([T_FUN_COUNT(*)]), filter(nil),
|
||||
group(nil), agg_func([T_FUN_COUNT(*)])
|
||||
4 - output([1]), filter(nil),
|
||||
partition wise, force partition granule, asc.
|
||||
5 - output([1]), filter(nil),
|
||||
conds(nil), nl_params_([A.c1]), batch_join=true
|
||||
6 - output([A.c1]), filter([A.c1 = A.c2], [A.c2 < 5631105]),
|
||||
access([A.c1], [A.c2]), partitions(p[0-3]),
|
||||
is_index_back=false, filter_before_indexback[false,false],
|
||||
range_key([A.c1], [A.__pk_increment]), range(5630905,MIN ; 5631105,MIN),
|
||||
range_cond([A.c1 >= 5630905], [A.c1 < 5631105])
|
||||
7 - output([1]), filter(nil),
|
||||
access([B.c2]), partitions(p[0-3]),
|
||||
is_index_back=false,
|
||||
range_key([B.c2], [B.__pk_increment]), range(MIN ; MAX),
|
||||
range_cond([B.c2 < 5631105], [B.c2 >= 5630905], [? = B.c2])
|
||||
|
||||
drop table if exists t1, t2, t3;
|
||||
drop table if exists tt1, tt2, tt3;
|
||||
drop table if exists cghldinf, puzdjypf, pujydypf;
|
||||
USE DB_PREDICATE_DEDUCE;
|
||||
drop database DB_PREDICATE_DEDUCE;
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,14 +0,0 @@
|
||||
with cte1(c1, c2) as
|
||||
(select 1, '0' from dual
|
||||
union all select 2, '1' from dual
|
||||
),
|
||||
cte2(c1, c2) as
|
||||
(select '0', 1 from dual
|
||||
union all select cte1.c2, cte1.c1 from cte2, cte1 where 10 = cte2.c1)
|
||||
select * from cte1;
|
||||
+------+------+
|
||||
| c1 | c2 |
|
||||
+------+------+
|
||||
| 1 | 0 |
|
||||
| 2 | 1 |
|
||||
+------+------+
|
@ -1,102 +0,0 @@
|
||||
drop database if exists ctetest;
|
||||
create database ctetest;
|
||||
use ctetest;
|
||||
create table EMP (
|
||||
EMPno number,
|
||||
ENAME varchar(30),
|
||||
JOB varchar(30),
|
||||
MGR number(4),
|
||||
HIREDATE date,
|
||||
SAL number(7,2),
|
||||
COMM number(7,2),
|
||||
DEPTNO number(2)
|
||||
) ;
|
||||
create table DEPT(
|
||||
DEPTNO number(2),
|
||||
DNAME char(45),
|
||||
LOC varchar(39)
|
||||
) ;
|
||||
insert into EMP values (7369,'SMITH','CLERK',7902, str_to_date('17-DEC-80','%d-%b-%Y'),800,NULL, 20) ;
|
||||
INSERT INTO EMP VALUES (7499, 'ALLEN','SALESMAN',7698,str_to_date('20-FEB-81','%d-%b-%Y'),1600,300,30) ;
|
||||
INSERT INTO EMP VALUES (7521,'WARD','SALESMAN',7698, str_to_date('22-FEB-81','%d-%b-%Y'),1250, 500, 30) ;
|
||||
INSERT INTO EMP VALUES (7566,'JONES','MANAGER',7839, str_to_date('02-APR-81','%d-%b-%Y'), 2975, NULL, 20) ;
|
||||
INSERT INTO EMP VALUES (7654,'MARTIN','SALESMAN', 7698, str_to_date('28-SEP-81','%d-%b-%Y'), 1250, 1400, 30) ;
|
||||
INSERT INTO EMP VALUES (7698, 'BLAKE','MANAGER', 7839, str_to_date('01-MAY-81','%d-%b-%Y'), 2850, NULL, 30) ;
|
||||
INSERT INTO EMP VALUES (7782, 'CLARK','MANAGER', 7839, str_to_date('09-JUN-81','%d-%b-%Y'), 2450, NULL, 10) ;
|
||||
insert into EMP values (7788,'SCOTT','ANALYST', 7566, str_to_date('19-APR-87','%d-%b-%Y'), 3000, null, 20) ;
|
||||
INSERT INTO EMP VALUES (7839, 'KING','PRESIDENT', NULL, str_to_date('17-NOV-81','%d-%b-%Y'), 5000, NULL, 10) ;
|
||||
INSERT INTO EMP VALUES (7844, 'TURNER','SALESMAN', 7698, str_to_date('08-SEP-81','%d-%b-%Y'), 1500, 0, 30) ;
|
||||
INSERT INTO EMP VALUES(7876, 'ADAMS','CLERK', 7788, str_to_date('23-MAY-87','%d-%b-%Y'), 1100, NULL, 20) ;
|
||||
INSERT INTO EMP VALUES(7900, 'JAMES', 'CLEARK', 7698, str_to_date('03-DEC-81','%d-%b-%Y'), 950, NULL, 30) ;
|
||||
INSERT INTO EMP VALUES(7902, 'FORD','ANALYST',7566, str_to_date('03-DEC-81','%d-%b-%Y'), 3000, NULL, 20) ;
|
||||
INSERT INTO EMP VALUES(7934,'MILLER','CLERK', 7782, str_to_date('23-JAN-82','%d-%b-%Y'), 1300,NULL, 10) ;
|
||||
result_format: 4
|
||||
|
||||
## =======================================================================
|
||||
## Test Case 1:
|
||||
## - recursive WITH Query: Optimization on query with outside filter.
|
||||
## Predicate pushdown optimization on static value job.
|
||||
## The plan should reflect optimization or development can provide
|
||||
## parameter to show that pushdown optimization happened for init branch
|
||||
## =======================================================================
|
||||
explain basic
|
||||
WITH rw (ename, mgr, empno, job) AS
|
||||
(
|
||||
SELECT ename, mgr, empno, job
|
||||
FROM emp e
|
||||
UNION ALL
|
||||
SELECT e.ename, e.mgr, e.empno, e.job
|
||||
FROM rw r, emp e
|
||||
WHERE r.empno = e.mgr
|
||||
)
|
||||
SELECT ename, empno, mgr, job
|
||||
FROM rw
|
||||
WHERE job = 'PRESIDENT' ;
|
||||
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| Query Plan |
|
||||
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| ==============================
|
||||
|ID|OPERATOR |NAME|
|
||||
------------------------------
|
||||
|0 |SUBPLAN SCAN |rw |
|
||||
|1 | RECURSIVE UNION ALL| |
|
||||
|2 | TABLE SCAN |e |
|
||||
|3 | HASH JOIN | |
|
||||
|4 | TABLE SCAN |e |
|
||||
|5 | TABLE SCAN |r |
|
||||
==============================
|
||||
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([rw.ename], [rw.empno], [rw.mgr], [rw.job]), filter([rw.job = 'PRESIDENT']),
|
||||
access([rw.job], [rw.ename], [rw.empno], [rw.mgr])
|
||||
1 - output([UNION([1])], [UNION([2])], [UNION([3])], [UNION([4])]), filter(nil)
|
||||
2 - output([e.ENAME], [e.MGR], [e.EMPno], [e.JOB]), filter(nil),
|
||||
access([e.ENAME], [e.MGR], [e.EMPno], [e.JOB]), partitions(p0)
|
||||
3 - output([e.ENAME], [e.MGR], [e.EMPno], [e.JOB]), filter(nil),
|
||||
equal_conds([r.empno = e.MGR]), other_conds(nil)
|
||||
4 - output([e.MGR], [e.ENAME], [e.EMPno], [e.JOB]), filter(nil),
|
||||
access([e.MGR], [e.ENAME], [e.EMPno], [e.JOB]), partitions(p0)
|
||||
5 - output([r.empno]), filter(nil),
|
||||
access([r.empno]), partitions(nil)
|
||||
|
|
||||
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
WITH rw (ename, mgr, empno, job) AS
|
||||
(
|
||||
SELECT ename, mgr, empno, job
|
||||
FROM emp e
|
||||
UNION ALL
|
||||
SELECT e.ename, e.mgr, e.empno, e.job
|
||||
FROM rw r, emp e
|
||||
WHERE r.empno = e.mgr
|
||||
)
|
||||
SELECT /*+ :HINT: */ ename, empno, mgr, job
|
||||
FROM rw
|
||||
WHERE job = 'PRESIDENT' ;
|
||||
+-------+-------+------+-----------+
|
||||
| ename | empno | mgr | job |
|
||||
+-------+-------+------+-----------+
|
||||
| KING | 7839 | NULL | PRESIDENT |
|
||||
+-------+-------+------+-----------+
|
||||
|
@ -1,8 +0,0 @@
|
||||
with cte1(c1, c2) as
|
||||
(select 1, '0' from dual
|
||||
union all select 2, '1' from dual
|
||||
),
|
||||
cte2(c1, c2) as
|
||||
(select '0', 1 from dual
|
||||
union all select cte1.c2, cte1.c1 from cte2, cte1 where 10 = cte2.c1)
|
||||
select * from cte1;
|
6
tools/deploy/.gitignore
vendored
Normal file
6
tools/deploy/.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
/mysqltest
|
||||
/mysqltest.down
|
||||
/ob1mysql.sh
|
||||
bquery/*
|
||||
obclient
|
||||
obclient.down
|
@ -1,5 +1,3 @@
|
||||
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';
|
@ -1,6 +1,9 @@
|
||||
--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;
|
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
@ -1,9 +1,12 @@
|
||||
# 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
|
||||
|
@ -8,7 +8,7 @@ coll_test CREATE TABLE `coll_test` (
|
||||
`ub` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
|
||||
`b` varbinary(10) DEFAULT NULL,
|
||||
PRIMARY KEY (`pk`)
|
||||
) DEFAULT CHARSET = utf8mb4 ROW_FORMAT = COMPACT COMPRESSION = 'lz4_1.0' REPLICA_NUM = NUM BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 0
|
||||
) 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
|
@ -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;
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user