Fix incorrect index column flags set by rename column
This commit is contained in:
@ -7555,6 +7555,7 @@ int ObDDLService::alter_table_update_aux_column(
|
|||||||
new_aux_column_schema.set_rowkey_position(origin_column_schema->get_rowkey_position());
|
new_aux_column_schema.set_rowkey_position(origin_column_schema->get_rowkey_position());
|
||||||
new_aux_column_schema.set_index_position(origin_column_schema->get_index_position());
|
new_aux_column_schema.set_index_position(origin_column_schema->get_index_position());
|
||||||
new_aux_column_schema.set_tbl_part_key_pos(origin_column_schema->get_tbl_part_key_pos());
|
new_aux_column_schema.set_tbl_part_key_pos(origin_column_schema->get_tbl_part_key_pos());
|
||||||
|
ObIndexBuilderUtil::del_column_flags_and_default_value(new_aux_column_schema);
|
||||||
}
|
}
|
||||||
if (!is_index) {
|
if (!is_index) {
|
||||||
// VP column of primary table need not update.
|
// VP column of primary table need not update.
|
||||||
|
|||||||
@ -32,6 +32,29 @@ using namespace share::schema;
|
|||||||
using namespace sql;
|
using namespace sql;
|
||||||
namespace share
|
namespace share
|
||||||
{
|
{
|
||||||
|
void ObIndexBuilderUtil::del_column_flags_and_default_value(ObColumnSchemaV2 &column)
|
||||||
|
{
|
||||||
|
if ((column.is_generated_column() && !column.is_fulltext_column() &&
|
||||||
|
!column.is_spatial_generated_column()) || column.is_identity_column()) {
|
||||||
|
if (column.is_virtual_generated_column()) {
|
||||||
|
column.del_column_flag(VIRTUAL_GENERATED_COLUMN_FLAG);
|
||||||
|
} else if (column.is_stored_generated_column()) {
|
||||||
|
column.del_column_flag(STORED_GENERATED_COLUMN_FLAG);
|
||||||
|
} else if (column.is_always_identity_column()) {
|
||||||
|
column.del_column_flag(ALWAYS_IDENTITY_COLUMN_FLAG);
|
||||||
|
} else if (column.is_default_identity_column()) {
|
||||||
|
column.del_column_flag(DEFAULT_IDENTITY_COLUMN_FLAG);
|
||||||
|
} else if (column.is_default_on_null_identity_column()) {
|
||||||
|
column.del_column_flag(DEFAULT_ON_NULL_IDENTITY_COLUMN_FLAG);
|
||||||
|
}
|
||||||
|
ObObj obj;
|
||||||
|
obj.set_null();
|
||||||
|
column.set_cur_default_value(obj);
|
||||||
|
column.set_orig_default_value(obj);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int ObIndexBuilderUtil::add_column(
|
int ObIndexBuilderUtil::add_column(
|
||||||
const ObColumnSchemaV2 *data_column,
|
const ObColumnSchemaV2 *data_column,
|
||||||
const bool is_index,
|
const bool is_index,
|
||||||
@ -83,24 +106,7 @@ int ObIndexBuilderUtil::add_column(
|
|||||||
// Fulltext column's default value is needed, because we need to set GENERATED_CTXCAT_CASCADE_FLAG
|
// Fulltext column's default value is needed, because we need to set GENERATED_CTXCAT_CASCADE_FLAG
|
||||||
// spatial column's default value is needed, because we need to set SPATIAL_INDEX_GENERATED_COLUMN_FLAG
|
// spatial column's default value is needed, because we need to set SPATIAL_INDEX_GENERATED_COLUMN_FLAG
|
||||||
// flag by parsing the default value.
|
// flag by parsing the default value.
|
||||||
if ((column.is_generated_column() && !column.is_fulltext_column() &&
|
del_column_flags_and_default_value(column);
|
||||||
!column.is_spatial_generated_column()) || column.is_identity_column()) {
|
|
||||||
if (column.is_virtual_generated_column()) {
|
|
||||||
column.del_column_flag(VIRTUAL_GENERATED_COLUMN_FLAG);
|
|
||||||
} else if (column.is_stored_generated_column()) {
|
|
||||||
column.del_column_flag(STORED_GENERATED_COLUMN_FLAG);
|
|
||||||
} else if (column.is_always_identity_column()) {
|
|
||||||
column.del_column_flag(ALWAYS_IDENTITY_COLUMN_FLAG);
|
|
||||||
} else if (column.is_default_identity_column()) {
|
|
||||||
column.del_column_flag(DEFAULT_IDENTITY_COLUMN_FLAG);
|
|
||||||
} else if (column.is_default_on_null_identity_column()) {
|
|
||||||
column.del_column_flag(DEFAULT_ON_NULL_IDENTITY_COLUMN_FLAG);
|
|
||||||
}
|
|
||||||
ObObj obj;
|
|
||||||
obj.set_null();
|
|
||||||
column.set_cur_default_value(obj);
|
|
||||||
column.set_orig_default_value(obj);
|
|
||||||
}
|
|
||||||
if (is_rowkey) {
|
if (is_rowkey) {
|
||||||
column.set_rowkey_position(row_desc.get_column_num());
|
column.set_rowkey_position(row_desc.get_column_num());
|
||||||
column.set_order_in_rowkey(order_type);
|
column.set_order_in_rowkey(order_type);
|
||||||
|
|||||||
@ -63,6 +63,7 @@ public:
|
|||||||
const share::schema::ObTableSchema &data_schema,
|
const share::schema::ObTableSchema &data_schema,
|
||||||
share::schema::ObTableSchema &index_schema,
|
share::schema::ObTableSchema &index_schema,
|
||||||
bool check_data_schema = true);
|
bool check_data_schema = true);
|
||||||
|
static void del_column_flags_and_default_value(share::schema::ObColumnSchemaV2 &column);
|
||||||
static int add_column(
|
static int add_column(
|
||||||
const share::schema::ObColumnSchemaV2 *data_column,
|
const share::schema::ObColumnSchemaV2 *data_column,
|
||||||
const bool is_index,
|
const bool is_index,
|
||||||
|
|||||||
Reference in New Issue
Block a user