diff --git a/contrib/sepgsql/label.c b/contrib/sepgsql/label.c index 1a8f884..4dda82a 100644 *** a/contrib/sepgsql/label.c --- b/contrib/sepgsql/label.c *************** exec_object_restorecon(struct selabel_ha *** 779,785 **** case RelationRelationId: relForm = (Form_pg_class) GETSTRUCT(tuple); ! if (relForm->relkind == RELKIND_RELATION) objtype = SELABEL_DB_TABLE; else if (relForm->relkind == RELKIND_SEQUENCE) objtype = SELABEL_DB_SEQUENCE; --- 779,786 ---- case RelationRelationId: relForm = (Form_pg_class) GETSTRUCT(tuple); ! if (relForm->relkind == RELKIND_RELATION || ! relForm->relkind == RELKIND_PARTITIONED_TABLE) objtype = SELABEL_DB_TABLE; else if (relForm->relkind == RELKIND_SEQUENCE) objtype = SELABEL_DB_SEQUENCE; diff --git a/contrib/sepgsql/relation.c b/contrib/sepgsql/relation.c index ab98a9b..f8689c0 100644 *** a/contrib/sepgsql/relation.c --- b/contrib/sepgsql/relation.c *************** sepgsql_attribute_post_create(Oid relOid *** 54,65 **** ObjectAddress object; Form_pg_attribute attForm; StringInfoData audit_name; /* ! * Only attributes within regular relation have individual security ! * labels. */ ! if (get_rel_relkind(relOid) != RELKIND_RELATION) return; /* --- 54,66 ---- ObjectAddress object; Form_pg_attribute attForm; StringInfoData audit_name; + char relkind = get_rel_relkind(relOid); /* ! * Only attributes within regular relation or partition relations have ! * individual security labels. */ ! if (relkind != RELKIND_RELATION && relkind != RELKIND_PARTITIONED_TABLE) return; /* *************** sepgsql_attribute_drop(Oid relOid, AttrN *** 135,142 **** { ObjectAddress object; char *audit_name; ! if (get_rel_relkind(relOid) != RELKIND_RELATION) return; /* --- 136,144 ---- { ObjectAddress object; char *audit_name; + char relkind = get_rel_relkind(relOid); ! if (relkind != RELKIND_RELATION && relkind != RELKIND_PARTITIONED_TABLE) return; /* *************** sepgsql_attribute_relabel(Oid relOid, At *** 167,174 **** { ObjectAddress object; char *audit_name; ! if (get_rel_relkind(relOid) != RELKIND_RELATION) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("cannot set security label on non-regular columns"))); --- 169,177 ---- { ObjectAddress object; char *audit_name; + char relkind = get_rel_relkind(relOid); ! if (relkind != RELKIND_RELATION && relkind != RELKIND_PARTITIONED_TABLE) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("cannot set security label on non-regular columns"))); *************** sepgsql_attribute_setattr(Oid relOid, At *** 209,216 **** { ObjectAddress object; char *audit_name; ! if (get_rel_relkind(relOid) != RELKIND_RELATION) return; /* --- 212,220 ---- { ObjectAddress object; char *audit_name; + char relkind = get_rel_relkind(relOid); ! if (relkind != RELKIND_RELATION && relkind != RELKIND_PARTITIONED_TABLE) return; /* *************** sepgsql_relation_post_create(Oid relOid) *** 291,296 **** --- 295,301 ---- switch (classForm->relkind) { case RELKIND_RELATION: + case RELKIND_PARTITIONED_TABLE: tclass = SEPG_CLASS_DB_TABLE; break; case RELKIND_SEQUENCE: *************** sepgsql_relation_post_create(Oid relOid) *** 333,339 **** true); /* ! * Assign the default security label on the new relation */ object.classId = RelationRelationId; object.objectId = relOid; --- 338,345 ---- true); /* ! * Assign the default security label on the new relation or partitioned ! * table. */ object.classId = RelationRelationId; object.objectId = relOid; *************** sepgsql_relation_post_create(Oid relOid) *** 341,350 **** SetSecurityLabel(&object, SEPGSQL_LABEL_TAG, rcontext); /* ! * We also assigns a default security label on columns of the new regular ! * tables. */ ! if (classForm->relkind == RELKIND_RELATION) { Relation arel; ScanKeyData akey; --- 347,356 ---- SetSecurityLabel(&object, SEPGSQL_LABEL_TAG, rcontext); /* ! * We also assign a default security label on columns of a new table. */ ! if (classForm->relkind == RELKIND_RELATION || ! classForm->relkind == RELKIND_PARTITIONED_TABLE) { Relation arel; ScanKeyData akey; *************** sepgsql_relation_drop(Oid relOid) *** 414,425 **** ObjectAddress object; char *audit_name; uint16_t tclass = 0; ! char relkind; - relkind = get_rel_relkind(relOid); switch (relkind) { case RELKIND_RELATION: tclass = SEPG_CLASS_DB_TABLE; break; case RELKIND_SEQUENCE: --- 420,431 ---- ObjectAddress object; char *audit_name; uint16_t tclass; ! char relkind = get_rel_relkind(relOid); switch (relkind) { case RELKIND_RELATION: + case RELKIND_PARTITIONED_TABLE: tclass = SEPG_CLASS_DB_TABLE; break; case RELKIND_SEQUENCE: *************** sepgsql_relation_drop(Oid relOid) *** 479,485 **** /* * check db_column:{drop} permission */ ! if (relkind == RELKIND_RELATION) { Form_pg_attribute attForm; CatCList *attrList; --- 485,491 ---- /* * check db_column:{drop} permission */ ! if (relkind == RELKIND_RELATION || relkind == RELKIND_PARTITIONED_TABLE) { Form_pg_attribute attForm; CatCList *attrList; *************** sepgsql_relation_relabel(Oid relOid, con *** 521,531 **** { ObjectAddress object; char *audit_name; ! char relkind; uint16_t tclass = 0; ! relkind = get_rel_relkind(relOid); ! if (relkind == RELKIND_RELATION) tclass = SEPG_CLASS_DB_TABLE; else if (relkind == RELKIND_SEQUENCE) tclass = SEPG_CLASS_DB_SEQUENCE; --- 527,536 ---- { ObjectAddress object; char *audit_name; ! char relkind = get_rel_relkind(relOid); uint16_t tclass = 0; ! if (relkind == RELKIND_RELATION || relkind == RELKIND_PARTITIONED_TABLE) tclass = SEPG_CLASS_DB_TABLE; else if (relkind == RELKIND_SEQUENCE) tclass = SEPG_CLASS_DB_SEQUENCE;