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

Function sepgsql_relation_setattr

contrib/sepgsql/relation.c:614–709  ·  view source on GitHub ↗

* sepgsql_relation_setattr * * It checks privileges to set attribute of the supplied relation */

Source from the content-addressed store, hash-verified

612 * It checks privileges to set attribute of the supplied relation
613 */
614void
615sepgsql_relation_setattr(Oid relOid)
616{
617 Relation rel;
618 ScanKeyData skey;
619 SysScanDesc sscan;
620 HeapTuple oldtup;
621 HeapTuple newtup;
622 Form_pg_class oldform;
623 Form_pg_class newform;
624 ObjectAddress object;
625 char *audit_name;
626 uint16_t tclass;
627
628 switch (get_rel_relkind(relOid))
629 {
630 case RELKIND_RELATION:
631 case RELKIND_PARTITIONED_TABLE:
632 tclass = SEPG_CLASS_DB_TABLE;
633 break;
634 case RELKIND_SEQUENCE:
635 tclass = SEPG_CLASS_DB_SEQUENCE;
636 break;
637 case RELKIND_VIEW:
638 tclass = SEPG_CLASS_DB_VIEW;
639 break;
640 case RELKIND_INDEX:
641 /* deal with indexes specially */
642 sepgsql_index_modify(relOid);
643 return;
644 default:
645 /* other relkinds don't need additional work */
646 return;
647 }
648
649 /*
650 * Fetch newer catalog
651 */
652 rel = table_open(RelationRelationId, AccessShareLock);
653
654 ScanKeyInit(&skey,
655 Anum_pg_class_oid,
656 BTEqualStrategyNumber, F_OIDEQ,
657 ObjectIdGetDatum(relOid));
658
659 sscan = systable_beginscan(rel, ClassOidIndexId, true,
660 SnapshotSelf, 1, &skey);
661
662 newtup = systable_getnext(sscan);
663 if (!HeapTupleIsValid(newtup))
664 elog(ERROR, "could not find tuple for relation %u", relOid);
665 newform = (Form_pg_class) GETSTRUCT(newtup);
666
667 /*
668 * Fetch older catalog
669 */
670 oldtup = SearchSysCache1(RELOID, ObjectIdGetDatum(relOid));
671 if (!HeapTupleIsValid(oldtup))

Callers 2

sepgsql_object_accessFunction · 0.85

Calls 15

get_rel_relkindFunction · 0.85
sepgsql_index_modifyFunction · 0.85
table_openFunction · 0.85
ScanKeyInitFunction · 0.85
ObjectIdGetDatumFunction · 0.85
systable_beginscanFunction · 0.85
systable_getnextFunction · 0.85
SearchSysCache1Function · 0.85
sepgsql_schema_add_nameFunction · 0.85
sepgsql_schema_renameFunction · 0.85
getObjectIdentityFunction · 0.85

Tested by

no test coverage detected