提交 23c7e1fe 编写于 作者: L LINxiansheng 提交者: wangzelin.wzl

Fix opensource mysql test cases

上级 2532407a
......@@ -177,7 +177,7 @@ collation(substr(X'41', 2))
binary
select collation(trim('a' from null)) from coll_test;
collation(trim('a' from null))
utf8mb4_general_ci
binary
select collation(trim('a' from uc)) from coll_test;
collation(trim('a' from uc))
utf8mb4_general_ci
......@@ -501,10 +501,4 @@ utf8mb4_bin
select collation(cast('A' as char)), cast('A' as char) < 'a';
collation(cast('A' as char)) cast('A' as char) < 'a'
utf8mb4_bin 1
SELECT collation(CAST('A' AS char CHAR SET utf8mb4));
collation(CAST('A' AS char CHAR SET utf8mb4))
utf8mb4_general_ci
SELECT collation(CAST('A' AS char CHAR SET binary));
collation(CAST('A' AS char CHAR SET binary))
binary
drop table coll_test;
......@@ -163,28 +163,28 @@ export_set(2.4,"y","n")
n,y,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n
select export_set(9223372036854775808,"Y","N");
export_set(9223372036854775808,"Y","N")
N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,Y
Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,N
select export_set(9223372036854775809,"Y","N");
export_set(9223372036854775809,"Y","N")
Y,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N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,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,N
select export_set(18446744073709551615,"Y","N",",",1844674407370955161500000000000);
export_set(18446744073709551615,"Y","N",",",1844674407370955161500000000000)
Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y
Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,N
select export_set();
ERROR 42000: Incorrect parameter count in the call to native function 'export_set'
select export_set(1);
......@@ -313,3 +313,25 @@ desc t1;
Field Type Null Key Default Extra
export_set(99,"1","11","111",77) varchar(317) YES NULL
drop table t1;
drop table if exists T_36895309;
CREATE TABLE T_36895309(A_0 INT,A_1 INT,A_2 VARCHAR(20),A_3 FLOAT,A_4 DATE);
INSERT INTO T_36895309 VALUES(1,1,'A',1.23,'1999-09-09'),(2,-1,'nb',3.21,'1111-11-11'),(3,0,'#',6666.6666,'11-11-11'),(4,NULL,NULL,NULL,NULL);
SELECT EXPORT_SET(A_2,'Y','N',',',5) FROM T_36895309 ;
EXPORT_SET(A_2,'Y','N',',',5)
N,N,N,N,N
N,N,N,N,N
N,N,N,N,N
NULL
SELECT EXPORT_SET(A_3,'Y','N',',',5) FROM T_36895309 ;
EXPORT_SET(A_3,'Y','N',',',5)
Y,N,N,N,N
Y,Y,N,N,N
Y,Y,N,Y,N
NULL
SELECT EXPORT_SET(A_4,'Y','N',',',5) FROM T_36895309 ;
EXPORT_SET(A_4,'Y','N',',',5)
Y,N,Y,Y,Y
Y,Y,Y,N,N
Y,Y,Y,N,N
NULL
drop table T_36895309;
--disable_query_log
set @@session.explicit_defaults_for_timestamp=off;
--enable_query_log
# ....yzf....Fri, 21 Aug 2015....17:55....
# set-up
--disable_warnings
......@@ -247,10 +246,6 @@ select collation(cast(1 as char));
SELECT collation(DATE_FORMAT('2009-10-04 22:23:00', '%W %M %Y'));
select collation(cast('A' as char)), cast('A' as char) < 'a';
#set utf8 binary collation set
SELECT collation(CAST('A' AS char CHAR SET utf8mb4));
SELECT collation(CAST('A' AS char CHAR SET binary));
################################################################
# tear-down
drop table coll_test;
......@@ -6,7 +6,6 @@ set @@session.explicit_defaults_for_timestamp=off;
--enable_abort_on_error
--echo ================ expression export_set ================
# 基本检查
select export_set(0,"Y","N","-",5);
select export_set(7,"Y","N","-",5);
select export_set(11,"Y","N","-",5);
......@@ -23,7 +22,6 @@ select export_set(100,"Y","N",".",5);
select export_set(100,"Y","N",".",7);
select export_set(100,"Y","N",".",10);
# 参数NULL检查
select export_set(null,"Y","N",".",5);
select export_set(0,"Y","N",".",5);
select export_set(5,null,"N",".",5);
......@@ -43,7 +41,6 @@ select export_set(1000,'',1);
select export_set(1000,1,'');
select export_set(1000,1,0,'');
# 默认参数检查
select export_set(8,"Y","N");
select export_set(88,"Y","N");
select export_set(888,"Y","N");
......@@ -54,7 +51,6 @@ select export_set(8,"Y","N",'+');
select export_set(8,"1","0",'*');
select export_set(8,"X","Y",'*');
# 参数类型不同
select export_set(7,1,0,"-",5);
select export_set(7,11,00,"-",5);
select export_set(7,111,000,"-",5);
......@@ -68,9 +64,6 @@ select export_set(2.4,1,0);
select export_set(1.4,"y","n");
select export_set(2.4,"y","n");
# 边界检查
# 超过uint64的上界,int64的下界,ob对溢出的处理和mysql不同,这是mysql的bug,不兼容
# 目前保证-9223372036854775808到18446744073709551615与mysql兼容
# select export_set(1111111111111111111111111111111111111111111111111111,"Y","N");
select export_set(9223372036854775808,"Y","N");
select export_set(9223372036854775809,"Y","N");
......@@ -85,7 +78,6 @@ select export_set(-9223372036854775808,"Y","N",",",-9223372036854775808000000000
select export_set(18446744073709551615,"Y","N",",",18446744073709551615);
select export_set(18446744073709551615,"Y","N",",",1844674407370955161500000000000);
# 参数错误检查
--error 1582
select export_set();
--error 1582
......@@ -105,7 +97,6 @@ select export_set(1,2,3,a);
--error 1054
select export_set(1,2,3,4,a);
# 用表数据做参数
--disable_warnings
drop table if exists test;
--enable_warnings
......@@ -149,3 +140,13 @@ create table t1 as select export_set(99,"1","11","111",77);
desc t1;
drop table t1;
--disable_warnings
drop table if exists T_36895309;
--enable_warnings
CREATE TABLE T_36895309(A_0 INT,A_1 INT,A_2 VARCHAR(20),A_3 FLOAT,A_4 DATE);
INSERT INTO T_36895309 VALUES(1,1,'A',1.23,'1999-09-09'),(2,-1,'nb',3.21,'1111-11-11'),(3,0,'#',6666.6666,'11-11-11'),(4,NULL,NULL,NULL,NULL);
SELECT EXPORT_SET(A_2,'Y','N',',',5) FROM T_36895309 ;
SELECT EXPORT_SET(A_3,'Y','N',',',5) FROM T_36895309 ;
SELECT EXPORT_SET(A_4,'Y','N',',',5) FROM T_36895309 ;
drop table T_36895309;
......@@ -78,9 +78,9 @@ TABLE_NAME varchar(256) NO
COLUMN_NAME varchar(128) NO
ORDINAL_POSITION bigint(20) NO
POSITION_IN_UNIQUE_CONSTRAINT null NO
REFERENCED_TABLE_SCHEMA null NO
REFERENCED_TABLE_NAME null NO
REFERENCED_COLUMN_NAME null NO
REFERENCED_TABLE_SCHEMA varchar(128) NO
REFERENCED_TABLE_NAME varchar(256) NO
REFERENCED_COLUMN_NAME varchar(128) NO
desc partitions;
Field Type Null Key Default Extra
TABLE_CATALOG varchar(4096) NO
......@@ -132,6 +132,7 @@ SCHEMA_NAME varchar(128) NO
DEFAULT_CHARACTER_SET_NAME varchar(7) NO
DEFAULT_COLLATION_NAME varchar(18) NO
SQL_PATH null NO
DEFAULT_ENCRYPTION varchar(2) NO
desc session_status;
Field Type Null Key Default Extra
VARIABLE_NAME varchar(128) NO
......@@ -181,7 +182,7 @@ TABLE_CATALOG varchar(3) NO
TABLE_SCHEMA varchar(128) NO
TABLE_NAME varchar(256) NO
TABLE_TYPE varchar(12) NO
ENGINE null NO
ENGINE varchar(9) NO
VERSION null NO
ROW_FORMAT null NO
TABLE_ROWS decimal(20,0) NO NULL
......@@ -248,7 +249,7 @@ COLUMNS CREATE VIEW `COLUMNS` AS SELECT TABLE_CATALOG,
PRIVILEGES,
COLUMN_COMMENT,
GENERATION_EXPRESSION
FROM OCEANBASE.__ALL_VIRTUAL_INFORMATION_COLUMNS utf8mb4 utf8mb4_general_ci
FROM OCEANBASE.__ALL_VIRTUAL_INFORMATION_COLUMNS where 0 = sys_privilege_check('table_acc', effective_tenant_id(), table_schema, table_name) utf8mb4 utf8mb4_general_ci
show create table global_status;
Table Create Table
GLOBAL_STATUS CREATE TABLE `GLOBAL_STATUS` (
......@@ -260,7 +261,7 @@ View Create View character_set_client collation_connection
GLOBAL_VARIABLES CREATE VIEW `GLOBAL_VARIABLES` AS SELECT `variable_name` as VARIABLE_NAME, `value` as VARIABLE_VALUE FROM oceanbase.__tenant_virtual_global_variable utf8mb4 utf8mb4_general_ci
show create table key_column_usage;
View Create View character_set_client collation_connection
KEY_COLUMN_USAGE CREATE VIEW `KEY_COLUMN_USAGE` AS (select /*+ READ_CONSISTENCY(WEAK) */ 'def' as CONSTRAINT_CATALOG, c.database_name as CONSTRAINT_SCHEMA, 'PRIMARY' as CONSTRAINT_NAME, 'def' as TABLE_CATALOG, c.database_name as TABLE_SCHEMA, a.table_name as TABLE_NAME, b.column_name as COLUMN_NAME, b.rowkey_position as ORDINAL_POSITION, NULL as POSITION_IN_UNIQUE_CONSTRAINT, NULL as REFERENCED_TABLE_SCHEMA, NULL as REFERENCED_TABLE_NAME, NULL as REFERENCED_COLUMN_NAME from oceanbase.__all_virtual_table a inner join oceanbase.__all_virtual_column b on a.table_id = b.table_id inner join oceanbase.__all_virtual_database c on a.database_id = c.database_id where a.tenant_id = effective_tenant_id() and b.tenant_id = effective_tenant_id() and c.tenant_id = effective_tenant_id() and c.in_recyclebin = 0 and c.database_name != '__recyclebin' and b.rowkey_position > 0 and b.column_id >= 16 and a.table_type != 5 and b.column_flags & (0x1 << 8) = 0) union (select /*+ READ_CONSISTENCY(WEAK) */ 'def' as CONSTRAINT_CATALOG, d.database_name as CONSTRAINT_SCHEMA, substr(a.table_name, 2 + length(substring_index(a.table_name,'_',4))) as CONSTRAINT_NAME, 'def' as TABLE_CATALOG, d.database_name as TABLE_SCHEMA, c.table_name as TABLE_NAME, b.column_name as COLUMN_NAME, b.index_position as ORDINAL_POSITION, NULL as POSITION_IN_UNIQUE_CONSTRAINT, NULL as REFERENCED_TABLE_SCHEMA, NULL as REFERENCED_TABLE_NAME, NULL as REFERENCED_COLUMN_NAME from oceanbase.__all_virtual_table a inner join oceanbase.__all_virtual_column b on a.table_id = b.table_id inner join oceanbase.__all_virtual_table c on a.data_table_id = c.table_id inner join oceanbase.__all_virtual_database d on c.database_id = d.database_id where a.tenant_id = effective_tenant_id() and b.tenant_id = effective_tenant_id() and c.tenant_id = effective_tenant_id() and d.in_recyclebin = 0 and d.tenant_id = effective_tenant_id() and d.database_name != '__recyclebin' and a.table_type = 5 and a.index_type in (2, 4, 8) and b.index_position > 0) utf8mb4 utf8mb4_general_ci
KEY_COLUMN_USAGE CREATE VIEW `KEY_COLUMN_USAGE` AS (select /*+ READ_CONSISTENCY(WEAK) */ 'def' as CONSTRAINT_CATALOG, c.database_name as CONSTRAINT_SCHEMA, 'PRIMARY' as CONSTRAINT_NAME, 'def' as TABLE_CATALOG, c.database_name as TABLE_SCHEMA, a.table_name as TABLE_NAME, b.column_name as COLUMN_NAME, b.rowkey_position as ORDINAL_POSITION, NULL as POSITION_IN_UNIQUE_CONSTRAINT, NULL as REFERENCED_TABLE_SCHEMA, NULL as REFERENCED_TABLE_NAME, NULL as REFERENCED_COLUMN_NAME from oceanbase.__all_virtual_table a inner join oceanbase.__all_virtual_column b on a.table_id = b.table_id inner join oceanbase.__all_virtual_database c on a.database_id = c.database_id where a.tenant_id = effective_tenant_id() and b.tenant_id = effective_tenant_id() and c.tenant_id = effective_tenant_id() and c.in_recyclebin = 0 and c.database_name != '__recyclebin' and b.rowkey_position > 0 and b.column_id >= 16 and a.table_type != 5 and b.column_flags & (0x1 << 8) = 0) union all (select /*+ READ_CONSISTENCY(WEAK) */ 'def' as CONSTRAINT_CATALOG, d.database_name as CONSTRAINT_SCHEMA, substr(a.table_name, 2 + length(substring_index(a.table_name,'_',4))) as CONSTRAINT_NAME, 'def' as TABLE_CATALOG, d.database_name as TABLE_SCHEMA, c.table_name as TABLE_NAME, b.column_name as COLUMN_NAME, b.index_position as ORDINAL_POSITION, NULL as POSITION_IN_UNIQUE_CONSTRAINT, NULL as REFERENCED_TABLE_SCHEMA, NULL as REFERENCED_TABLE_NAME, NULL as REFERENCED_COLUMN_NAME from oceanbase.__all_virtual_table a inner join oceanbase.__all_virtual_column b on a.table_id = b.table_id inner join oceanbase.__all_virtual_table c on a.data_table_id = c.table_id inner join oceanbase.__all_virtual_database d on c.database_id = d.database_id where a.tenant_id = effective_tenant_id() and b.tenant_id = effective_tenant_id() and c.tenant_id = effective_tenant_id() and d.in_recyclebin = 0 and d.tenant_id = effective_tenant_id() and d.database_name != '__recyclebin' and a.table_type = 5 and a.index_type in (2, 4, 8) and b.index_position > 0) union all (select /*+ READ_CONSISTENCY(WEAK) */ 'def' as CONSTRAINT_CATALOG, d.database_name as CONSTRAINT_SCHEMA, f.foreign_key_name as CONSTRAINT_NAME, 'def' as TABLE_CATALOG, d.database_name as TABLE_SCHEMA, t.table_name as TABLE_NAME, c.column_name as COLUMN_NAME, fc.position as ORDINAL_POSITION, NULL as POSITION_IN_UNIQUE_CONSTRAINT, /* POSITION_IN_UNIQUE_CONSTRAINT is not supported now */ d2.database_name as REFERENCED_TABLE_SCHEMA, t2.table_name as REFERENCED_TABLE_NAME, c2.column_name as REFERENCED_COLUMN_NAME from oceanbase.__all_virtual_foreign_key f inner join oceanbase.__all_virtual_table t on f.child_table_id = t.table_id inner join oceanbase.__all_virtual_database d on t.database_id = d.database_id inner join oceanbase.__all_virtual_foreign_key_column fc on f.foreign_key_id = fc.foreign_key_id inner join oceanbase.__all_virtual_column c on fc.child_column_id = c.column_id and t.table_id = c.table_id inner join oceanbase.__all_virtual_table t2 on f.parent_table_id = t2.table_id inner join oceanbase.__all_virtual_database d2 on t2.database_id = d2.database_id inner join oceanbase.__all_virtual_column c2 on fc.parent_column_id = c2.column_id and t2.table_id = c2.table_id where f.tenant_id = effective_tenant_id() and fc.tenant_id = effective_tenant_id() and t.tenant_id = effective_tenant_id() and d.tenant_id = effective_tenant_id() and c.tenant_id = effective_tenant_id() and t2.tenant_id = effective_tenant_id() and d2.tenant_id = effective_tenant_id() and c2.tenant_id = effective_tenant_id()) utf8mb4 utf8mb4_general_ci
show create table partitions;
Table Create Table
PARTITIONS CREATE TABLE `PARTITIONS` (
......@@ -304,7 +305,7 @@ SCHEMA_PRIVILEGES CREATE TABLE `SCHEMA_PRIVILEGES` (
) DEFAULT CHARSET = utf8mb4 ROW_FORMAT = COMPACT COMPRESSION = 'none' REPLICA_NUM = 1 BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 10 TABLEGROUP = 'oceanbase'
show create table schemata;
View Create View character_set_client collation_connection
SCHEMATA CREATE VIEW `SCHEMATA` AS SELECT 'def' AS CATALOG_NAME, DATABASE_NAME AS SCHEMA_NAME, 'utf8mb4' AS DEFAULT_CHARACTER_SET_NAME, 'utf8mb4_general_ci' AS DEFAULT_COLLATION_NAME, NULL AS SQL_PATH FROM oceanbase.__all_virtual_database a WHERE a.tenant_id = effective_tenant_id() and in_recyclebin = 0 and database_name != '__recyclebin' utf8mb4 utf8mb4_general_ci
SCHEMATA CREATE VIEW `SCHEMATA` AS SELECT 'def' AS CATALOG_NAME, DATABASE_NAME AS SCHEMA_NAME, 'utf8mb4' AS DEFAULT_CHARACTER_SET_NAME, 'utf8mb4_general_ci' AS DEFAULT_COLLATION_NAME, NULL AS SQL_PATH, 'NO' as DEFAULT_ENCRYPTION FROM oceanbase.__all_virtual_database a WHERE a.tenant_id = effective_tenant_id() and in_recyclebin = 0 and database_name != '__recyclebin' utf8mb4 utf8mb4_general_ci
show create table session_status;
Table Create Table
SESSION_STATUS CREATE TABLE `SESSION_STATUS` (
......@@ -342,7 +343,7 @@ TABLE_PRIVILEGES CREATE TABLE `TABLE_PRIVILEGES` (
) DEFAULT CHARSET = utf8mb4 ROW_FORMAT = COMPACT COMPRESSION = 'none' REPLICA_NUM = 1 BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 10 TABLEGROUP = 'oceanbase'
show create table tables;
View Create View character_set_client collation_connection
TABLES CREATE VIEW `TABLES` AS select /*+ READ_CONSISTENCY(WEAK), use_merge(b, c, d, e)*/ 'def' as TABLE_CATALOG, b.database_name as TABLE_SCHEMA, a.table_name as TABLE_NAME, case when a.database_id & 0xFFFFFFFFFF = 2 then 'SYSTEM VIEW' when (a.table_type = 1 or a.table_type = 4) then 'VIEW' when a.table_type = 2 then 'SYSTEM TABLE' when a.table_type = 1 then 'INDEX' else 'BASE TABLE' end as TABLE_TYPE, NULL as ENGINE, NULL as VERSION, NULL as ROW_FORMAT, sum(c.row_count) as TABLE_ROWS, case when sum(c.row_count) = 0 then 0 else sum(c.data_size)/sum(c.row_count) end as AVG_ROW_LENGTH, sum(c.data_size) as DATA_LENGTH, NULL as MAX_DATA_LENGTH, NULL as INDEX_LENGTH, NULL as DATA_FREE, NULL as AUTO_INCREMENT, a.gmt_create as CREATE_TIME, a.gmt_modified as UPDATE_TIME, NULL as CHECK_TIME, d.collation as TABLE_COLLATION, cast(NULL as unsigned) as CHECKSUM, NULL as CREATE_OPTIONS, a.comment as TABLE_COMMENT from oceanbase.__all_virtual_table a inner join oceanbase.__all_virtual_database b on a.database_id = b.database_id left join oceanbase.__all_virtual_tenant_partition_meta_table c on a.table_id = c.table_id and c.tenant_id = effective_tenant_id() and a.tenant_id = c.tenant_id and c.role = 1 inner join oceanbase.__all_collation d on a.collation_type = d.id where a.tenant_id = effective_tenant_id() and b.tenant_id = effective_tenant_id() and a.table_type != 5 and b.database_name != '__recyclebin' and b.in_recyclebin = 0 group by a.table_id, b.database_name, a.table_name, a.table_type, a.gmt_create, a.gmt_modified, d.collation, a.comment utf8mb4 utf8mb4_general_ci
TABLES CREATE VIEW `TABLES` AS select /*+ READ_CONSISTENCY(WEAK), use_merge(b, c, d, e)*/ 'def' as TABLE_CATALOG, b.database_name as TABLE_SCHEMA, a.table_name as TABLE_NAME, case when a.database_id & 0xFFFFFFFFFF = 2 then 'SYSTEM VIEW' when (a.table_type = 1 or a.table_type = 4) then 'VIEW' when a.table_type = 2 then 'SYSTEM TABLE' when a.table_type = 1 then 'INDEX' else 'BASE TABLE' end as TABLE_TYPE, 'OceanBase' as ENGINE, NULL as VERSION, NULL as ROW_FORMAT, sum(c.row_count) as TABLE_ROWS, case when sum(c.row_count) = 0 then 0 else sum(c.data_size)/sum(c.row_count) end as AVG_ROW_LENGTH, sum(c.data_size) as DATA_LENGTH, NULL as MAX_DATA_LENGTH, NULL as INDEX_LENGTH, NULL as DATA_FREE, NULL as AUTO_INCREMENT, a.gmt_create as CREATE_TIME, a.gmt_modified as UPDATE_TIME, NULL as CHECK_TIME, d.collation as TABLE_COLLATION, cast(NULL as unsigned) as CHECKSUM, NULL as CREATE_OPTIONS, a.comment as TABLE_COMMENT from oceanbase.__all_virtual_table a inner join oceanbase.__all_virtual_database b on a.database_id = b.database_id left join oceanbase.__all_virtual_tenant_partition_meta_table c on a.table_id = c.table_id and c.tenant_id = effective_tenant_id() and a.tenant_id = c.tenant_id and c.role = 1 inner join oceanbase.__all_collation d on a.collation_type = d.id where a.tenant_id = effective_tenant_id() and b.tenant_id = effective_tenant_id() and a.table_type != 5 and b.database_name != '__recyclebin' and b.in_recyclebin = 0 and 0 = sys_privilege_check('table_acc', effective_tenant_id(), b.database_name, a.table_name) group by a.table_id, b.database_name, a.table_name, a.table_type, a.gmt_create, a.gmt_modified, d.collation, a.comment utf8mb4 utf8mb4_general_ci
show create table user_privileges;
Table Create Table
USER_PRIVILEGES CREATE TABLE `USER_PRIVILEGES` (
......@@ -353,7 +354,7 @@ USER_PRIVILEGES CREATE TABLE `USER_PRIVILEGES` (
) DEFAULT CHARSET = utf8mb4 ROW_FORMAT = COMPACT COMPRESSION = 'none' REPLICA_NUM = 1 BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 10 TABLEGROUP = 'oceanbase'
show create table views;
View Create View character_set_client collation_connection
VIEWS CREATE VIEW `VIEWS` AS select /*+ READ_CONSISTENCY(WEAK) */ 'def' AS TABLE_CATALOG, d.database_name as TABLE_SCHEMA, t.table_name as TABLE_NAME, t.view_definition as VIEW_DEFINITION, 'NONE' as CHECK_OPTION, case t.view_is_updatable when 1 then 'YES' else 'NO' end as IS_UPDATABLE, 'NONE' as DEFINER, 'NONE' AS SECURITY_TYPE, case t.collation_type when 45 then 'utf8mb4' else 'NONE' end AS CHARACTER_SET_CLIENT, case t.collation_type when 45 then 'utf8mb4_general_ci' else 'NONE' end AS COLLATION_CONNECTION from oceanbase.__all_virtual_table as t join oceanbase.__all_virtual_database as d on t.tenant_id = effective_tenant_id() and d.tenant_id = effective_tenant_id() and t.database_id = d.database_id where (t.table_type = 1 or t.table_type = 4) and d.in_recyclebin = 0 and d.database_name != '__recyclebin' and d.database_name != 'information_schema' and d.database_name != 'oceanbase' utf8mb4 utf8mb4_general_ci
VIEWS CREATE VIEW `VIEWS` AS select /*+ READ_CONSISTENCY(WEAK) */ 'def' AS TABLE_CATALOG, d.database_name as TABLE_SCHEMA, t.table_name as TABLE_NAME, t.view_definition as VIEW_DEFINITION, 'NONE' as CHECK_OPTION, case t.view_is_updatable when 1 then 'YES' else 'NO' end as IS_UPDATABLE, 'NONE' as DEFINER, 'NONE' AS SECURITY_TYPE, case t.collation_type when 45 then 'utf8mb4' else 'NONE' end AS CHARACTER_SET_CLIENT, case t.collation_type when 45 then 'utf8mb4_general_ci' else 'NONE' end AS COLLATION_CONNECTION from oceanbase.__all_virtual_table as t join oceanbase.__all_virtual_database as d on t.tenant_id = effective_tenant_id() and d.tenant_id = effective_tenant_id() and t.database_id = d.database_id where (t.table_type = 1 or t.table_type = 4) and d.in_recyclebin = 0 and d.database_name != '__recyclebin' and d.database_name != 'information_schema' and d.database_name != 'oceanbase' and 0 = sys_privilege_check('table_acc', effective_tenant_id(), d.database_name, t.table_name) utf8mb4 utf8mb4_general_ci
connect conn_sys,$OBMYSQL_MS0,root@sys,,*NO-ONE*,$OBMYSQL_PORT;
drop tenant tt1 force;
drop resource pool mypool1;
......
......@@ -48,6 +48,7 @@ data_type data_type_str data_type_class
44 NCHAR 10
45 ROWID 20
46 LOB 21
47 JSON 22
select data_type, data_type_str, data_type_class from __all_virtual_data_type order by data_type;
data_type data_type_str data_type_class
0 NULL 0
......@@ -97,6 +98,7 @@ data_type data_type_str data_type_class
44 NCHAR 10
45 ROWID 20
46 LOB 21
47 JSON 22
select * from __all_virtual_data_type where data_type = 22;
data_type data_type_str data_type_class
22 VARCHAR 10
......@@ -147,6 +149,7 @@ NVARCHAR2 STRING
NCHAR STRING
ROWID ROWID
LOB LOB
JSON JSON
show create table __all_virtual_data_type;
Table Create Table
__all_virtual_data_type CREATE TABLE `__all_virtual_data_type` (
......
......@@ -22,6 +22,7 @@ data_type_class data_type_class_str
19 INTERVAL
20 ROWID
21 LOB
22 JSON
select data_type_class, data_type_class_str from __all_virtual_data_type_class;
data_type_class data_type_class_str
0 NULL
......@@ -45,6 +46,7 @@ data_type_class data_type_class_str
19 INTERVAL
20 ROWID
21 LOB
22 JSON
select * from __all_virtual_data_type_class where data_type_class = 10;
data_type_class data_type_class_str
10 STRING
......@@ -95,6 +97,7 @@ NVARCHAR2 STRING
NCHAR STRING
ROWID ROWID
LOB LOB
JSON JSON
show create table __all_virtual_data_type_class;
Table Create Table
__all_virtual_data_type_class CREATE TABLE `__all_virtual_data_type_class` (
......
......@@ -26,14 +26,20 @@ name
all_cluster_list
all_server_list
autoinc_cache_refresh_interval
auto_broadcast_location_cache_rate_limit
auto_delete_expired_backup
auto_leader_switch_interval
auto_refresh_location_cache_rate_limit
backup_backup_dest
backup_backup_dest_option
backup_concurrency
backup_dest
backup_dest_option
backup_log_archive_option
backup_net_limit
backup_recovery_window
backup_region
backup_zone
balancer_emergency_percentage
balancer_idle_time
balancer_log_interval
......@@ -51,7 +57,6 @@ clog_disk_usage_limit_percentage
clog_disk_utilization_threshold
clog_max_unconfirmed_log_count
clog_sync_time_warn_threshold
clog_usage_limit_size
cluster
cluster_id
config_additional_dir
......@@ -63,6 +68,8 @@ datafile_size
data_copy_concurrency
data_dir
data_disk_usage_limit_percentage
data_storage_error_tolerance_time
data_storage_warning_tolerance_time
dead_socket_detection_timeout
debug_sync_timeout
default_compress
......@@ -76,6 +83,7 @@ election_blacklist_interval
election_cpu_quota
enable_async_syslog
enable_auto_leader_switch
enable_auto_refresh_location_cache
enable_ddl
enable_early_lock_release
enable_election_group
......@@ -87,7 +95,6 @@ enable_merge_by_turn
enable_monotonic_weak_read
enable_one_phase_commit
enable_perf_event
enable_pg
enable_rebalance
enable_record_trace_id
enable_record_trace_log
......@@ -112,6 +119,7 @@ force_refresh_location_cache_interval
force_refresh_location_cache_threshold
freeze_trigger_percentage
fuse_row_cache_priority
gc_wait_archive
get_leader_candidate_rpc_timeout
global_index_build_single_replica_timeout
global_major_freeze_residual_memory
......@@ -133,6 +141,8 @@ location_cache_cpu_quota
location_cache_expire_time
location_cache_priority
location_cache_refresh_min_interval
location_cache_refresh_rpc_timeout
location_cache_refresh_sql_timeout
location_fetch_concurrency
location_refresh_thread_count
log_archive_batch_buffer_limit
......@@ -175,6 +185,7 @@ net_thread_count
obconfig_url
ob_enable_batched_multi_statement
ob_event_history_recycle_interval
ob_proxy_readonly_transaction_routing_policy
ob_ssl_invited_common_names
open_cursors
partition_table_check_interval
......@@ -207,6 +218,7 @@ row_purge_thread_count
rpc_port
rpc_timeout
schema_history_expire_time
schema_history_recycle_interval
server_balance_cpu_mem_tolerance_percent
server_balance_critical_disk_waterlevel
server_balance_disk_tolerance_percent
......@@ -268,6 +280,8 @@ zone_merge_concurrency
zone_merge_order
zone_merge_timeout
_alter_column_mode
_auto_drop_tenant_if_restore_failed
_auto_update_reserved_backup_timestamp
_backup_idle_time
_backup_retry_timeout
_bloom_filter_enabled
......@@ -277,6 +291,9 @@ _chunk_row_store_mem_limit
_clog_aggregation_buffer_amount
_create_table_partition_distribution_strategy
_data_storage_io_timeout
_enable_block_file_punch_hole
_enable_compaction_diagnose
_enable_defensive_check
_enable_easy_keepalive
_enable_fast_commit
_enable_filter_push_down_storage
......@@ -288,7 +305,6 @@ _enable_oracle_priv_check
_enable_parallel_minor_merge
_enable_plan_cache_mem_diagnosis
_enable_sparse_row
_enable_split_partition
_enable_static_typing_engine
_flush_clog_aggregation_buffer_timeout
_follower_replica_merge_level
......@@ -313,6 +329,7 @@ _ob_elr_fast_freeze_threshold
_ob_enable_fast_freeze
_ob_enable_log_replica_strict_recycle_mode
_ob_enable_prepared_statement
_ob_enable_px_for_inner_sql
_ob_get_gts_ahead_interval
_ob_minor_merge_schedule_interval
_ob_plan_cache_gc_strategy
......@@ -331,7 +348,6 @@ _px_message_compression
_recyclebin_object_purge_frequency
_restore_idle_time
_rpc_checksum
_schema_history_recycle_interval
_single_zone_deployment_on
_sort_area_size
_temporary_file_io_area_size
......@@ -342,7 +358,6 @@ _xa_gc_timeout
__balance_controller
__easy_memory_limit
__easy_memory_reserved_percentage
__enable_block_receiving_clog
__enable_identical_partition_distribution
__enable_small_tenant
__min_full_resource_pool_memory
......
use information_schema;
select * from schemata limit 0;
CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH
CATALOG_NAME SCHEMA_NAME DEFAULT_CHARACTER_SET_NAME DEFAULT_COLLATION_NAME SQL_PATH DEFAULT_ENCRYPTION
select schema_name from schemata;
show create view schemata;
View Create View character_set_client collation_connection
SCHEMATA CREATE VIEW `SCHEMATA` AS SELECT 'def' AS CATALOG_NAME, DATABASE_NAME AS SCHEMA_NAME, 'utf8mb4' AS DEFAULT_CHARACTER_SET_NAME, 'utf8mb4_general_ci' AS DEFAULT_COLLATION_NAME, NULL AS SQL_PATH FROM oceanbase.__all_virtual_database a WHERE a.tenant_id = effective_tenant_id() and in_recyclebin = 0 and database_name != '__recyclebin' utf8mb4 utf8mb4_general_ci
SCHEMATA CREATE VIEW `SCHEMATA` AS SELECT 'def' AS CATALOG_NAME, DATABASE_NAME AS SCHEMA_NAME, 'utf8mb4' AS DEFAULT_CHARACTER_SET_NAME, 'utf8mb4_general_ci' AS DEFAULT_COLLATION_NAME, NULL AS SQL_PATH, 'NO' as DEFAULT_ENCRYPTION FROM oceanbase.__all_virtual_database a WHERE a.tenant_id = effective_tenant_id() and in_recyclebin = 0 and database_name != '__recyclebin' utf8mb4 utf8mb4_general_ci
desc schemata;
Field Type Null Key Default Extra
CATALOG_NAME varchar(3) NO
......@@ -12,3 +12,4 @@ SCHEMA_NAME varchar(128) NO
DEFAULT_CHARACTER_SET_NAME varchar(7) NO
DEFAULT_COLLATION_NAME varchar(18) NO
SQL_PATH null NO
DEFAULT_ENCRYPTION varchar(2) NO
......@@ -1793,12 +1793,12 @@ a
1
select !w, !!w, !(!w), ! !w, not w, not not w, w is true, w is not false, (not w) is false, not(w is false), if(w,'true','false'), !1+1, !'a', !false, !isnull('a'), !!isnull('a') from (select 0 w union select 1) w;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def !w !w 8 1 1 N 32897 0 63
def !!w !!w 8 1 1 N 32897 0 63
def !(!w) !(!w) 8 1 1 N 32897 0 63
def ! !w ! !w 8 1 1 N 32897 0 63
def not w not w 8 1 1 N 32897 0 63
def not not w not not w 8 1 1 N 32897 0 63
def !w !w 8 1 1 Y 32896 0 63
def !!w !!w 8 1 1 Y 32896 0 63
def !(!w) !(!w) 8 1 1 Y 32896 0 63
def ! !w ! !w 8 1 1 Y 32896 0 63
def not w not w 8 1 1 Y 32896 0 63
def not not w not not w 8 1 1 Y 32896 0 63
def w is true w is true 3 1 1 N 32897 0 63
def w is not false w is not false 3 1 1 N 32897 0 63
def (not w) is false (not w) is false 3 1 1 N 32897 0 63
......
......@@ -154,7 +154,7 @@ insert into t1 values('01-01-01'),('02-02-02'),('01-01-01'),('02-02-02');
set @bug28261='';
select if(@bug28261 = f1, '', @bug28261:= f1) from t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def if(@bug28261 = f1, '', @bug28261:= f1) if(@bug28261 = f1, '', @bug28261:= f1) 253 4194304 26 Y 0 31 45
def if(@bug28261 = f1, '', @bug28261:= f1) if(@bug28261 = f1, '', @bug28261:= f1) 253 104 26 Y 0 31 45
if(@bug28261 = f1, '', @bug28261:= f1)
2001-01-01 00:00:00.000000
2002-02-02 00:00:00.000000
......
......@@ -44,16 +44,22 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
def str_to_date('1970-01-02','null') + 100 str_to_date('1970-01-02','null') + 100 8 11 0 Y 32896 0 63
str_to_date('1970-01-02','null') + 100
NULL
Warnings:
Warning 1411 Incorrect datetime value: '1970-01-02' for function str_to_date
select str_to_date('1970-01-02',0)+ 1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def str_to_date('1970-01-02',0)+ 1 str_to_date('1970-01-02',0)+ 1 246 21 0 Y 32896 0 63
str_to_date('1970-01-02',0)+ 1
NULL
Warnings:
Warning 1411 Incorrect datetime value: '1970-01-02' for function str_to_date
select str_to_date('1970-01-02', 23) +10;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def str_to_date('1970-01-02', 23) +10 str_to_date('1970-01-02', 23) +10 246 21 0 Y 32896 0 63
str_to_date('1970-01-02', 23) +10
NULL
Warnings:
Warning 1411 Incorrect datetime value: '1970-01-02' for function str_to_date
select str_to_date('1970-01-02 12:23:32','%Y-%m-%d %H:%i:%s')+ 10000;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def str_to_date('1970-01-02 12:23:32','%Y-%m-%d %H:%i:%s')+ 10000 str_to_date('1970-01-02 12:23:32','%Y-%m-%d %H:%i:%s')+ 10000 246 21 14 Y 32896 0 63
......@@ -74,6 +80,8 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
def str_to_date('12:23:32',10)+ 10000 str_to_date('12:23:32',10)+ 10000 246 21 0 Y 32896 0 63
str_to_date('12:23:32',10)+ 10000
NULL
Warnings:
Warning 1411 Incorrect datetime value: '12:23:32' for function str_to_date
drop table if exists t1, t2, t3, t3k;
CREATE TABLE t1 (EMPNUM INT);
INSERT INTO t1 VALUES (0), (2);
......
......@@ -11,7 +11,6 @@ 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);
### 1, 基本测试 ###
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
......@@ -79,7 +78,6 @@ 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
### 3, 复杂测试(集合、子查询中等) ###
SELECT count(*), sum(b.d1) from
nn1 a, nn2 b, nn1 c
WHERE
......@@ -142,7 +140,6 @@ select /* leading(t3 (t2 t1)) */ sum(t1.c1) from nn1 t1 , nn1 t2 , nn1 t3 where
and t3.c1 in (1,2);
sum(t1.c1)
NULL
### 4, 错误、无效或冗余的指定测试 ###
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)
......@@ -171,7 +168,6 @@ 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
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
### 6, 嵌套hint和hint的print测试 ###
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 ;
......@@ -180,17 +176,17 @@ count(a.c1+b.d2) sum(b.d2+b.d2*a.c1)
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)) */`bushy_leading_hint_db`.`a`.`c1` AS `a_c1`,`bushy_leading_hint_db`.`a`.`c2` AS `a_c2`,`bushy_leading_hint_db`.`a`.`c3` AS `a_c3`,`bushy_leading_hint_db`.`b`.`d1` AS `d1`,`bushy_leading_hint_db`.`b`.`d2` AS `d2`,`bushy_leading_hint_db`.`b`.`d3` AS `d3`,`bushy_leading_hint_db`.`c`.`c1` AS `c_c1`,`bushy_leading_hint_db`.`c`.`c2` AS `c_c2`,`bushy_leading_hint_db`.`c`.`c3` AS `c_c3` from ((`bushy_leading_hint_db`.`nn1` `a` join `bushy_leading_hint_db`.`nn2` `b` on ((`bushy_leading_hint_db`.`a`.`c1` = `bushy_leading_hint_db`.`b`.`d2`))) join `bushy_leading_hint_db`.`nn1` `c` on ((`bushy_leading_hint_db`.`b`.`d1` = `bushy_leading_hint_db`.`c`.`c1`))) where (`bushy_leading_hint_db`.`a`.`c2` < 5) utf8mb4 utf8mb4_general_ci
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)) */`bushy_leading_hint_db`.`a`.`c1` AS `a_c1`,`bushy_leading_hint_db`.`a`.`c2` AS `a_c2`,`bushy_leading_hint_db`.`a`.`c3` AS `a_c3`,`bushy_leading_hint_db`.`b`.`d1` AS `d1`,`bushy_leading_hint_db`.`b`.`d2` AS `d2`,`bushy_leading_hint_db`.`b`.`d3` AS `d3`,`bushy_leading_hint_db`.`c`.`c1` AS `c_c1`,`bushy_leading_hint_db`.`c`.`c2` AS `c_c2`,`bushy_leading_hint_db`.`c`.`c3` AS `c_c3` from ((`bushy_leading_hint_db`.`nn1` `a` join `bushy_leading_hint_db`.`nn2` `b` on ((`bushy_leading_hint_db`.`a`.`c1` = `bushy_leading_hint_db`.`b`.`d2`))) join `bushy_leading_hint_db`.`nn1` `c` on ((`bushy_leading_hint_db`.`b`.`d1` = `bushy_leading_hint_db`.`c`.`c1`))) where (`bushy_leading_hint_db`.`a`.`c2` < 5) utf8mb4 utf8mb4_general_ci
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))) */`bushy_leading_hint_db`.`a`.`c1` AS `a_c1`,`bushy_leading_hint_db`.`a`.`c2` AS `a_c2`,`bushy_leading_hint_db`.`a`.`c3` AS `a_c3`,`bushy_leading_hint_db`.`b`.`d1` AS `d1`,`bushy_leading_hint_db`.`b`.`d2` AS `d2`,`bushy_leading_hint_db`.`b`.`d3` AS `d3`,`bushy_leading_hint_db`.`c`.`c1` AS `c_c1`,`bushy_leading_hint_db`.`c`.`c2` AS `c_c2`,`bushy_leading_hint_db`.`c`.`c3` AS `c_c3` from (((`bushy_leading_hint_db`.`nn1` `a` join `bushy_leading_hint_db`.`nn2` `b` on ((`bushy_leading_hint_db`.`a`.`c1` = `bushy_leading_hint_db`.`b`.`d2`))) join `bushy_leading_hint_db`.`nn1` `c` on ((`bushy_leading_hint_db`.`b`.`d1` = `bushy_leading_hint_db`.`c`.`c1`))) join `bushy_leading_hint_db`.`nn1` `d` on ((`bushy_leading_hint_db`.`d`.`c2` = `bushy_leading_hint_db`.`c`.`c2`))) where (`bushy_leading_hint_db`.`a`.`c2` < 5) utf8mb4 utf8mb4_general_ci
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
......@@ -198,7 +194,7 @@ where t1.c1 = t2.c1 and t1.c1=t3.c2 and t2.c1 = t3.c1 and t3.c1 = t4.c1 and t4.c
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)) */`bushy_leading_hint_db`.`t1`.`c1` AS `x`,`bushy_leading_hint_db`.`t3`.`c2` AS `y`,`bushy_leading_hint_db`.`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 (`bushy_leading_hint_db`.`t1`.`c1` = `bushy_leading_hint_db`.`t2`.`c1`) and (`bushy_leading_hint_db`.`t1`.`c1` = `bushy_leading_hint_db`.`t3`.`c2`) and (`bushy_leading_hint_db`.`t2`.`c1` = `bushy_leading_hint_db`.`t3`.`c1`) and (`bushy_leading_hint_db`.`t3`.`c1` = `bushy_leading_hint_db`.`t4`.`c1`) and (`bushy_leading_hint_db`.`t4`.`c1` = `bushy_leading_hint_db`.`t5`.`c1`) and (`bushy_leading_hint_db`.`t5`.`c1` = `bushy_leading_hint_db`.`t6`.`c1`) and (`bushy_leading_hint_db`.`t6`.`c1` = `bushy_leading_hint_db`.`t7`.`c1`) and (`bushy_leading_hint_db`.`t7`.`c1` = `bushy_leading_hint_db`.`t8`.`c1`) and (`bushy_leading_hint_db`.`t8`.`c1` = `bushy_leading_hint_db`.`t9`.`c1`) and (`bushy_leading_hint_db`.`t8`.`c1` = `bushy_leading_hint_db`.`t2`.`c1`) and (`bushy_leading_hint_db`.`t1`.`c1` = `bushy_leading_hint_db`.`t9`.`c1`) utf8mb4 utf8mb4_general_ci
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
......@@ -237,7 +233,6 @@ 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
### 7, 带qb_name的测试 ###
select /*+ LEADING(@x2x (c d), (a b)) */
* from nn1 x
where exists (select /*+ qb_name(x2x) */ 1
......@@ -256,7 +251,6 @@ 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
### 8, 通过bushy 扩展能获取较好的计划 ###
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
......
......@@ -118,6 +118,6 @@ drop view v1;
create view v1 as select version() from dual limit 10;
desc v1;
Field Type Null Key Default Extra
version() varchar(5) NO
version() varchar(18) NO
drop view v1;
connection conn_admin;
......@@ -214,7 +214,7 @@ Outputs & filters:
equal_conds([cast(t2.c2, DECIMAL(-1, -1)) = VIEW1.1]), other_conds(nil)
2 - output([VIEW1.1]), filter(nil),
access([VIEW1.1])
3 - output([cast(1, DECIMAL(1, 0))]), filter(nil), limit(1), offset(nil)
3 - output([?]), filter(nil), limit(1), offset(nil)
4 - output([1]), filter(nil),
conds(nil), nl_params_(nil)
5 - output([1]), filter(nil),
......
......@@ -41,11 +41,10 @@ NULL 1990-09-01 12:34:56.000000 1990-09-01 12:34:56.000000 1990-09-01 12:34:56.0
2015/05/30 11/12/13 2015-05-30 11:12:13.000000 2015-05-30 11:12:13.000000 2015-05-30 11:12:13.000000
2015@05!30 11~12`13 2015-05-30 11:12:13.000000 2015-05-30 11:12:13.000000 2015-05-30 11:12:13.000000
2015^05%30 11$12#13 2015-05-30 11:12:13.000000 2015-05-30 11:12:13.000000 2015-05-30 11:12:13.000000
9999-12-31 23:59:59 9999-12-31 23:59:59.000000 0000-00-00 00:00:00.000000 9999-12-31 23:59:59.000000
9999-12-31 23:59:59 9999-12-31 23:59:59.000000 9999-12-31 23:59:59.000000 9999-12-31 23:59:59.000000
set time_zone='-8:00';
select str_val, ts_val from dt order by ts_val, str_val;
str_val ts_val
9999-12-31 23:59:59 0000-00-00 00:00:00.000000
1000-01-01 00:00:00 0999-12-31 08:00:00.000000
10111213141516 1011-12-12 22:15:16.000000
1969-12-31 23:59:59 1969-12-31 07:59:59.000000
......@@ -61,6 +60,7 @@ NULL 1990-08-31 20:34:56.000000
2015/05/30 11/12/13 2015-05-29 19:12:13.000000
2015@05!30 11~12`13 2015-05-29 19:12:13.000000
2015^05%30 11$12#13 2015-05-29 19:12:13.000000
9999-12-31 23:59:59 9999-12-31 07:59:59.000000
set time_zone='+8:00';
select str_val, date_format(dt_val, '%Y-%b-%D %T %a'), date_format(ts_val, '%Y-%b-%D %T %a') from dt order by dt_val, ts_val, str_val;
str_val date_format(dt_val, '%Y-%b-%D %T %a') date_format(ts_val, '%Y-%b-%D %T %a')
......@@ -79,7 +79,7 @@ NULL 1990-Sep-1st 12:34:56 Sat 1990-Sep-1st 12:34:56 Sat
2015/05/30 11/12/13 2015-May-30th 11:12:13 Sat 2015-May-30th 11:12:13 Sat
2015@05!30 11~12`13 2015-May-30th 11:12:13 Sat 2015-May-30th 11:12:13 Sat
2015^05%30 11$12#13 2015-May-30th 11:12:13 Sat 2015-May-30th 11:12:13 Sat
9999-12-31 23:59:59 9999-Dec-31st 23:59:59 Fri NULL
9999-12-31 23:59:59 9999-Dec-31st 23:59:59 Fri 9999-Dec-31st 23:59:59 Fri
drop table dt;
create table dt(id int primary key auto_increment, str varchar(100), t_val time(6));
insert into dt(str) values
......
select version();
version()
3.1.1-OceanBase CE
3.1.3-OceanBase CE
show variables like 'version';
Variable_name Value
version 3.1.1-OceanBase CE
version 3.1.3-OceanBase CE
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册