Re: Added schema level support for publication.

From: Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com>
To: vignesh C <vignesh21(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, "tanghy(dot)fnst(at)fujitsu(dot)com" <tanghy(dot)fnst(at)fujitsu(dot)com>, Greg Nancarrow <gregn4422(at)gmail(dot)com>, Ajin Cherian <itsajin(at)gmail(dot)com>, "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com>, Rahila Syed <rahilasyed90(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Subject: Re: Added schema level support for publication.
Date: 2021-08-11 14:15:38
Message-ID: F8CFCA2C-F547-442C-A507-9614C4FBDF56@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Aug 10, 2021, at 10:59 PM, vignesh C <vignesh21(at)gmail(dot)com> wrote:
>
> Also, the behavior of "Alter publication drop table" for which the
> user is not the owner is successful, Is this behavior correct?

I think that dropping a table from a publication should be allowed for the publication owner, without regard to the owner of the table. Adding a table to a publication is different, as it exposes the contents of the table.

Consider the following:

+create user user1;
+create user user2;
+create table tbl1(c1 int);
+create table tbl2(c1 int);
+create publication pub1 for table tbl1,tbl2;
+WARNING: wal_level is insufficient to publish logical changes
+HINT: Set wal_level to logical before creating subscriptions.
+alter table tbl1 owner to user1;
+alter publication pub1 owner to user1;
+alter table tbl2 owner to user2;
+SET SESSION AUTHORIZATION user2;
+alter publication pub1 drop table tbl1;
+ERROR: must be owner of publication pub1
+alter publication pub1 drop table tbl2;
+ERROR: must be owner of publication pub1
+alter publication pub1 add table tbl1;
+ERROR: must be owner of publication pub1
+alter publication pub1 add table tbl2;
+ERROR: must be owner of publication pub1
+RESET SESSION AUTHORIZATION;
+SET SESSION AUTHORIZATION user1;
+alter publication pub1 drop table tbl1;
+alter publication pub1 drop table tbl2;
+alter publication pub1 add table tbl1;
+alter publication pub1 add table tbl2;
+ERROR: must be owner of table tbl2

Clearly user2 cannot modify pub1, not even with respect to user2's own table. user1 can modify its own publication except for adding someone else's table. This seems correct to me.


Mark Dilger
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2021-08-11 14:22:48 Re: Next Steps with Hash Indexes
Previous Message Tom Lane 2021-08-11 14:08:01 Re: make MaxBackends available in _PG_init