MCPcopy Create free account
hub / github.com/apache/cloudberry / sepgsql_relation_truncate

Function sepgsql_relation_truncate

contrib/sepgsql/relation.c:523–556  ·  view source on GitHub ↗

* sepgsql_relation_truncate * * Check privileges to TRUNCATE the supplied relation. */

Source from the content-addressed store, hash-verified

521 * Check privileges to TRUNCATE the supplied relation.
522 */
523void
524sepgsql_relation_truncate(Oid relOid)
525{
526 ObjectAddress object;
527 char *audit_name;
528 uint16_t tclass = 0;
529 char relkind = get_rel_relkind(relOid);
530
531 switch (relkind)
532 {
533 case RELKIND_RELATION:
534 case RELKIND_PARTITIONED_TABLE:
535 tclass = SEPG_CLASS_DB_TABLE;
536 break;
537 default:
538 /* ignore other relkinds */
539 return;
540 }
541
542 /*
543 * check db_table:{truncate} permission
544 */
545 object.classId = RelationRelationId;
546 object.objectId = relOid;
547 object.objectSubId = 0;
548 audit_name = getObjectIdentity(&object, false);
549
550 sepgsql_avc_check_perms(&object,
551 tclass,
552 SEPG_DB_TABLE__TRUNCATE,
553 audit_name,
554 true);
555 pfree(audit_name);
556}
557
558/*
559 * sepgsql_relation_relabel

Callers 1

sepgsql_object_accessFunction · 0.85

Calls 4

get_rel_relkindFunction · 0.85
getObjectIdentityFunction · 0.85
sepgsql_avc_check_permsFunction · 0.85
pfreeFunction · 0.50

Tested by

no test coverage detected