增加SM3注释 #15

Open
GuanZH wants to merge 2 commits from GuanZH/openGauss-server:master into master
1 changed files with 10 additions and 3 deletions
Showing only changes of commit 087864415d - Show all commits

View File

@ -132,6 +132,9 @@ typedef struct {
DropBehavior behavior;
} InternalDefaultACL;
/*
* Privileges information corresponding to different object types.
*/
const struct AclObjectType {
GrantObjectType objtype;
AclMode all_privileges;
@ -574,6 +577,7 @@ void ExecuteGrantStmt(GrantStmt* stmt)
* bitmask. Note: objtype can't be ACL_OBJECT_COLUMN.
*/
for (size_t idx = 0; idx < sizeof(acl_object_type) / sizeof(acl_object_type[0]); idx++) {
/* Set corresponding privileges according to object type. */
if (acl_object_type[idx].objtype == stmt->objtype) {
all_privileges = acl_object_type[idx].all_privileges;
all_ddl_privileges = acl_object_type[idx].all_ddl_privileges;
@ -672,7 +676,7 @@ void ExecuteGrantStmt(GrantStmt* stmt)
}
}
}
/* Call privileges management function. */
ExecGrantStmt_oids(&istmt);
}
@ -2102,9 +2106,10 @@ static void ExecGrant_Relation(InternalGrant* istmt)
Relation relation = NULL;
Relation attRelation = NULL;
ListCell* cell = NULL;
/* Open system table pg_class and pg_attribute. */
relation = heap_open(RelationRelationId, RowExclusiveLock);
attRelation = heap_open(AttributeRelationId, RowExclusiveLock);
/* Loop through each Relation object. */
foreach (cell, istmt->objects) {
Oid relOid = lfirst_oid(cell);
Datum aclDatum;
@ -2125,10 +2130,12 @@ static void ExecGrant_Relation(InternalGrant* istmt)
ListCell* cell_colprivs = NULL;
tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relOid));
/* Check whether the table object to be operated exists. */
if (!HeapTupleIsValid(tuple))
ereport(ERROR, (errmodule(MOD_SEC), errcode(ERRCODE_CACHE_LOOKUP_FAILED),
errmsg("cache lookup failed for relation %u", relOid), errdetail("N/A"),
errcause("System error."), erraction("Contact engineer to support.")));
/* Get the pointer of the table to be operated. */
pg_class_tuple = (Form_pg_class)GETSTRUCT(tuple);
ExecGrantRelationTypeCheck(pg_class_tuple, istmt, &privileges, &ddl_privileges);
@ -2381,7 +2388,7 @@ static void ExecGrant_Relation(InternalGrant* istmt)
/* prevent error when processing duplicate objects */
CommandCounterIncrement();
}
/* Close system table pg_class and pg_attribute. */
heap_close(attRelation, RowExclusiveLock);
heap_close(relation, RowExclusiveLock);
}