Skip to content

Commit c7d8fd4

Browse files
committed
Fix permission tests
1 parent 6d9494d commit c7d8fd4

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

expected/pathman_permissions.out

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ GRANT SELECT ON permissions.user1_table TO user2;
1919
/* Should fail (don't own parent) */
2020
SET ROLE user2;
2121
SELECT create_range_partitions('permissions.user1_table', 'id', 1, 10, 2);
22-
WARNING: only the owner or superuser can change partitioning configuration of table "user1_table"
23-
ERROR: new row violates row-level security policy for table "pathman_config"
22+
ERROR: only the owner or superuser can change partitioning configuration of table "user1_table"
2423
/* Should be ok */
2524
SET ROLE user1;
2625
SELECT create_range_partitions('permissions.user1_table', 'id', 1, 10, 2);

src/pl_funcs.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,13 @@ add_to_pathman_config(PG_FUNCTION_ARGS)
723723
if (!check_relation_exists(relid))
724724
elog(ERROR, "Invalid relation %u", relid);
725725

726+
if (!check_security_policy_internal(relid, GetUserId()))
727+
{
728+
elog(ERROR, "only the owner or superuser can change "
729+
"partitioning configuration of table \"%s\"",
730+
get_rel_name_or_relid(relid));
731+
}
732+
726733
/* Select partitioning type using 'range_interval' */
727734
parttype = PG_ARGISNULL(2) ? PT_HASH : PT_RANGE;
728735

0 commit comments

Comments
 (0)