Re: Sequence privileges

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Sequence privileges
Дата
Msg-id 11752.1021739041@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Sequence privileges  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> But shouldn't it more ideally be

> currval:    SELECT
> nextval:    SELECT + UPDATE
> setval:    UPDATE

> because nextval allows you to infer the content of the sequence?  (Cf.
> UPDATE tab1 SET a = b requires SELECT + UPDATE on tab1.)

One objection is that testing for both privs will require two aclcheck
calls (since aclcheck(SELECT|UPDATE) will check for the OR not the AND
of the privileges).  Not sure it's worth the overhead.

Given that nextval() is really the only interesting operation on
sequences (you cannot do a real UPDATE), I don't see a problem with
interpreting "UPDATE" as "the right to do nextval()" for sequences.

Since currval only returns to you the result of your own prior nextval,
there is no real point in giving it a different privilege bit.
Accordingly I think it *should* be testing UPDATE --- the docs are right
and the code is wrong.  (If it weren't for your recent addition of
setuid functions, I'd question why currval bothers to make a privilege
test at all.)

"SELECT" still means what it says: the ability to do a select from
the sequence, which lets you see the sequence parameters.  So what
we really have is:
SELECT: read sequence as a tableUPDATE: all sequence-specific operations.

You could maybe make an argument that setval() should have a different
privilege than nextval(), but otherwise this seems sufficient to me.

There is now room in ACL to invent a couple of sequence-specific
privilege bits if it bothers you to use "UPDATE" for the can-invoke-
sequence-functions privilege, but I'm not sure it's worth creating
a compatibility issue just to do that.
        regards, tom lane


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

Предыдущее
От: Barry Lind
Дата:
Сообщение: Re: Trouble with pg_encoding_to_char
Следующее
От: Jean-Michel POURE
Дата:
Сообщение: UTF-8 safe ascii() function