From: | vignesh C <vignesh21(at)gmail(dot)com> |
---|---|
To: | Greg Nancarrow <gregn4422(at)gmail(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Hou, Zhijie/侯 志杰 <houzj(dot)fnst(at)fujitsu(dot)com> |
Subject: | Re: Alter all tables in schema owner fix |
Date: | 2021-12-03 05:30:49 |
Message-ID: | CALDaNm1DsJ+egPhLSMKccwEX4wz+f69nnaBFGC0mhSeT7H-q_Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Dec 3, 2021 at 9:53 AM Greg Nancarrow <gregn4422(at)gmail(dot)com> wrote:
>
> On Fri, Dec 3, 2021 at 2:06 PM vignesh C <vignesh21(at)gmail(dot)com> wrote:
> >
> > Currently while changing the owner of ALL TABLES IN SCHEMA
> > publication, it is not checked if the new owner has superuser
> > permission or not. Added a check to throw an error if the new owner
> > does not have superuser permission.
> > Attached patch has the changes for the same. Thoughts?
> >
>
> It looks OK to me, but just two things:
>
> 1) Isn't it better to name "CheckSchemaPublication" as
> "IsSchemaPublication", since it has a boolean return and also
> typically CheckXXX type functions normally do checking and error-out
> if they find a problem.
Modified
> 2) Since superuser_arg() caches previous input arg (last_roleid) and
> has a fast-exit, and has been called immediately before for the FOR
> ALL TABLES case, it would be better to write:
>
> + if (CheckSchemaPublication(form->oid) && !superuser_arg(newOwnerId))
>
> as:
>
> + if (!superuser_arg(newOwnerId) && IsSchemaPublication(form->oid))
Modified
Thanks for the comments, the attached v2 patch has the changes for the same.
Regards,
Vignesh
Attachment | Content-Type | Size |
---|---|---|
v2-0001-Fix-for-new-owner-of-ALL-TABLES-IN-SCHEMA-publica.patch | text/x-patch | 4.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | houzj.fnst@fujitsu.com | 2021-12-03 05:54:21 | RE: Data is copied twice when specifying both child and parent table in publication |
Previous Message | Justin Pryzby | 2021-12-03 05:24:11 | Re: extended stats on partitioned tables |