From: paula-corral (@paula-corral) <noreply+paula-corral@github.com>
To: pgpartman/pg_partman <noreply+pgpartman-pg_partman@github.com>
Subject: [pgpartman/pg_partman] issue #858: Clarify ownership requirement for create_parent() (parent table vs partition set)
Date: Tue, 07 Apr 2026 09:05:43 +0000
Message-ID: <gh-pgpartman-pg_partman-858@github.com> (raw)
Hi,
While setting up pg_partman (v5.4.1) in PostgreSQL (v14.22), I ran into an issue that seems related to role requirements when creating a dedicated user for pg_partman.
In the documentation, it mentions:
> “If not using a superuser, it is recommended that a dedicated role is created for running pg_partman functions and to be the owner of all partition sets that pg_partman maintains.”
and then lists the required grants. However, it’s not entirely clear whether this explicitly requires ownership of the *parent table* itself, or if privileges are enough.
Here is a reproducible example:
```sql
-- as role paula (superuser)
CREATE TABLE paula.test1 (
id bigserial,
created_at timestamptz NOT NULL DEFAULT now(),
concept text,
PRIMARY KEY (created_at, id)
) PARTITION BY RANGE (created_at);
CREATE TABLE partman.test_template1 (LIKE paula.test1);
CREATE ROLE partman_user;
GRANT ALL ON SCHEMA partman TO partman_user;
GRANT ALL ON ALL TABLES IN SCHEMA partman TO partman_user;
GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA partman TO partman_user;
GRANT EXECUTE ON ALL PROCEDURES IN SCHEMA partman TO partman_user;
GRANT ALL ON SCHEMA paula TO partman_user;
GRANT ALL ON ALL TABLES IN SCHEMA paula TO partman_user;
GRANT TEMPORARY ON DATABASE paula TO partman_user;
-- switch role
SET ROLE partman_user;
SELECT partman.create_parent(
p_parent_table := 'paula.test1',
p_control := 'created_at',
p_interval := '10 minutes',
p_premake := 12,
p_default_table := false,
p_automatic_maintenance := 'off',
p_jobmon := false,
p_template_table := 'partman.test_template1'
);
```
It throws the error:
```sql
ERROR: must be owner of table test1
CONTEXT: ALTER TABLE paula.test1 ATTACH PARTITION ...
```
From this behavior, it seems that the role executing `create_parent()` must own the parent table (paula.test1), not just have privileges on it. Could you confirm if the intended requirement is that the role must own the parent table, and not just have privileges on the schema/tables? If so, it might help to clarify this in the documentation, since “owner of partition sets” can be interpreted as referring mainly to partitions rather than the parent table.
Thanks!