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 756904bd42..a6f78ea04f 100644 --- a/src/share/inner_table/ob_inner_table_schema_def.py +++ b/src/share/inner_table/ob_inner_table_schema_def.py @@ -6378,6 +6378,8 @@ def_table_schema( # 502 : __all_trusted_root_certificate # 503 : __all_audit_log_filter # 504 : __all_audit_log_user +# 505 : __all_column_privilege +# 506 : __all_column_privilege_history # # 余留位置 ################################################################################ @@ -13195,7 +13197,8 @@ def_table_schema(**gen_iterate_private_virtual_table_def( # 12459: __all_virtual_index_usage_info # 12460: __all_virtual_audit_log_filter # 12461: __all_virtual_audit_log_user - +# 12462: __all_virtual_column_privilege +# 12463: __all_virtual_column_privilege_history # 余留位置 # @@ -30260,7 +30263,7 @@ def_table_schema( #21513 CDB_INDEX_USAGE #21514 mysql.audit_log_filter #21515 mysql.audit_log_user - +#21516 mysql.columns_priv # 余留位置 ################################################################################ @@ -55668,7 +55671,7 @@ def_sys_index_table( # 101097 : placeholder for index of __all_mview_refresh_stats # 101098 : placeholder for index of __all_transfer_partition_task # 101099 : placeholder for index of __all_client_to_server_session_info - +# 101100 : placeholder for index of __all_column_privilege ################################################################################ # Oracle Agent table Index def_agent_index_table( diff --git a/src/share/ob_errno.def b/src/share/ob_errno.def index 45c8609bf2..dc630a0d57 100755 --- a/src/share/ob_errno.def +++ b/src/share/ob_errno.def @@ -1042,6 +1042,9 @@ DEFINE_ORACLE_ERROR(OB_TABLE_DEFINITION_CHANGED, -5386, ER_TABLE_DEF_CHANGED, "H DEFINE_ERROR_EXT(OB_ERR_NO_ROUTINE_PRIVILEGE, -5387, ER_PROCACCESS_DENIED_ERROR, "42000", "Command denied to user for routine", "%.*s command denied to user '%.*s'@'%.*s' for routine '%.*s'"); DEFINE_ERROR_EXT(OB_ERR_USER_REFFERD_AS_DEFINER, -5388, ER_USER_REFERRED_AS_DEFINER, "HY000", "User '%.*s'@'%.*s' is referenced as a definer account in a stored routine.", "User '%.*s'@'%.*s' is referenced as a definer account in a stored routine."); DEFINE_ERROR_EXT(OB_ERR_OPERATION_ON_USER_REFERRED_AS_DEFINER, -5389, ER_OPERATION_ON_USER_REFERRED_AS_DEFINER, "HY000", "Operation %.*s failed for '%.*s'@'%.*s' as it is referenced as a definer account in a stored routine.", "Operation %.*s failed for '%.*s'@'%.*s' as it is referenced as a definer account in a stored routine."); + +// DEFINE_ERROR_EXT(OB_ERR_NO_COLUMN_PRIVILEGE, -5390, ER_COLUMNACCESS_DENIED_ERROR, "42000", "%.*s command denied to user '%.*s'@'%.*s' for column '%.*s' in table '%.*s'", "%.*s command denied to user '%.*s'@'%.*s' for column '%.*s' in table '%.*s'"); + DEFINE_ORACLE_ERROR_EXT(OB_ERR_OBJECT_STRING_DOES_NOT_EXIST, -5400, -1, "HY000", "object string does not exist", "object %.*s does not exist", 4043, "object string does not exist", "object %.*s does not exist"); DEFINE_ORACLE_ERROR(OB_ERR_RESULTANT_DATA_TYPE_OF_VIRTUAL_COLUMN_IS_NOT_SUPPORTED, -5401, -1, "HY000", "resultant data type of virtual column is not supported", 54004, "resultant data type of virtual column is not supported"); DEFINE_ERROR(OB_ERR_GET_STACKED_DIAGNOSTICS, -5402, ER_GET_STACKED_DIAGNOSTICS_INACTIVE, "0Z002", "GET STACKED DIAGNOSTICS when handler not active"); diff --git a/src/share/ob_rpc_struct.cpp b/src/share/ob_rpc_struct.cpp index 2455ee3627..5f9b8623cd 100755 --- a/src/share/ob_rpc_struct.cpp +++ b/src/share/ob_rpc_struct.cpp @@ -4346,6 +4346,8 @@ int ObGrantArg::assign(const ObGrantArg &other) SHARE_LOG(WARN, "fail to assign upd_col_ids_", K(ret)); } else if (OB_FAIL(ref_col_ids_.assign(other.ref_col_ids_))) { SHARE_LOG(WARN, "fail to assign ref_col_ids_", K(ret)); + } else if (OB_FAIL(sel_col_ids_.assign(other.sel_col_ids_))) { + SHARE_LOG(WARN, "fail to assign sel_col_ids_", K(ret)); } return ret; } @@ -4375,7 +4377,8 @@ OB_DEF_SERIALIZE(ObGrantArg) ref_col_ids_, grantor_id_, remain_roles_, - is_inner_ + is_inner_, + sel_col_ids_ ); return ret; } @@ -4405,7 +4408,8 @@ OB_DEF_DESERIALIZE(ObGrantArg) ref_col_ids_, grantor_id_, remain_roles_, - is_inner_); + is_inner_, + sel_col_ids_); //compatibility for old version if (OB_SUCC(ret) && users_passwd_.count() > 0 && hosts_.empty()) { @@ -4444,7 +4448,8 @@ OB_DEF_SERIALIZE_SIZE(ObGrantArg) ref_col_ids_, grantor_id_, remain_roles_, - is_inner_); + is_inner_, + sel_col_ids_); return len; } @@ -4473,6 +4478,36 @@ OB_SERIALIZE_MEMBER((ObRevokeDBArg, ObDDLArg), db_, priv_set_); +int ObRevokeTableArg::assign(const ObRevokeTableArg &other) +{ + int ret = OB_SUCCESS; + tenant_id_ = other.tenant_id_; + user_id_ = other.user_id_; + db_ = other.db_; + table_ = other.table_; + priv_set_ = other.priv_set_; + grant_ = other.grant_; + obj_id_ = other.obj_id_; + obj_type_ = other.obj_type_; + grantor_id_ = other.grantor_id_; + revoke_all_ora_ = other.revoke_all_ora_; + + if (OB_FAIL(ObDDLArg::assign(other))) { + LOG_WARN("fail to assign ddl arg", K(ret)); + } else if (OB_FAIL(obj_priv_array_.assign(other.obj_priv_array_))) { + LOG_WARN("fail to assign obj_priv_array_", K(ret)); + } else if (OB_FAIL(ins_col_ids_.assign(other.ins_col_ids_))) { + LOG_WARN("fail to assign ins_col_ids_", K(ret)); + } else if (OB_FAIL(upd_col_ids_.assign(other.upd_col_ids_))) { + LOG_WARN("fail to assign upd_col_ids_", K(ret)); + } else if (OB_FAIL(ref_col_ids_.assign(other.ref_col_ids_))) { + LOG_WARN("fail to assign ref_col_ids_", K(ret)); + } else if (OB_FAIL(sel_col_ids_.assign(other.sel_col_ids_))) { + LOG_WARN("fail to assign sel_col_ids_", K(ret)); + } + return ret; +} + bool ObRevokeTableArg::is_valid() const { return OB_INVALID_ID != tenant_id_ && OB_INVALID_ID != user_id_ @@ -4490,7 +4525,11 @@ OB_SERIALIZE_MEMBER((ObRevokeTableArg, ObDDLArg), obj_type_, grantor_id_, obj_priv_array_, - revoke_all_ora_); + revoke_all_ora_, + sel_col_ids_, + ins_col_ids_, + upd_col_ids_, + ref_col_ids_); bool ObRevokeSysPrivArg::is_valid() const { diff --git a/src/share/ob_rpc_struct.h b/src/share/ob_rpc_struct.h index 698d5aaf8b..221ca1cf87 100755 --- a/src/share/ob_rpc_struct.h +++ b/src/share/ob_rpc_struct.h @@ -4867,7 +4867,8 @@ public: object_type_(share::schema::ObObjectType::INVALID), object_id_(common::OB_INVALID_ID), ins_col_ids_(), upd_col_ids_(), ref_col_ids_(), - grantor_id_(common::OB_INVALID_ID), remain_roles_(), is_inner_(false) + grantor_id_(common::OB_INVALID_ID), remain_roles_(), is_inner_(false), + sel_col_ids_() { } virtual ~ObGrantArg() {} bool is_valid() const; @@ -4903,6 +4904,7 @@ public: // to support grant xxx to multiple user in oracle mode common::ObSArray remain_roles_; bool is_inner_; + common::ObSEArray sel_col_ids_; }; struct ObStandbyGrantArg : public ObDDLArg @@ -4975,9 +4977,12 @@ public: ObRevokeTableArg() : ObDDLArg(), tenant_id_(common::OB_INVALID_ID), user_id_(common::OB_INVALID_ID), priv_set_(0), grant_(true), obj_id_(common::OB_INVALID_ID), obj_type_(common::OB_INVALID_ID), grantor_id_(common::OB_INVALID_ID), - obj_priv_array_(), revoke_all_ora_(false) + obj_priv_array_(), revoke_all_ora_(false), sel_col_ids_(), ins_col_ids_(), + upd_col_ids_(), ref_col_ids_() { } bool is_valid() const; + + int assign(const ObRevokeTableArg& other); TO_STRING_KV(K_(tenant_id), K_(user_id), K_(db), @@ -5000,6 +5005,10 @@ public: uint64_t grantor_id_; share::ObRawObjPrivArray obj_priv_array_; bool revoke_all_ora_; + common::ObSEArray sel_col_ids_; + common::ObSEArray ins_col_ids_; + common::ObSEArray upd_col_ids_; + common::ObSEArray ref_col_ids_; }; struct ObRevokeSysPrivArg : public ObDDLArg diff --git a/src/share/schema/ob_schema_service.h b/src/share/schema/ob_schema_service.h index 94fbec733f..41f27eef93 100644 --- a/src/share/schema/ob_schema_service.h +++ b/src/share/schema/ob_schema_service.h @@ -336,6 +336,10 @@ enum ObSchemaOperationCategory ACT(OB_DDL_GRANT_REVOKE_ROUTINE_PRIV, = 2062) \ ACT(OB_DDL_DEL_ROUTINE_PRIV, = 2063) \ ACT(OB_DDL_ROUTINE_PRIV_OPERATION_END, = 2070) \ + ACT(OB_DDL_COLUMN_PRIV_OPERATION_BEGIN, = 2071) \ + ACT(OB_DDL_GRANT_COLUMN_PRIV, = 2072) \ + ACT(OB_DDL_DEL_COLUMN_PRIV, = 2073) \ + ACT(OB_DDL_COLUMN_PRIV_OPERATION_END, = 2080) \ ACT(OB_DDL_MAX_OP,) DECLARE_ENUM(ObSchemaOperationType, op_type, OP_TYPE_DEF); diff --git a/src/share/schema/ob_schema_struct.h b/src/share/schema/ob_schema_struct.h index affeb28254..266c1d6270 100755 --- a/src/share/schema/ob_schema_struct.h +++ b/src/share/schema/ob_schema_struct.h @@ -772,6 +772,7 @@ typedef enum { CONSTRAINT_SCHEMA = 39, // not dependent schema FOREIGN_KEY_SCHEMA = 40, // not dependent schema ROUTINE_PRIV = 41, + COLUMN_PRIV = 42, ///<<< add schema type before this line OB_MAX_SCHEMA } ObSchemaType;