cherry-pick omitted fixs to open-source branch
This commit is contained in:
@ -17,17 +17,19 @@
|
||||
#include "share/schema/ob_schema_service_sql_impl.h"
|
||||
#include "share/schema/ob_table_schema.h"
|
||||
|
||||
namespace oceanbase {
|
||||
namespace oceanbase
|
||||
{
|
||||
using namespace share::schema;
|
||||
using namespace common;
|
||||
namespace share {
|
||||
namespace share
|
||||
{
|
||||
|
||||
int ObInnerTableSchema::gv_plan_cache_stat_schema(ObTableSchema& table_schema)
|
||||
int ObInnerTableSchema::gv_plan_cache_stat_schema(ObTableSchema &table_schema)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
uint64_t column_id = OB_APP_MIN_COLUMN_ID - 1;
|
||||
|
||||
// generated fields:
|
||||
//generated fields:
|
||||
table_schema.set_tenant_id(OB_SYS_TENANT_ID);
|
||||
table_schema.set_tablegroup_id(combine_id(OB_SYS_TENANT_ID, OB_SYS_TABLEGROUP_ID));
|
||||
table_schema.set_database_id(combine_id(OB_SYS_TENANT_ID, OB_SYS_DATABASE_ID));
|
||||
@ -58,8 +60,7 @@ int ObInnerTableSchema::gv_plan_cache_stat_schema(ObTableSchema& table_schema)
|
||||
table_schema.set_create_mem_version(1);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(
|
||||
R"__( SELECT tenant_id,svr_ip,svr_port,sql_num,mem_used,mem_hold,access_count, hit_count,hit_rate,plan_num,mem_limit,hash_bucket,stmtkey_num FROM oceanbase.__all_virtual_plan_cache_stat WHERE is_serving_tenant(svr_ip, svr_port, effective_tenant_id()) and (tenant_id = effective_tenant_id() or effective_tenant_id() = 1) )__"))) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(R"__( SELECT tenant_id,svr_ip,svr_port,sql_num,mem_used,mem_hold,access_count, hit_count,hit_rate,plan_num,mem_limit,hash_bucket,stmtkey_num FROM oceanbase.__all_virtual_plan_cache_stat WHERE is_serving_tenant(svr_ip, svr_port, effective_tenant_id()) and (tenant_id = effective_tenant_id() or effective_tenant_id() = 1) )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
@ -71,17 +72,16 @@ int ObInnerTableSchema::gv_plan_cache_stat_schema(ObTableSchema& table_schema)
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
table_schema.get_part_option().set_max_used_part_id(table_schema.get_part_option().get_part_num() - 1);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(
|
||||
OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::gv_plan_cache_plan_stat_schema(ObTableSchema& table_schema)
|
||||
int ObInnerTableSchema::gv_plan_cache_plan_stat_schema(ObTableSchema &table_schema)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
uint64_t column_id = OB_APP_MIN_COLUMN_ID - 1;
|
||||
|
||||
// generated fields:
|
||||
//generated fields:
|
||||
table_schema.set_tenant_id(OB_SYS_TENANT_ID);
|
||||
table_schema.set_tablegroup_id(combine_id(OB_SYS_TENANT_ID, OB_SYS_TABLEGROUP_ID));
|
||||
table_schema.set_database_id(combine_id(OB_SYS_TENANT_ID, OB_SYS_DATABASE_ID));
|
||||
@ -112,8 +112,7 @@ int ObInnerTableSchema::gv_plan_cache_plan_stat_schema(ObTableSchema& table_sche
|
||||
table_schema.set_create_mem_version(1);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(
|
||||
R"__( SELECT tenant_id,svr_ip,svr_port,plan_id,sql_id,type,is_bind_sensitive,is_bind_aware,db_id,statement,query_sql,special_params,param_infos, sys_vars,plan_hash,first_load_time,schema_version,merged_version,last_active_time,avg_exe_usec,slowest_exe_time,slowest_exe_usec,slow_count,hit_count,plan_size,executions,disk_reads,direct_writes,buffer_gets,application_wait_time,concurrency_wait_time,user_io_wait_time,rows_processed,elapsed_time,cpu_time,large_querys,delayed_large_querys,delayed_px_querys,outline_version,outline_id,outline_data,acs_sel_info,table_scan,evolution, evo_executions, evo_cpu_time, timeout_count, ps_stmt_id, sessid, temp_tables, is_use_jit,object_type,hints_info,hints_all_worked, pl_schema_id, is_batched_multi_stmt FROM oceanbase.__all_virtual_plan_stat WHERE is_serving_tenant(svr_ip, svr_port, effective_tenant_id()) and (tenant_id = effective_tenant_id() or effective_tenant_id() = 1) )__"))) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(R"__( SELECT tenant_id,svr_ip,svr_port,plan_id,sql_id,type,is_bind_sensitive,is_bind_aware,db_id,statement,query_sql,special_params,param_infos, sys_vars,plan_hash,first_load_time,schema_version,merged_version,last_active_time,avg_exe_usec,slowest_exe_time,slowest_exe_usec,slow_count,hit_count,plan_size,executions,disk_reads,direct_writes,buffer_gets,application_wait_time,concurrency_wait_time,user_io_wait_time,rows_processed,elapsed_time,cpu_time,large_querys,delayed_large_querys,delayed_px_querys,outline_version,outline_id,outline_data,acs_sel_info,table_scan,evolution, evo_executions, evo_cpu_time, timeout_count, ps_stmt_id, sessid, temp_tables, is_use_jit,object_type,hints_info,hints_all_worked, pl_schema_id, is_batched_multi_stmt FROM oceanbase.__all_virtual_plan_stat WHERE is_serving_tenant(svr_ip, svr_port, effective_tenant_id()) and (tenant_id = effective_tenant_id() or effective_tenant_id() = 1) )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
@ -125,17 +124,16 @@ int ObInnerTableSchema::gv_plan_cache_plan_stat_schema(ObTableSchema& table_sche
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
table_schema.get_part_option().set_max_used_part_id(table_schema.get_part_option().get_part_num() - 1);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(
|
||||
OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::schemata_schema(ObTableSchema& table_schema)
|
||||
int ObInnerTableSchema::schemata_schema(ObTableSchema &table_schema)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
uint64_t column_id = OB_APP_MIN_COLUMN_ID - 1;
|
||||
|
||||
// generated fields:
|
||||
//generated fields:
|
||||
table_schema.set_tenant_id(OB_SYS_TENANT_ID);
|
||||
table_schema.set_tablegroup_id(OB_INVALID_ID);
|
||||
table_schema.set_database_id(combine_id(OB_SYS_TENANT_ID, OB_INFORMATION_SCHEMA_ID));
|
||||
@ -166,8 +164,7 @@ int ObInnerTableSchema::schemata_schema(ObTableSchema& table_schema)
|
||||
table_schema.set_create_mem_version(1);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(
|
||||
R"__( 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' )__"))) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(R"__( 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' )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
@ -179,17 +176,16 @@ int ObInnerTableSchema::schemata_schema(ObTableSchema& table_schema)
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
table_schema.get_part_option().set_max_used_part_id(table_schema.get_part_option().get_part_num() - 1);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(
|
||||
OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::character_sets_schema(ObTableSchema& table_schema)
|
||||
int ObInnerTableSchema::character_sets_schema(ObTableSchema &table_schema)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
uint64_t column_id = OB_APP_MIN_COLUMN_ID - 1;
|
||||
|
||||
// generated fields:
|
||||
//generated fields:
|
||||
table_schema.set_tenant_id(OB_SYS_TENANT_ID);
|
||||
table_schema.set_tablegroup_id(OB_INVALID_ID);
|
||||
table_schema.set_database_id(combine_id(OB_SYS_TENANT_ID, OB_INFORMATION_SCHEMA_ID));
|
||||
@ -220,8 +216,7 @@ int ObInnerTableSchema::character_sets_schema(ObTableSchema& table_schema)
|
||||
table_schema.set_create_mem_version(1);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(
|
||||
R"__( SELECT CHARSET AS CHARACTER_SET_NAME, DEFAULT_COLLATION AS DEFAULT_COLLATE_NAME, DESCRIPTION, max_length AS MAXLEN FROM oceanbase.__tenant_virtual_charset )__"))) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(R"__( SELECT CHARSET AS CHARACTER_SET_NAME, DEFAULT_COLLATION AS DEFAULT_COLLATE_NAME, DESCRIPTION, max_length AS MAXLEN FROM oceanbase.__tenant_virtual_charset )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
@ -233,17 +228,16 @@ int ObInnerTableSchema::character_sets_schema(ObTableSchema& table_schema)
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
table_schema.get_part_option().set_max_used_part_id(table_schema.get_part_option().get_part_num() - 1);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(
|
||||
OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::global_variables_schema(ObTableSchema& table_schema)
|
||||
int ObInnerTableSchema::global_variables_schema(ObTableSchema &table_schema)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
uint64_t column_id = OB_APP_MIN_COLUMN_ID - 1;
|
||||
|
||||
// generated fields:
|
||||
//generated fields:
|
||||
table_schema.set_tenant_id(OB_SYS_TENANT_ID);
|
||||
table_schema.set_tablegroup_id(OB_INVALID_ID);
|
||||
table_schema.set_database_id(combine_id(OB_SYS_TENANT_ID, OB_INFORMATION_SCHEMA_ID));
|
||||
@ -274,8 +268,7 @@ int ObInnerTableSchema::global_variables_schema(ObTableSchema& table_schema)
|
||||
table_schema.set_create_mem_version(1);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(
|
||||
R"__( SELECT `variable_name` as VARIABLE_NAME, `value` as VARIABLE_VALUE FROM oceanbase.__tenant_virtual_global_variable )__"))) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(R"__( SELECT `variable_name` as VARIABLE_NAME, `value` as VARIABLE_VALUE FROM oceanbase.__tenant_virtual_global_variable )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
@ -287,17 +280,16 @@ int ObInnerTableSchema::global_variables_schema(ObTableSchema& table_schema)
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
table_schema.get_part_option().set_max_used_part_id(table_schema.get_part_option().get_part_num() - 1);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(
|
||||
OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::statistics_schema(ObTableSchema& table_schema)
|
||||
int ObInnerTableSchema::statistics_schema(ObTableSchema &table_schema)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
uint64_t column_id = OB_APP_MIN_COLUMN_ID - 1;
|
||||
|
||||
// generated fields:
|
||||
//generated fields:
|
||||
table_schema.set_tenant_id(OB_SYS_TENANT_ID);
|
||||
table_schema.set_tablegroup_id(OB_INVALID_ID);
|
||||
table_schema.set_database_id(combine_id(OB_SYS_TENANT_ID, OB_INFORMATION_SCHEMA_ID));
|
||||
@ -328,8 +320,7 @@ int ObInnerTableSchema::statistics_schema(ObTableSchema& table_schema)
|
||||
table_schema.set_create_mem_version(1);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(
|
||||
R"__( SELECT 'def' as TABLE_CATALOG, table_schema AS TABLE_SCHEMA, `table` as TABLE_NAME, non_unique AS NON_UNIQUE, index_schema as INDEX_SCHEMA, key_name as INDEX_NAME, seq_in_index as SEQ_IN_INDEX, column_name as COLUMN_NAME, collation as COLLATION, cardinality as CARDINALITY, sub_part as SUB_PART, packed as PACKED, `null` as NULLABLE, index_type as INDEX_TYPE, COMMENT, index_comment as INDEX_COMMENT, is_visible as IS_VISIBLE FROM oceanbase.__tenant_virtual_table_index )__"))) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(R"__( SELECT 'def' as TABLE_CATALOG, table_schema AS TABLE_SCHEMA, `table` as TABLE_NAME, non_unique AS NON_UNIQUE, index_schema as INDEX_SCHEMA, key_name as INDEX_NAME, seq_in_index as SEQ_IN_INDEX, column_name as COLUMN_NAME, collation as COLLATION, cardinality as CARDINALITY, sub_part as SUB_PART, packed as PACKED, `null` as NULLABLE, index_type as INDEX_TYPE, COMMENT, index_comment as INDEX_COMMENT, is_visible as IS_VISIBLE FROM oceanbase.__tenant_virtual_table_index )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
@ -341,17 +332,16 @@ int ObInnerTableSchema::statistics_schema(ObTableSchema& table_schema)
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
table_schema.get_part_option().set_max_used_part_id(table_schema.get_part_option().get_part_num() - 1);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(
|
||||
OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::views_schema(ObTableSchema& table_schema)
|
||||
int ObInnerTableSchema::views_schema(ObTableSchema &table_schema)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
uint64_t column_id = OB_APP_MIN_COLUMN_ID - 1;
|
||||
|
||||
// generated fields:
|
||||
//generated fields:
|
||||
table_schema.set_tenant_id(OB_SYS_TENANT_ID);
|
||||
table_schema.set_tablegroup_id(OB_INVALID_ID);
|
||||
table_schema.set_database_id(combine_id(OB_SYS_TENANT_ID, OB_INFORMATION_SCHEMA_ID));
|
||||
@ -382,8 +372,7 @@ int ObInnerTableSchema::views_schema(ObTableSchema& table_schema)
|
||||
table_schema.set_create_mem_version(1);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(
|
||||
R"__(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' )__"))) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(R"__(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' )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
@ -395,17 +384,16 @@ int ObInnerTableSchema::views_schema(ObTableSchema& table_schema)
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
table_schema.get_part_option().set_max_used_part_id(table_schema.get_part_option().get_part_num() - 1);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(
|
||||
OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::tables_schema(ObTableSchema& table_schema)
|
||||
int ObInnerTableSchema::tables_schema(ObTableSchema &table_schema)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
uint64_t column_id = OB_APP_MIN_COLUMN_ID - 1;
|
||||
|
||||
// generated fields:
|
||||
//generated fields:
|
||||
table_schema.set_tenant_id(OB_SYS_TENANT_ID);
|
||||
table_schema.set_tablegroup_id(OB_INVALID_ID);
|
||||
table_schema.set_database_id(combine_id(OB_SYS_TENANT_ID, OB_INFORMATION_SCHEMA_ID));
|
||||
@ -436,8 +424,7 @@ int ObInnerTableSchema::tables_schema(ObTableSchema& table_schema)
|
||||
table_schema.set_create_mem_version(1);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(
|
||||
R"__(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 )__"))) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(R"__(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 )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
@ -449,17 +436,16 @@ int ObInnerTableSchema::tables_schema(ObTableSchema& table_schema)
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
table_schema.get_part_option().set_max_used_part_id(table_schema.get_part_option().get_part_num() - 1);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(
|
||||
OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::collations_schema(ObTableSchema& table_schema)
|
||||
int ObInnerTableSchema::collations_schema(ObTableSchema &table_schema)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
uint64_t column_id = OB_APP_MIN_COLUMN_ID - 1;
|
||||
|
||||
// generated fields:
|
||||
//generated fields:
|
||||
table_schema.set_tenant_id(OB_SYS_TENANT_ID);
|
||||
table_schema.set_tablegroup_id(OB_INVALID_ID);
|
||||
table_schema.set_database_id(combine_id(OB_SYS_TENANT_ID, OB_INFORMATION_SCHEMA_ID));
|
||||
@ -490,8 +476,7 @@ int ObInnerTableSchema::collations_schema(ObTableSchema& table_schema)
|
||||
table_schema.set_create_mem_version(1);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(
|
||||
R"__(select collation as COLLATION_NAME, charset as CHARACTER_SET_NAME, id as ID, `is_default` as IS_DEFAULT, is_compiled as IS_COMPILED, sortlen as SORTLEN from oceanbase.__tenant_virtual_collation )__"))) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(R"__(select collation as COLLATION_NAME, charset as CHARACTER_SET_NAME, id as ID, `is_default` as IS_DEFAULT, is_compiled as IS_COMPILED, sortlen as SORTLEN from oceanbase.__tenant_virtual_collation )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
@ -503,17 +488,16 @@ int ObInnerTableSchema::collations_schema(ObTableSchema& table_schema)
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
table_schema.get_part_option().set_max_used_part_id(table_schema.get_part_option().get_part_num() - 1);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(
|
||||
OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::collation_character_set_applicability_schema(ObTableSchema& table_schema)
|
||||
int ObInnerTableSchema::collation_character_set_applicability_schema(ObTableSchema &table_schema)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
uint64_t column_id = OB_APP_MIN_COLUMN_ID - 1;
|
||||
|
||||
// generated fields:
|
||||
//generated fields:
|
||||
table_schema.set_tenant_id(OB_SYS_TENANT_ID);
|
||||
table_schema.set_tablegroup_id(OB_INVALID_ID);
|
||||
table_schema.set_database_id(combine_id(OB_SYS_TENANT_ID, OB_INFORMATION_SCHEMA_ID));
|
||||
@ -544,8 +528,7 @@ int ObInnerTableSchema::collation_character_set_applicability_schema(ObTableSche
|
||||
table_schema.set_create_mem_version(1);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(
|
||||
R"__(select collation as COLLATION_NAME, charset as CHARACTER_SET_NAME from oceanbase.__tenant_virtual_collation )__"))) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(R"__(select collation as COLLATION_NAME, charset as CHARACTER_SET_NAME from oceanbase.__tenant_virtual_collation )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
@ -557,17 +540,16 @@ int ObInnerTableSchema::collation_character_set_applicability_schema(ObTableSche
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
table_schema.get_part_option().set_max_used_part_id(table_schema.get_part_option().get_part_num() - 1);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(
|
||||
OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::processlist_schema(ObTableSchema& table_schema)
|
||||
int ObInnerTableSchema::processlist_schema(ObTableSchema &table_schema)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
uint64_t column_id = OB_APP_MIN_COLUMN_ID - 1;
|
||||
|
||||
// generated fields:
|
||||
//generated fields:
|
||||
table_schema.set_tenant_id(OB_SYS_TENANT_ID);
|
||||
table_schema.set_tablegroup_id(OB_INVALID_ID);
|
||||
table_schema.set_database_id(combine_id(OB_SYS_TENANT_ID, OB_INFORMATION_SCHEMA_ID));
|
||||
@ -598,8 +580,7 @@ int ObInnerTableSchema::processlist_schema(ObTableSchema& table_schema)
|
||||
table_schema.set_create_mem_version(1);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(
|
||||
R"__(SELECT id AS ID, user AS USER, host AS HOST, db AS DB, command AS COMMAND, time AS TIME, state AS STATE, info AS INFO FROM oceanbase.__all_virtual_processlist WHERE is_serving_tenant(svr_ip, svr_port, effective_tenant_id()) )__"))) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(R"__(SELECT id AS ID, user AS USER, host AS HOST, db AS DB, command AS COMMAND, time AS TIME, state AS STATE, info AS INFO FROM oceanbase.__all_virtual_processlist WHERE is_serving_tenant(svr_ip, svr_port, effective_tenant_id()) )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
@ -611,17 +592,16 @@ int ObInnerTableSchema::processlist_schema(ObTableSchema& table_schema)
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
table_schema.get_part_option().set_max_used_part_id(table_schema.get_part_option().get_part_num() - 1);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(
|
||||
OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::key_column_usage_schema(ObTableSchema& table_schema)
|
||||
int ObInnerTableSchema::key_column_usage_schema(ObTableSchema &table_schema)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
uint64_t column_id = OB_APP_MIN_COLUMN_ID - 1;
|
||||
|
||||
// generated fields:
|
||||
//generated fields:
|
||||
table_schema.set_tenant_id(OB_SYS_TENANT_ID);
|
||||
table_schema.set_tablegroup_id(OB_INVALID_ID);
|
||||
table_schema.set_database_id(combine_id(OB_SYS_TENANT_ID, OB_INFORMATION_SCHEMA_ID));
|
||||
@ -652,8 +632,7 @@ int ObInnerTableSchema::key_column_usage_schema(ObTableSchema& table_schema)
|
||||
table_schema.set_create_mem_version(1);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(
|
||||
R"__((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) )__"))) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(R"__((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) )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
@ -665,17 +644,16 @@ int ObInnerTableSchema::key_column_usage_schema(ObTableSchema& table_schema)
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
table_schema.get_part_option().set_max_used_part_id(table_schema.get_part_option().get_part_num() - 1);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(
|
||||
OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::dba_outlines_schema(ObTableSchema& table_schema)
|
||||
int ObInnerTableSchema::dba_outlines_schema(ObTableSchema &table_schema)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
uint64_t column_id = OB_APP_MIN_COLUMN_ID - 1;
|
||||
|
||||
// generated fields:
|
||||
//generated fields:
|
||||
table_schema.set_tenant_id(OB_SYS_TENANT_ID);
|
||||
table_schema.set_tablegroup_id(OB_INVALID_ID);
|
||||
table_schema.set_database_id(combine_id(OB_SYS_TENANT_ID, OB_INFORMATION_SCHEMA_ID));
|
||||
@ -706,8 +684,7 @@ int ObInnerTableSchema::dba_outlines_schema(ObTableSchema& table_schema)
|
||||
table_schema.set_create_mem_version(1);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(
|
||||
R"__(select /*+ READ_CONSISTENCY(WEAK)*/ a.name as NAME, a.owner as OWNER, b.database_name as DB_NAME, NULL as CATEGORY, a.used as USED, a.gmt_create as TIMESTAMP, a.version as VERSION, a.sql_text as SQL_TEXT, a.signature as SIGNATURE, a.compatible as COMPATIBLE, a.enabled as ENABLED, a.format as FORMAT, a.outline_content as OUTLINE_CONTENT, a.outline_target as OUTLINE_TARGET, a.owner_id as OWNER_ID from oceanbase.__all_virtual_outline a inner join oceanbase.__all_virtual_database b on a.database_id = b.database_id where a.tenant_id = effective_tenant_id() and b.tenant_id = effective_tenant_id() and b.in_recyclebin = 0 )__"))) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(R"__(select /*+ READ_CONSISTENCY(WEAK)*/ a.name as NAME, a.owner as OWNER, b.database_name as DB_NAME, NULL as CATEGORY, a.used as USED, a.gmt_create as TIMESTAMP, a.version as VERSION, a.sql_text as SQL_TEXT, a.signature as SIGNATURE, a.compatible as COMPATIBLE, a.enabled as ENABLED, a.format as FORMAT, a.outline_content as OUTLINE_CONTENT, a.outline_target as OUTLINE_TARGET, a.owner_id as OWNER_ID from oceanbase.__all_virtual_outline a inner join oceanbase.__all_virtual_database b on a.database_id = b.database_id where a.tenant_id = effective_tenant_id() and b.tenant_id = effective_tenant_id() and b.in_recyclebin = 0 )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
@ -719,17 +696,16 @@ int ObInnerTableSchema::dba_outlines_schema(ObTableSchema& table_schema)
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
table_schema.get_part_option().set_max_used_part_id(table_schema.get_part_option().get_part_num() - 1);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(
|
||||
OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::engines_schema(ObTableSchema& table_schema)
|
||||
int ObInnerTableSchema::engines_schema(ObTableSchema &table_schema)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
uint64_t column_id = OB_APP_MIN_COLUMN_ID - 1;
|
||||
|
||||
// generated fields:
|
||||
//generated fields:
|
||||
table_schema.set_tenant_id(OB_SYS_TENANT_ID);
|
||||
table_schema.set_tablegroup_id(OB_INVALID_ID);
|
||||
table_schema.set_database_id(combine_id(OB_SYS_TENANT_ID, OB_INFORMATION_SCHEMA_ID));
|
||||
@ -772,17 +748,16 @@ int ObInnerTableSchema::engines_schema(ObTableSchema& table_schema)
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
table_schema.get_part_option().set_max_used_part_id(table_schema.get_part_option().get_part_num() - 1);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(
|
||||
OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObInnerTableSchema::routines_schema(ObTableSchema& table_schema)
|
||||
int ObInnerTableSchema::routines_schema(ObTableSchema &table_schema)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
uint64_t column_id = OB_APP_MIN_COLUMN_ID - 1;
|
||||
|
||||
// generated fields:
|
||||
//generated fields:
|
||||
table_schema.set_tenant_id(OB_SYS_TENANT_ID);
|
||||
table_schema.set_tablegroup_id(OB_INVALID_ID);
|
||||
table_schema.set_database_id(combine_id(OB_SYS_TENANT_ID, OB_INFORMATION_SCHEMA_ID));
|
||||
@ -813,8 +788,7 @@ int ObInnerTableSchema::routines_schema(ObTableSchema& table_schema)
|
||||
table_schema.set_create_mem_version(1);
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(
|
||||
R"__( select SPECIFIC_NAME, 'def' as ROUTINE_CATALOG, db as ROUTINE_SCHEMA, name as ROUTINE_NAME, type as ROUTINE_TYPE, '' as DATA_TYPE, NULL as CHARACTER_MAXIMUM_LENGTH, NULL as CHARACTER_OCTET_LENGTH, NULL as NUMERIC_PRECISION, NULL as NUMERIC_SCALE, NULL as DATETIME_PRECISION, NULL as CHARACTER_SET_NAME, NULL as COLLATION_NAME, NULL as DTD_IDENTIFIER, 'SQL' as ROUTINE_BODY, body as ROUTINE_DEFINITION, NULL as EXTERNAL_NAME, NULL as EXTERNAL_LANGUAGE, 'SQL' as PARAMETER_STYLE, IS_DETERMINISTIC, SQL_DATA_ACCESS, NULL as SQL_PATH, SECURITY_TYPE, CREATED, modified as LAST_ALTERED, SQL_MODE, comment as ROUTINE_COMMENT, DEFINER, CHARACTER_SET_CLIENT, COLLATION_CONNECTION, collation_database as DATABASE_COLLATION from mysql.proc; )__"))) {
|
||||
if (OB_FAIL(table_schema.set_view_definition(R"__( select SPECIFIC_NAME, 'def' as ROUTINE_CATALOG, db as ROUTINE_SCHEMA, name as ROUTINE_NAME, type as ROUTINE_TYPE, '' as DATA_TYPE, NULL as CHARACTER_MAXIMUM_LENGTH, NULL as CHARACTER_OCTET_LENGTH, NULL as NUMERIC_PRECISION, NULL as NUMERIC_SCALE, NULL as DATETIME_PRECISION, NULL as CHARACTER_SET_NAME, NULL as COLLATION_NAME, NULL as DTD_IDENTIFIER, 'SQL' as ROUTINE_BODY, body as ROUTINE_DEFINITION, NULL as EXTERNAL_NAME, NULL as EXTERNAL_LANGUAGE, 'SQL' as PARAMETER_STYLE, IS_DETERMINISTIC, SQL_DATA_ACCESS, NULL as SQL_PATH, SECURITY_TYPE, CREATED, modified as LAST_ALTERED, SQL_MODE, comment as ROUTINE_COMMENT, DEFINER, CHARACTER_SET_CLIENT, COLLATION_CONNECTION, collation_database as DATABASE_COLLATION from mysql.proc; )__"))) {
|
||||
LOG_ERROR("fail to set view_definition", K(ret));
|
||||
}
|
||||
}
|
||||
@ -826,10 +800,10 @@ int ObInnerTableSchema::routines_schema(ObTableSchema& table_schema)
|
||||
|
||||
table_schema.set_max_used_column_id(column_id);
|
||||
table_schema.get_part_option().set_max_used_part_id(table_schema.get_part_option().get_part_num() - 1);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(
|
||||
OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
table_schema.get_part_option().set_partition_cnt_within_partition_table(OB_ALL_CORE_TABLE_TID == common::extract_pure_id(table_schema.get_table_id()) ? 1 : 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // end namespace share
|
||||
} // end namespace oceanbase
|
||||
|
||||
} // end namespace share
|
||||
} // end namespace oceanbase
|
||||
|
||||
Reference in New Issue
Block a user