diff options
| author | Amit Kapila | 2021-12-08 06:01:16 +0000 |
|---|---|---|
| committer | Amit Kapila | 2021-12-08 06:01:16 +0000 |
| commit | 1a2aaeb0db1bccd97140d479c4247127f6cb9378 (patch) | |
| tree | d78e7e44a44d0e963e1bdf89ee91d9b322d5b18c /src/backend/commands | |
| parent | a61bff2bf479cfebda18a1655323eec1b19370de (diff) | |
Fix changing the ownership of ALL TABLES IN SCHEMA publication.
Ensure that the new owner of ALL TABLES IN SCHEMA publication must be a
superuser. The same is already ensured during CREATE PUBLICATION.
Author: Vignesh C
Reviewed-by: Nathan Bossart, Greg Nancarrow, Michael Paquier, Haiying Tang
Discussion: https://postgr.es/m/CALDaNm0E5U-RqxFuFrkZrQeG7ae5trGa=xs=iRtPPHULtT4zOw@mail.gmail.com
Diffstat (limited to 'src/backend/commands')
| -rw-r--r-- | src/backend/commands/publicationcmds.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/backend/commands/publicationcmds.c b/src/backend/commands/publicationcmds.c index 7d4a0e95f6c..404bb5d0c87 100644 --- a/src/backend/commands/publicationcmds.c +++ b/src/backend/commands/publicationcmds.c @@ -1192,6 +1192,13 @@ AlterPublicationOwner_internal(Relation rel, HeapTuple tup, Oid newOwnerId) errmsg("permission denied to change owner of publication \"%s\"", NameStr(form->pubname)), errhint("The owner of a FOR ALL TABLES publication must be a superuser."))); + + if (!superuser_arg(newOwnerId) && is_schema_publication(form->oid)) + ereport(ERROR, + (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), + errmsg("permission denied to change owner of publication \"%s\"", + NameStr(form->pubname)), + errhint("The owner of a FOR ALL TABLES IN SCHEMA publication must be a superuser."))); } form->pubowner = newOwnerId; |
