From 560dbb58c271c214a39e286c58771a50a404bfdc Mon Sep 17 00:00:00 2001 From: akaError Date: Thu, 30 Jun 2022 16:18:38 +0800 Subject: [PATCH] fix bux:oceanbase.__tenant_virtual_table_column definition result in ISNULL fail when rewrite stmt(#977) --- src/observer/virtual_table/ob_table_columns.cpp | 5 ++--- src/share/inner_table/ob_inner_table_schema.10001_10050.cpp | 4 ++-- src/share/inner_table/ob_inner_table_schema.15051_15100.cpp | 4 ++-- src/share/inner_table/ob_inner_table_schema_def.py | 4 ++-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/observer/virtual_table/ob_table_columns.cpp b/src/observer/virtual_table/ob_table_columns.cpp index e0a79bebbb..e92d868b07 100644 --- a/src/observer/virtual_table/ob_table_columns.cpp +++ b/src/observer/virtual_table/ob_table_columns.cpp @@ -265,7 +265,7 @@ int ObTableColumns::fill_row_cells(const ObTableSchema& table_schema, const ObCo CS_TYPE_BINARY != column_schema.get_collation_type()) { cur_row_.cells_[cell_idx].set_varchar(ObCharset::collation_name(column_schema.get_collation_type())); } else { - cur_row_.cells_[cell_idx].set_varchar(ObString("NULL")); + cur_row_.cells_[cell_idx].set_null(); } cur_row_.cells_[cell_idx].set_collation_type( ObCharset::get_default_collation(ObCharset::get_default_charset())); @@ -329,8 +329,7 @@ int ObTableColumns::fill_row_cells(const ObTableSchema& table_schema, const ObCo cur_row_.cells_[cell_idx].set_varchar(ObString(static_cast(pos), buf)); } } else if (def_obj.is_null()) { - // NOTICE: default value is NULL need print string "NULL" - cur_row_.cells_[cell_idx].set_varchar("NULL"); + cur_row_.cells_[cell_idx].set_null(); } else if (def_obj.is_bit()) { if (OB_FAIL(def_obj.print_varchar_literal(buf, buf_len, pos, TZ_INFO(session_)))) { LOG_WARN("fail to print varchar literal", K(ret), K(def_obj), K(buf_len), K(pos), K(buf)); diff --git a/src/share/inner_table/ob_inner_table_schema.10001_10050.cpp b/src/share/inner_table/ob_inner_table_schema.10001_10050.cpp index 1659bebfe8..374596c5bf 100644 --- a/src/share/inner_table/ob_inner_table_schema.10001_10050.cpp +++ b/src/share/inner_table/ob_inner_table_schema.10001_10050.cpp @@ -464,7 +464,7 @@ int ObInnerTableSchema::tenant_virtual_table_column_schema(ObTableSchema &table_ MAX_COLLATION_LENGTH, //column_length -1, //column_precision -1, //column_scale - false, //is_nullable + true, //is_nullable false); //is_autoincrement } @@ -509,7 +509,7 @@ int ObInnerTableSchema::tenant_virtual_table_column_schema(ObTableSchema &table_ COLUMN_DEFAULT_LENGTH, //column_length -1, //column_precision -1, //column_scale - false, //is_nullable + true, //is_nullable false); //is_autoincrement } diff --git a/src/share/inner_table/ob_inner_table_schema.15051_15100.cpp b/src/share/inner_table/ob_inner_table_schema.15051_15100.cpp index 73e2020f03..b730c2cf89 100644 --- a/src/share/inner_table/ob_inner_table_schema.15051_15100.cpp +++ b/src/share/inner_table/ob_inner_table_schema.15051_15100.cpp @@ -282,7 +282,7 @@ int ObInnerTableSchema::tenant_virtual_table_column_ora_schema(ObTableSchema &ta MAX_COLLATION_LENGTH, //column_length 2, //column_precision -1, //column_scale - false, //is_nullable + true, //is_nullable false); //is_autoincrement } @@ -327,7 +327,7 @@ int ObInnerTableSchema::tenant_virtual_table_column_ora_schema(ObTableSchema &ta COLUMN_DEFAULT_LENGTH, //column_length 2, //column_precision -1, //column_scale - false, //is_nullable + true, //is_nullable false); //is_autoincrement } diff --git a/src/share/inner_table/ob_inner_table_schema_def.py b/src/share/inner_table/ob_inner_table_schema_def.py index 4304f8de49..0839c492e4 100644 --- a/src/share/inner_table/ob_inner_table_schema_def.py +++ b/src/share/inner_table/ob_inner_table_schema_def.py @@ -4937,10 +4937,10 @@ def_table_schema( normal_columns = [ ('type', 'varchar:COLUMN_TYPE_LENGTH'), - ('collation', 'varchar:MAX_COLLATION_LENGTH'), + ('collation', 'varchar:MAX_COLLATION_LENGTH', 'true'), ('null', 'varchar:COLUMN_NULLABLE_LENGTH'), ('key', 'varchar:COLUMN_KEY_LENGTH'), - ('default', 'varchar:COLUMN_DEFAULT_LENGTH'), + ('default', 'varchar:COLUMN_DEFAULT_LENGTH', 'true'), ('extra', 'varchar:COLUMN_EXTRA_LENGTH'), ('privileges', 'varchar:MAX_COLUMN_PRIVILEGE_LENGTH'), ('comment', 'varchar:MAX_COLUMN_COMMENT_LENGTH'), -- GitLab