On Thu, May 22, 2025 at 1:01 AM Dmitry Koval <d.ko...@postgrespro.ru> wrote:
>
> > for example:
> > ...
>
> If in both examples you replace
>
> create role bob;
>
> with
>
> create role bob SUPERUSER;
>
> and in the second example add "set role bob;" before "alter table ..."
> query, then no error will be occur.
>

That is fine.
superuser can bypass all permission checks.
superuser can attach any table to the partitioned table as he wants.

for example:

begin;
create role alice SUPERUSER;
create role bob SUPERUSER;
GRANT all privileges on schema public to alice;
GRANT all privileges on schema public to bob;
set role bob;
create table at_partitioned (a int, b text) partition by range (a);
set role alice;
create table at_part_2 (b text, a int);
set role bob;
alter table at_partitioned attach partition at_part_2 for values from
(1000) to (2000);
rollback;

Am I missing something?


Reply via email to