Re: Extending grant insert on tables to sequences

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Extending grant insert on tables to sequences
Дата
Msg-id 23912.1215893211@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Extending grant insert on tables to sequences  ("Jaime Casanova" <jcasanov@systemguards.com.ec>)
Список pgsql-hackers
"Jaime Casanova" <jcasanov@systemguards.com.ec> writes:
> +         if (istmt.all_privs)
> +             istmt_seq.all_privs = true;
> +         else
> +         {
> +             if (istmt.privileges & ACL_INSERT) 
> +                 istmt_seq.privileges |= ACL_USAGE;
> +             if (istmt.privileges & ACL_UPDATE) 
> +                 istmt_seq.privileges |= ACL_UPDATE;
> +             if (istmt.privileges & ACL_SELECT) 
> +                 istmt_seq.privileges |= ACL_SELECT;
> +         }

This definition of the derived rights seems pretty arbitrary and
unprincipled.  If you can't explain it precisely in a few words in the
documentation (and I notice you didn't even attempt to explain it at
all), then you probably need to think harder.

In particular, I don't see why having UPDATE on the parent table should
grant the right to use setval() on the sequence.  If you had INSERT and
DELETE as well, implying the right to make arbitrary changes in the
parent table, then maybe setval() would be sensible to allow --- but
this code can't really tell that, since it doesn't have a global view
of the privileges previously granted.

What I think makes sense is just to have parent INSERT privilege lead to
USAGE on the sequence (thus granting nextval/currval rights, which are
what you'd typically need in association with trying to do inserts).
I don't see any need to automatically grant more than that.  Selects and
updates on the parent table don't need to touch the sequence, so why are
those privileges granting anything?
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Abhijit Menon-Sen
Дата:
Сообщение: Re: Extending grant insert on tables to sequences
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Extending grant insert on tables to sequences