Implement sql_mode NO_FIELD_OPTIONS,NO_KEY_OPTIONS,NO_TABLE_OPTIONS
This commit is contained in:
parent
c57bbe7949
commit
cedd8a0188
@ -58,9 +58,18 @@ ObSqlModeMap SQL_MODE_MAP[] = {{SMO_REAL_AS_FLOAT, STR_REAL_AS_FLOAT},
|
||||
{SMO_ERROR_ON_RESOLVE_CAST, STR_ERROR_ON_RESOLVE_CAST},
|
||||
{0, NULL}};
|
||||
|
||||
ObSQLMode SUPPORT_MODE = SMO_STRICT_ALL_TABLES | SMO_STRICT_TRANS_TABLES | SMO_PAD_CHAR_TO_FULL_LENGTH |
|
||||
SMO_ONLY_FULL_GROUP_BY | SMO_NO_AUTO_VALUE_ON_ZERO | SMO_PIPES_AS_CONCAT |
|
||||
SMO_HIGH_NOT_PRECEDENCE | SMO_ERROR_ON_RESOLVE_CAST | SMO_NO_UNSIGNED_SUBTRACTION;
|
||||
ObSQLMode SUPPORT_MODE = SMO_STRICT_ALL_TABLES
|
||||
| SMO_STRICT_TRANS_TABLES
|
||||
| SMO_PAD_CHAR_TO_FULL_LENGTH
|
||||
| SMO_ONLY_FULL_GROUP_BY
|
||||
| SMO_NO_AUTO_VALUE_ON_ZERO
|
||||
| SMO_PIPES_AS_CONCAT
|
||||
| SMO_HIGH_NOT_PRECEDENCE
|
||||
| SMO_ERROR_ON_RESOLVE_CAST
|
||||
| SMO_NO_UNSIGNED_SUBTRACTION
|
||||
| SMO_NO_KEY_OPTIONS
|
||||
| SMO_NO_TABLE_OPTIONS
|
||||
| SMO_NO_FIELD_OPTIONS;
|
||||
|
||||
bool is_sql_mode_supported(ObSQLMode mode)
|
||||
{
|
||||
|
@ -49,8 +49,19 @@ inline bool is_no_zero_date(ObSQLMode mode)
|
||||
inline bool is_no_unsigned_subtraction(ObSQLMode mode)
|
||||
{
|
||||
return (SMO_NO_UNSIGNED_SUBTRACTION & mode);
|
||||
}
|
||||
inline bool is_no_key_options(ObSQLMode mode)
|
||||
{
|
||||
return (SMO_NO_KEY_OPTIONS & mode);
|
||||
}
|
||||
inline bool is_no_field_options(ObSQLMode mode)
|
||||
{
|
||||
return (SMO_NO_FIELD_OPTIONS & mode);
|
||||
}
|
||||
inline bool is_no_table_options(ObSQLMode mode)
|
||||
{
|
||||
return (SMO_NO_TABLE_OPTIONS & mode);
|
||||
}
|
||||
|
||||
inline bool is_mysql_compatible(ObCompatibilityMode mode)
|
||||
{
|
||||
return OCEANBASE_MODE == mode || MYSQL_MODE == mode;
|
||||
|
@ -154,12 +154,13 @@ int ObShowCreateTable::fill_row_cells(uint64_t show_table_id, const ObTableSchem
|
||||
const ObLengthSemantics default_length_semantics = session_->get_local_nls_length_semantics();
|
||||
// get auto_increment from auto_increment service, not from table option
|
||||
if (OB_FAIL(schema_printer.print_table_definition(show_table_id,
|
||||
table_def_buf,
|
||||
OB_MAX_VARCHAR_LENGTH,
|
||||
pos,
|
||||
TZ_INFO(session_),
|
||||
default_length_semantics,
|
||||
false))) {
|
||||
table_def_buf,
|
||||
OB_MAX_VARCHAR_LENGTH,
|
||||
pos,
|
||||
TZ_INFO(session_),
|
||||
default_length_semantics,
|
||||
false,
|
||||
session_->get_sql_mode()))) {
|
||||
SERVER_LOG(WARN, "Generate table definition failed");
|
||||
}
|
||||
}
|
||||
|
@ -45,8 +45,14 @@ using namespace common;
|
||||
ObSchemaPrinter::ObSchemaPrinter(ObSchemaGetterGuard& schema_guard) : schema_guard_(schema_guard)
|
||||
{}
|
||||
|
||||
int ObSchemaPrinter::print_table_definition(uint64_t table_id, char* buf, const int64_t& buf_len, int64_t& pos,
|
||||
const ObTimeZoneInfo* tz_info, const common::ObLengthSemantics default_length_semantics, bool agent_mode) const
|
||||
int ObSchemaPrinter::print_table_definition(uint64_t table_id,
|
||||
char* buf,
|
||||
const int64_t& buf_len,
|
||||
int64_t& pos,
|
||||
const ObTimeZoneInfo *tz_info,
|
||||
const common::ObLengthSemantics default_length_semantics,
|
||||
bool agent_mode,
|
||||
ObSQLMode sql_mode) const
|
||||
{
|
||||
// TODO(: refactor this function):consider index_position in
|
||||
|
||||
@ -107,23 +113,22 @@ int ObSchemaPrinter::print_table_definition(uint64_t table_id, char* buf, const
|
||||
if (OB_FAIL(ret)) {
|
||||
// do nothing...
|
||||
} else {
|
||||
if (OB_FAIL(print_table_definition_columns(
|
||||
*table_schema, buf, buf_len, pos, tz_info, default_length_semantics, agent_mode))) {
|
||||
if (OB_FAIL(print_table_definition_columns(*table_schema, buf, buf_len, pos, tz_info, default_length_semantics, agent_mode, sql_mode))) {
|
||||
SHARE_SCHEMA_LOG(WARN, "fail to print columns", K(ret), K(*table_schema));
|
||||
} else if (OB_FAIL(print_table_definition_rowkeys(*table_schema, buf, buf_len, pos))) {
|
||||
SHARE_SCHEMA_LOG(WARN, "fail to print rowkeys", K(ret), K(*table_schema));
|
||||
} else if (!agent_mode && OB_FAIL(print_table_definition_foreign_keys(*table_schema, buf, buf_len, pos))) {
|
||||
SHARE_SCHEMA_LOG(WARN, "fail to print foreign keys", K(ret), K(*table_schema));
|
||||
} else if (!agent_mode && OB_FAIL(print_table_definition_indexes(*table_schema, buf, buf_len, pos, true))) {
|
||||
} else if (!agent_mode && OB_FAIL(print_table_definition_indexes(*table_schema, buf, buf_len, pos, true, sql_mode))) {
|
||||
SHARE_SCHEMA_LOG(WARN, "fail to print indexes", K(ret), K(*table_schema));
|
||||
} else if (!agent_mode && !share::is_oracle_mode() &&
|
||||
OB_FAIL(print_table_definition_indexes(*table_schema, buf, buf_len, pos, false))) {
|
||||
} else if (!agent_mode && !share::is_oracle_mode()
|
||||
&& OB_FAIL(print_table_definition_indexes(*table_schema, buf, buf_len, pos, false, sql_mode))) {
|
||||
SHARE_SCHEMA_LOG(WARN, "fail to print indexes", K(ret), K(*table_schema));
|
||||
} else if (OB_FAIL(print_table_definition_constraints(*table_schema, buf, buf_len, pos))) {
|
||||
SHARE_SCHEMA_LOG(WARN, "fail to print constraints", K(ret), K(*table_schema));
|
||||
} else if (OB_FAIL(databuff_printf(buf, buf_len, pos, "\n) "))) {
|
||||
SHARE_SCHEMA_LOG(WARN, "fail to print )", K(ret));
|
||||
} else if (OB_FAIL(print_table_definition_table_options(*table_schema, buf, buf_len, pos, false, agent_mode))) {
|
||||
} else if (OB_FAIL(print_table_definition_table_options(*table_schema, buf, buf_len, pos, false, agent_mode, sql_mode))) {
|
||||
SHARE_SCHEMA_LOG(WARN, "fail to print table options", K(ret), K(*table_schema));
|
||||
} else if (OB_FAIL(
|
||||
print_table_definition_partition_options(*table_schema, buf, buf_len, pos, agent_mode, tz_info))) {
|
||||
@ -136,9 +141,14 @@ int ObSchemaPrinter::print_table_definition(uint64_t table_id, char* buf, const
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObSchemaPrinter::print_table_definition_columns(const ObTableSchema& table_schema, char* buf,
|
||||
const int64_t& buf_len, int64_t& pos, const ObTimeZoneInfo* tz_info,
|
||||
const common::ObLengthSemantics default_length_semantics, bool is_agent_mode) const
|
||||
int ObSchemaPrinter::print_table_definition_columns(const ObTableSchema &table_schema,
|
||||
char* buf,
|
||||
const int64_t& buf_len,
|
||||
int64_t& pos,
|
||||
const ObTimeZoneInfo *tz_info,
|
||||
const common::ObLengthSemantics default_length_semantics,
|
||||
bool is_agent_mode,
|
||||
ObSQLMode sql_mode) const
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
bool is_first_col = true;
|
||||
@ -287,7 +297,7 @@ int ObSchemaPrinter::print_table_definition_columns(const ObTableSchema& table_s
|
||||
}
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret) && col->is_on_update_current_timestamp()) {
|
||||
if (OB_SUCC(ret) && col->is_on_update_current_timestamp() && !is_no_field_options(sql_mode)) {
|
||||
int16_t scale = col->get_data_scale();
|
||||
if (0 == scale) {
|
||||
if (OB_FAIL(databuff_printf(buf, buf_len, pos, " %s", N_UPDATE_CURRENT_TIMESTAMP))) {
|
||||
@ -299,7 +309,7 @@ int ObSchemaPrinter::print_table_definition_columns(const ObTableSchema& table_s
|
||||
}
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret) && col->is_autoincrement()) {
|
||||
if (OB_SUCC(ret) && col->is_autoincrement() && !is_no_field_options(sql_mode)) {
|
||||
if (OB_FAIL(databuff_printf(buf, buf_len, pos, " AUTO_INCREMENT"))) {
|
||||
SHARE_SCHEMA_LOG(WARN, "fail to print auto_increment", K(ret));
|
||||
}
|
||||
@ -395,8 +405,12 @@ int ObSchemaPrinter::print_generated_column_definition(
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObSchemaPrinter::print_table_definition_indexes(
|
||||
const ObTableSchema& table_schema, char* buf, const int64_t& buf_len, int64_t& pos, bool is_unique_index) const
|
||||
int ObSchemaPrinter::print_table_definition_indexes(const ObTableSchema &table_schema,
|
||||
char* buf,
|
||||
const int64_t& buf_len,
|
||||
int64_t& pos,
|
||||
bool is_unique_index,
|
||||
ObSQLMode sql_mode) const
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObStringBuf allocator;
|
||||
@ -509,7 +523,7 @@ int ObSchemaPrinter::print_table_definition_indexes(
|
||||
}
|
||||
|
||||
// show storing columns in index
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_SUCC(ret) && !is_no_key_options(sql_mode)) {
|
||||
int64_t column_count = index_schema->get_column_count();
|
||||
if (column_count > rowkey_count) {
|
||||
bool first_storing_column = true;
|
||||
@ -559,7 +573,8 @@ int ObSchemaPrinter::print_table_definition_indexes(
|
||||
// do nothing
|
||||
} else if (OB_FAIL(databuff_printf(buf, buf_len, pos, " "))) {
|
||||
SHARE_SCHEMA_LOG(WARN, "fail to print space", K(ret));
|
||||
} else if (OB_FAIL(print_table_definition_table_options(*index_schema, buf, buf_len, pos, false))) {
|
||||
} else if (OB_FAIL(print_table_definition_table_options(*index_schema, buf,
|
||||
buf_len, pos, false, false, sql_mode))) {
|
||||
SHARE_SCHEMA_LOG(WARN, "fail to print index options", K(ret), K(*index_schema));
|
||||
}
|
||||
}
|
||||
@ -1163,12 +1178,18 @@ int ObSchemaPrinter::print_table_definition_comment_oracle(
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObSchemaPrinter::print_table_definition_table_options(const ObTableSchema& table_schema, char* buf,
|
||||
const int64_t& buf_len, int64_t& pos, bool is_for_table_status, bool agent_mode) const
|
||||
int ObSchemaPrinter::print_table_definition_table_options(const ObTableSchema &table_schema,
|
||||
char* buf,
|
||||
const int64_t& buf_len,
|
||||
int64_t& pos,
|
||||
bool is_for_table_status,
|
||||
bool agent_mode,
|
||||
ObSQLMode sql_mode) const
|
||||
{
|
||||
const bool is_index_tbl = table_schema.is_index_table();
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_SUCCESS == ret && !is_index_tbl && !is_for_table_status) {
|
||||
if (OB_SUCCESS == ret && !is_index_tbl && !is_for_table_status
|
||||
&& !is_no_field_options(sql_mode) && !is_no_table_options(sql_mode)) {
|
||||
uint64_t auto_increment = 0;
|
||||
if (OB_FAIL(share::ObAutoincrementService::get_instance().get_sequence_value(table_schema.get_tenant_id(),
|
||||
table_schema.get_table_id(),
|
||||
@ -1182,8 +1203,8 @@ int ObSchemaPrinter::print_table_definition_table_options(const ObTableSchema& t
|
||||
}
|
||||
}
|
||||
|
||||
if (OB_SUCCESS == ret && !is_for_table_status && !is_index_tbl &&
|
||||
CHARSET_INVALID != table_schema.get_charset_type()) {
|
||||
if (OB_SUCCESS == ret && !is_for_table_status && !is_index_tbl
|
||||
&& !is_no_table_options(sql_mode) && CHARSET_INVALID != table_schema.get_charset_type()) {
|
||||
if (share::is_oracle_mode()) {
|
||||
// do not print charset info when in oracle mode
|
||||
} else if (OB_FAIL(databuff_printf(buf,
|
||||
@ -1194,32 +1215,34 @@ int ObSchemaPrinter::print_table_definition_table_options(const ObTableSchema& t
|
||||
SHARE_SCHEMA_LOG(WARN, "fail to print default charset", K(ret), K(table_schema));
|
||||
}
|
||||
}
|
||||
if (OB_SUCCESS == ret && !share::is_oracle_mode() && !agent_mode && !is_for_table_status && !is_index_tbl &&
|
||||
CS_TYPE_INVALID != table_schema.get_collation_type() &&
|
||||
!ObCharset::is_default_collation(table_schema.get_charset_type(), table_schema.get_collation_type())) {
|
||||
if (OB_FAIL(databuff_printf(
|
||||
buf, buf_len, pos, "COLLATE = %s ", ObCharset::collation_name(table_schema.get_collation_type())))) {
|
||||
if (OB_SUCCESS == ret && !share::is_oracle_mode() && !agent_mode && !is_for_table_status
|
||||
&& !is_index_tbl && !is_no_table_options(sql_mode) && CS_TYPE_INVALID != table_schema.get_collation_type()
|
||||
&& !ObCharset::is_default_collation(table_schema.get_charset_type(), table_schema.get_collation_type())) {
|
||||
if (OB_FAIL(databuff_printf(buf, buf_len, pos, "COLLATE = %s ",
|
||||
ObCharset::collation_name(table_schema.get_collation_type())))) {
|
||||
SHARE_SCHEMA_LOG(WARN, "fail to print collate", K(ret), K(table_schema));
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret) && table_schema.is_domain_index() && !table_schema.get_parser_name_str().empty()) {
|
||||
if (OB_SUCC(ret) && table_schema.is_domain_index()
|
||||
&& !is_no_key_options(sql_mode) && !table_schema.get_parser_name_str().empty()) {
|
||||
if (OB_FAIL(databuff_printf(buf, buf_len, pos, "WITH PARSER '%s' ", table_schema.get_parser_name()))) {
|
||||
SHARE_SCHEMA_LOG(WARN, "print parser name failed", K(ret));
|
||||
}
|
||||
}
|
||||
if (OB_SUCCESS == ret && !is_index_tbl) {
|
||||
if (OB_SUCCESS == ret && !is_index_tbl && !is_no_table_options(sql_mode)) {
|
||||
if (OB_FAIL(print_table_definition_store_format(table_schema, buf, buf_len, pos))) {
|
||||
SHARE_SCHEMA_LOG(WARN, "fail to print store format", K(ret), K(table_schema));
|
||||
}
|
||||
}
|
||||
if (OB_SUCCESS == ret && !is_index_tbl && table_schema.get_expire_info().length() > 0 &&
|
||||
NULL != table_schema.get_expire_info().ptr()) {
|
||||
if (OB_SUCCESS == ret && !is_index_tbl && !is_no_table_options(sql_mode)
|
||||
&& table_schema.get_expire_info().length() > 0
|
||||
&& NULL != table_schema.get_expire_info().ptr()) {
|
||||
const ObString expire_str = table_schema.get_expire_info();
|
||||
if (OB_FAIL(databuff_printf(buf, buf_len, pos, "EXPIRE_INFO = (%.*s) ", expire_str.length(), expire_str.ptr()))) {
|
||||
SHARE_SCHEMA_LOG(WARN, "fail to print expire info", K(ret), K(expire_str));
|
||||
}
|
||||
}
|
||||
if (OB_SUCCESS == ret && !is_index_tbl) {
|
||||
if (OB_SUCCESS == ret && !is_index_tbl && !is_no_table_options(sql_mode)) {
|
||||
int64_t paxos_replica_num = OB_INVALID_COUNT;
|
||||
if (OB_FAIL(table_schema.get_paxos_replica_num(schema_guard_, paxos_replica_num))) {
|
||||
LOG_WARN("fail to get paxos replica num", K(ret));
|
||||
@ -1230,19 +1253,18 @@ int ObSchemaPrinter::print_table_definition_table_options(const ObTableSchema& t
|
||||
SHARE_SCHEMA_LOG(WARN, "fail to print replica num", K(ret), K(table_schema));
|
||||
} else {
|
||||
SHARE_SCHEMA_LOG(INFO, "XXX", K(paxos_replica_num));
|
||||
} // no more to do
|
||||
} // no more to do
|
||||
}
|
||||
if (OB_SUCCESS == ret && table_schema.get_locality_str().length() > 0) { // locality
|
||||
if (OB_FAIL(databuff_printf(buf,
|
||||
buf_len,
|
||||
pos,
|
||||
"LOCALITY = \'%.*s\' ",
|
||||
table_schema.get_locality_str().length(),
|
||||
table_schema.get_locality_str().ptr()))) {
|
||||
if (OB_SUCCESS == ret && table_schema.get_locality_str().length() > 0
|
||||
&& !is_no_table_options(sql_mode)) { // locality
|
||||
if (OB_FAIL(databuff_printf(buf, buf_len, pos, "LOCALITY = \'%.*s\' ",
|
||||
table_schema.get_locality_str().length(),
|
||||
table_schema.get_locality_str().ptr()))) {
|
||||
SHARE_SCHEMA_LOG(WARN, "fail to print locality", K(ret), K(table_schema));
|
||||
}
|
||||
}
|
||||
if (OB_SUCCESS == ret && 0 < table_schema.get_primary_zone().length()) { // primary_zone
|
||||
if (OB_SUCCESS == ret && 0 < table_schema.get_primary_zone().length()
|
||||
&& !is_no_table_options(sql_mode)) { //primary_zone
|
||||
bool is_random = (0 == table_schema.get_primary_zone().compare(common::OB_RANDOM_PRIMARY_ZONE));
|
||||
if (OB_FAIL(databuff_printf(buf,
|
||||
buf_len,
|
||||
@ -1253,51 +1275,59 @@ int ObSchemaPrinter::print_table_definition_table_options(const ObTableSchema& t
|
||||
SHARE_SCHEMA_LOG(WARN, "fail to print primary_zone", K(ret), K(table_schema.get_primary_zone()));
|
||||
}
|
||||
}
|
||||
if (OB_SUCCESS == ret && table_schema.get_block_size() >= 0) {
|
||||
if (OB_FAIL(databuff_printf(buf,
|
||||
buf_len,
|
||||
pos,
|
||||
is_index_tbl ? "BLOCK_SIZE %ld " : "BLOCK_SIZE = %ld ",
|
||||
table_schema.get_block_size()))) {
|
||||
if (OB_SUCCESS == ret && table_schema.get_block_size() >= 0
|
||||
&& !is_no_key_options(sql_mode) && !is_no_table_options(sql_mode)) {
|
||||
if (OB_FAIL(databuff_printf(buf, buf_len, pos,
|
||||
is_index_tbl ? "BLOCK_SIZE %ld " : "BLOCK_SIZE = %ld ",
|
||||
table_schema.get_block_size()))) {
|
||||
SHARE_SCHEMA_LOG(WARN, "fail to print block size", K(ret), K(table_schema));
|
||||
}
|
||||
}
|
||||
if (OB_SUCCESS == ret && is_index_tbl && !table_schema.is_domain_index()) {
|
||||
const char* local_flag =
|
||||
table_schema.is_global_index_table() || table_schema.is_global_local_index_table() ? "GLOBAL " : "LOCAL ";
|
||||
if (OB_SUCCESS == ret && is_index_tbl && !table_schema.is_domain_index()
|
||||
&& !is_no_key_options(sql_mode)) {
|
||||
const char* local_flag = table_schema.is_global_index_table()
|
||||
|| table_schema.is_global_local_index_table()
|
||||
? "GLOBAL " : "LOCAL ";
|
||||
if (OB_FAIL(databuff_printf(buf, buf_len, pos, "%s", local_flag))) {
|
||||
SHARE_SCHEMA_LOG(WARN, "fail to print global/local", K(ret), K(table_schema));
|
||||
}
|
||||
}
|
||||
if (OB_SUCCESS == ret && !is_index_tbl) {
|
||||
if (OB_FAIL(databuff_printf(
|
||||
buf, buf_len, pos, "USE_BLOOM_FILTER = %s ", table_schema.is_use_bloomfilter() ? "TRUE" : "FALSE"))) {
|
||||
if (OB_SUCCESS == ret && !is_index_tbl && !is_no_table_options(sql_mode)) {
|
||||
if (OB_FAIL(databuff_printf(buf, buf_len, pos, "USE_BLOOM_FILTER = %s ",
|
||||
table_schema.is_use_bloomfilter() ? "TRUE" : "FALSE"))) {
|
||||
SHARE_SCHEMA_LOG(WARN, "fail to print use bloom filter", K(ret), K(table_schema));
|
||||
}
|
||||
}
|
||||
|
||||
if (OB_SUCCESS == ret && !is_index_tbl && table_schema.is_enable_row_movement()) {
|
||||
if (OB_SUCCESS == ret && !is_index_tbl && table_schema.is_enable_row_movement()
|
||||
&& !is_no_table_options(sql_mode)) {
|
||||
if (OB_FAIL(databuff_printf(buf, buf_len, pos, "ENABLE ROW MOVEMENT "))) {
|
||||
SHARE_SCHEMA_LOG(WARN, "fail to print row movement option", K(ret), K(table_schema));
|
||||
}
|
||||
}
|
||||
if (OB_SUCCESS == ret && !is_index_tbl) {
|
||||
if (OB_FAIL(databuff_printf(buf, buf_len, pos, "TABLET_SIZE = %ld ", table_schema.get_tablet_size()))) {
|
||||
if (OB_SUCCESS == ret && !is_index_tbl && !is_no_table_options(sql_mode)) {
|
||||
if (OB_FAIL(databuff_printf(buf, buf_len, pos, "TABLET_SIZE = %ld ",
|
||||
table_schema.get_tablet_size()))) {
|
||||
SHARE_SCHEMA_LOG(WARN, "fail to print tablet_size", K(ret), K(table_schema));
|
||||
}
|
||||
}
|
||||
if (OB_SUCCESS == ret && !is_index_tbl) {
|
||||
if (OB_FAIL(databuff_printf(buf, buf_len, pos, "PCTFREE = %ld ", table_schema.get_pctfree()))) {
|
||||
if (OB_SUCCESS == ret && !is_index_tbl && !is_no_table_options(sql_mode)) {
|
||||
if (OB_FAIL(databuff_printf(buf, buf_len, pos, "PCTFREE = %ld ",
|
||||
table_schema.get_pctfree()))) {
|
||||
SHARE_SCHEMA_LOG(WARN, "fail to print pctfree", K(ret), K(table_schema));
|
||||
}
|
||||
}
|
||||
if (OB_SUCCESS == ret && !is_index_tbl && table_schema.get_dop() > 1) {
|
||||
if (OB_FAIL(databuff_printf(buf, buf_len, pos, "PARALLEL %ld ", table_schema.get_dop()))) {
|
||||
if (OB_SUCCESS == ret && !is_index_tbl && table_schema.get_dop() > 1
|
||||
&& !is_no_table_options(sql_mode)) {
|
||||
if (OB_FAIL(databuff_printf(buf, buf_len, pos, "PARALLEL %ld ",
|
||||
table_schema.get_dop()))) {
|
||||
SHARE_SCHEMA_LOG(WARN, "fail to print dop", K(ret), K(table_schema));
|
||||
}
|
||||
}
|
||||
if (OB_SUCCESS == ret && !is_index_tbl && common::OB_INVALID_ID != table_schema.get_tablegroup_id()) {
|
||||
const ObTablegroupSchema* tablegroup_schema = schema_guard_.get_tablegroup_schema(table_schema.get_tablegroup_id());
|
||||
if (OB_SUCCESS == ret && !is_index_tbl && common::OB_INVALID_ID != table_schema.get_tablegroup_id()
|
||||
&& !is_no_table_options(sql_mode)) {
|
||||
const ObTablegroupSchema *tablegroup_schema = schema_guard_.get_tablegroup_schema(
|
||||
table_schema.get_tablegroup_id());
|
||||
if (NULL != tablegroup_schema) {
|
||||
const ObString tablegroup_name = tablegroup_schema->get_tablegroup_name();
|
||||
if (tablegroup_name.length() > 0 && NULL != tablegroup_name.ptr()) {
|
||||
@ -1315,9 +1345,10 @@ int ObSchemaPrinter::print_table_definition_table_options(const ObTableSchema& t
|
||||
}
|
||||
}
|
||||
|
||||
if (OB_SUCCESS == ret && !is_index_tbl && table_schema.get_progressive_merge_num() > 0) {
|
||||
if (OB_FAIL(databuff_printf(
|
||||
buf, buf_len, pos, "PROGRESSIVE_MERGE_NUM = %ld ", table_schema.get_progressive_merge_num()))) {
|
||||
if (OB_SUCCESS == ret && !is_index_tbl && table_schema.get_progressive_merge_num() > 0
|
||||
&& !is_no_table_options(sql_mode)) {
|
||||
if (OB_FAIL(databuff_printf(buf, buf_len, pos, "PROGRESSIVE_MERGE_NUM = %ld ",
|
||||
table_schema.get_progressive_merge_num()))) {
|
||||
SHARE_SCHEMA_LOG(WARN, "fail to print progressive merge num", K(ret), K(table_schema));
|
||||
}
|
||||
}
|
||||
@ -1343,19 +1374,20 @@ int ObSchemaPrinter::print_table_definition_table_options(const ObTableSchema& t
|
||||
}
|
||||
}
|
||||
}
|
||||
if (OB_SUCCESS == ret && !is_index_tbl && table_schema.is_read_only()) {
|
||||
if (OB_SUCCESS == ret && !is_index_tbl && table_schema.is_read_only()
|
||||
&& !is_no_table_options(sql_mode)) {
|
||||
if (OB_FAIL(databuff_printf(buf, buf_len, pos, "READ ONLY "))) {
|
||||
SHARE_SCHEMA_LOG(WARN, "fail to print table read only", K(ret));
|
||||
}
|
||||
}
|
||||
ObString table_mode_str = "";
|
||||
if (OB_SUCC(ret) && !is_index_tbl) {
|
||||
if (OB_SUCC(ret) && !is_index_tbl && !is_no_table_options(sql_mode)) {
|
||||
if (!agent_mode) {
|
||||
} else { // true == agent_mode
|
||||
table_mode_str = ObBackUpTableModeOp::get_table_mode_str(table_schema.get_table_mode_struct());
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret) && table_mode_str.length() > 0) {
|
||||
if (OB_SUCC(ret) && table_mode_str.length() > 0 && !is_no_table_options(sql_mode)) {
|
||||
if (OB_FAIL(databuff_printf(buf, buf_len, pos, "TABLE_MODE = '%s' ", table_mode_str.ptr()))) {
|
||||
SHARE_SCHEMA_LOG(WARN, "fail to print table table_mode", K(ret));
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ private:
|
||||
public:
|
||||
int print_table_definition(uint64_t table_id, char* buf, const int64_t& buf_len, int64_t& pos,
|
||||
const common::ObTimeZoneInfo* tz_info, const common::ObLengthSemantics default_length_semantics,
|
||||
bool agent_mode) const;
|
||||
bool agent_mode, ObSQLMode sql_mode = SMO_DEFAULT) const;
|
||||
int print_table_index_stroing(const share::schema::ObTableSchema* index_schema,
|
||||
const share::schema::ObTableSchema* table_schema, char* buf, const int64_t buf_len, int64_t& pos) const;
|
||||
int print_table_definition_fulltext_indexs(const common::ObIArray<common::ObString>& fulltext_indexs,
|
||||
@ -78,11 +78,15 @@ public:
|
||||
|
||||
int print_table_definition_columns(const ObTableSchema& table_schema, char* buf, const int64_t& buf_len, int64_t& pos,
|
||||
const common::ObTimeZoneInfo* tz_info, const common::ObLengthSemantics default_length_semantics,
|
||||
bool is_agent_mode = false) const;
|
||||
bool is_agent_mode = false, ObSQLMode sql_mode = SMO_DEFAULT) const;
|
||||
int print_generated_column_definition(const ObColumnSchemaV2& gen_col, char* buf, int64_t buf_len,
|
||||
const ObTableSchema& table_schema, int64_t& pos) const;
|
||||
int print_table_definition_indexes(
|
||||
const ObTableSchema& table_schema, char* buf, const int64_t& buf_len, int64_t& pos, bool is_unique_index) const;
|
||||
int print_table_definition_indexes(const ObTableSchema &table_schema,
|
||||
char* buf,
|
||||
const int64_t& buf_len,
|
||||
int64_t& pos,
|
||||
bool is_unique_index,
|
||||
ObSQLMode sql_mode = SMO_DEFAULT) const;
|
||||
int print_table_definition_constraints(
|
||||
const ObTableSchema& table_schema, char* buf, const int64_t& buf_len, int64_t& pos) const;
|
||||
int print_index_column(const ObTableSchema& table_schema, const ObColumnSchemaV2& column,
|
||||
@ -106,7 +110,7 @@ public:
|
||||
int print_table_definition_store_format(
|
||||
const ObTableSchema& table_schema, char* buf, const int64_t& buf_len, int64_t& pos) const;
|
||||
int print_table_definition_table_options(const ObTableSchema& table_schema, char* buf, const int64_t& buf_len,
|
||||
int64_t& pos, bool is_for_table_status, bool agent_mode = false) const;
|
||||
int64_t& pos, bool is_for_table_status, bool agent_mode = false, ObSQLMode sql_mode = SMO_DEFAULT) const;
|
||||
int print_table_definition_comment_oracle(
|
||||
const ObTableSchema& table_schema, char* buf, const int64_t& buf_len, int64_t& pos) const;
|
||||
int print_table_definition_partition_options(const ObTableSchema& table_schema, char* buf, const int64_t& buf_len,
|
||||
|
Loading…
x
Reference in New Issue
Block a user