aboutsummaryrefslogtreecommitdiff
path: root/contrib/sepgsql/label.c
diff options
context:
space:
mode:
authorJoe Conway <mail@joeconway.com>2017-04-09 14:01:58 -0700
committerJoe Conway <mail@joeconway.com>2017-04-09 14:01:58 -0700
commit25542d77dd549940468d1a932809feb9959d717d (patch)
tree40170811f8ae439881fb99e90b12076aacf1b4c4 /contrib/sepgsql/label.c
parenteef8c0069e4d5eea2e52965ce3eb018b5a594fd6 (diff)
downloadpostgresql-25542d77dd549940468d1a932809feb9959d717d.tar.gz
postgresql-25542d77dd549940468d1a932809feb9959d717d.zip
Add partitioned table support to sepgsql
The new partitioned table capability added a new relkind, namely RELKIND_PARTITIONED_TABLE. Update sepgsql to treat this new relkind exactly the same way it does RELKIND_RELATION. In addition, add regression test coverage for partitioned tables. Issue raised by Stephen Frost and initial patch by Mike Palmiotto. Review by Tom Lane and Robert Haas, and editorializing by me. Discussion: https://postgr.es/m/flat/623bcaae-112e-ced0-8c22-a84f75ae0c53%40joeconway.com
Diffstat (limited to 'contrib/sepgsql/label.c')
-rw-r--r--contrib/sepgsql/label.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/contrib/sepgsql/label.c b/contrib/sepgsql/label.c
index fc1aab4740f..62398001894 100644
--- a/contrib/sepgsql/label.c
+++ b/contrib/sepgsql/label.c
@@ -787,7 +787,8 @@ exec_object_restorecon(struct selabel_handle * sehnd, Oid catalogId)
case RelationRelationId:
relForm = (Form_pg_class) GETSTRUCT(tuple);
- if (relForm->relkind == RELKIND_RELATION)
+ if (relForm->relkind == RELKIND_RELATION ||
+ relForm->relkind == RELKIND_PARTITIONED_TABLE)
objtype = SELABEL_DB_TABLE;
else if (relForm->relkind == RELKIND_SEQUENCE)
objtype = SELABEL_DB_SEQUENCE;
@@ -811,7 +812,8 @@ exec_object_restorecon(struct selabel_handle * sehnd, Oid catalogId)
case AttributeRelationId:
attForm = (Form_pg_attribute) GETSTRUCT(tuple);
- if (get_rel_relkind(attForm->attrelid) != RELKIND_RELATION)
+ if (get_rel_relkind(attForm->attrelid) != RELKIND_RELATION &&
+ get_rel_relkind(attForm->attrelid) != RELKIND_PARTITIONED_TABLE)
continue; /* no need to assign security label */
objtype = SELABEL_DB_COLUMN;