diff --git a/src/yb/tablet/tablet_metadata.cc b/src/yb/tablet/tablet_metadata.cc index 23ec7ee3479e..605bee2803e8 100644 --- a/src/yb/tablet/tablet_metadata.cc +++ b/src/yb/tablet/tablet_metadata.cc @@ -663,6 +663,16 @@ void RaftGroupMetadata::SetSchema(const Schema& schema, index_map, deleted_cols, version); + if (target_table_id != primary_table_id_) { + if (schema.table_properties().is_ysql_catalog_table()) { + Uuid cotable_id; + CHECK_OK(cotable_id.FromHexString(target_table_id)); + new_table_info->schema.set_cotable_id(cotable_id); + } else { + auto result = CHECK_RESULT(GetPgsqlTableOid(target_table_id)); + new_table_info->schema.set_pgtable_id(result); + } + } VLOG_WITH_PREFIX(1) << raft_group_id_ << " Updating table " << target_table_id << " to Schema version " << version << " from \n" << yb::ToString(kv_store_.tables[target_table_id])