提交 c098de99 编写于 作者: S st0 提交者: LINGuanRen

fix desc not print scale of on update current_timestamp bug

上级 2b64e56a
......@@ -590,7 +590,22 @@ int ObInfoSchemaColumnsTable::fill_row_cells(const ObString& database_name, cons
if (column_schema->is_autoincrement()) {
extra = ObString::make_string("auto_increment");
} else if (column_schema->is_on_update_current_timestamp()) {
extra = ObString::make_string("on update current_timestamp");
int16_t scale = column_schema->get_data_scale();
if (0 == scale) {
extra = ObString::make_string("on update current_timestamp");
} else {
char* buf = NULL;
int64_t buf_len = 32;
int64_t pos = 0;
if (OB_UNLIKELY(NULL == (buf = static_cast<char*>(allocator_->alloc(buf_len))))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
SERVER_LOG(WARN, "fail to allocate memory", K(ret));
} else if (OB_FAIL(databuff_printf(buf, buf_len, pos, "on update current_timestamp(%d)", scale))) {
SHARE_SCHEMA_LOG(WARN, "fail to print on update current_tiemstamp", K(ret));
} else {
extra = ObString(static_cast<int32_t>(pos), buf);
}
}
}
cells[cell_idx].set_varchar(extra);
cells[cell_idx].set_collation_type(ObCharset::get_default_collation(ObCharset::get_default_charset()));
......
......@@ -373,7 +373,22 @@ int ObTableColumns::fill_row_cells(const ObTableSchema& table_schema, const ObCo
if (column_schema.is_autoincrement()) {
extra_val = ObString::make_string("auto_increment");
} else if (column_schema.is_on_update_current_timestamp()) {
extra_val = ObString::make_string(N_UPDATE_CURRENT_TIMESTAMP);
int16_t scale = column_schema.get_data_scale();
if (0 == scale) {
extra_val = ObString::make_string(N_UPDATE_CURRENT_TIMESTAMP);
} else {
char* buf = NULL;
int64_t buf_len = 32;
int64_t pos = 0;
if (OB_UNLIKELY(NULL == (buf = static_cast<char*>(allocator_->alloc(buf_len))))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
SERVER_LOG(WARN, "fail to allocate memory", K(ret));
} else if (OB_FAIL(databuff_printf(buf, buf_len, pos, "%s(%d)", N_UPDATE_CURRENT_TIMESTAMP, scale))) {
SHARE_SCHEMA_LOG(WARN, "fail to print on update current_tiemstamp", K(ret));
} else {
extra_val = ObString(static_cast<int32_t>(pos), buf);
}
}
} else if (column_schema.is_virtual_generated_column()) {
extra_val = ObString::make_string("VIRTUAL GENERATED");
} else if (column_schema.is_stored_generated_column()) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册