Re: Alter all tables in schema owner fix

Поиск
Список
Период
Сортировка
Искать
От
Greg Nancarrow
Тема
Re: Alter all tables in schema owner fix
Дата
Msg-id
CAJcOf-f1Q7JotqpymCgG_+jFw+6cGao6C=34xZ8EGbaTr2pB+A@mail.gmail.com
Ответ на
Список
Дерево обсуждения
Alter all tables in schema owner fix vignesh C <vignesh21@gmail.com>
Re: Alter all tables in schema owner fix Greg Nancarrow <gregn4422@gmail.com>
Re: Alter all tables in schema owner fix "Bossart, Nathan" <bossartn@amazon.com>
Re: Alter all tables in schema owner fix vignesh C <vignesh21@gmail.com>
Re: Alter all tables in schema owner fix vignesh C <vignesh21@gmail.com>
RE: Alter all tables in schema owner fix "tanghy.fnst@fujitsu.com" <tanghy.fnst@fujitsu.com>
On Fri, Dec 3, 2021 at 2:06 PM vignesh C  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.

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))


Regards,
Greg Nancarrow
Fujitsu Australia


В списке pgsql-hackers по дате отправления
От: Amit Kapila
Дата:
От: Bossart, Nathan
Дата:
FAQ