Обсуждение: Owner and privileges on sequences

Поиск
Список
Период
Сортировка

Owner and privileges on sequences

От
"Dmitry Samokhin"
Дата:
For sequences, the DDL script generated looks like:

CREATE SEQUENCE ...;
ALTER TABLE ... OWNER TO ...;
GRANT ... ON TABLE ... TO ...;
...

... but should be:

...
ALTER SEQUENCE ... OWNER TO ...;
GRANT ... ON SEQUENCE ... TO ...;
...

Regards,
Dmitry. 




Re: Owner and privileges on sequences

От
Guillaume Lelarge
Дата:
Le vendredi 9 octobre 2009 à 09:50:22, Dmitry Samokhin a écrit :
> For sequences, the DDL script generated looks like:
>
> CREATE SEQUENCE ...;
> ALTER TABLE ... OWNER TO ...;
> GRANT ... ON TABLE ... TO ...;
> ...
>
> ... but should be:
>
> ...
> ALTER SEQUENCE ... OWNER TO ...;
> GRANT ... ON SEQUENCE ... TO ...;
> ...
>

I don't quite understand why it should be your way and not the other. Care to
explain?

Regards.


--
Guillaume.http://www.postgresqlfr.orghttp://dalibo.com


Re: Owner and privileges on sequences

От
"Dmitry Samokhin"
Дата:
>> ALTER SEQUENCE ... OWNER TO ...;
>> GRANT ... ON SEQUENCE ... TO ...;
>> ...
>>
>
>I don't quite understand why it should be your way and not the other. Care 
>to
>explain?
>
>Regards.
>
>
>-- 
>Guillaume.

Oops, sorry, there is no syntax ALTER SEQUENCE ... OWNER TO ...;

But since release 8.2, GRANT ON SEQUENCE is available. As written in the 
release notes, "GRANT ON TABLE for sequences is still supported for backward 
compatibility".

It's quite easy to explain the reason to make such a modification. As also 
written in the release notes mentioned above, "this <GRANT ON SEQUENCE> was 
added for setting sequence-specific permissions". It might be strange for 
someone to operate a command like "GRANT USAGE ON TABLE ..." generated for a 
sequence, since there is no meaningful USAGE privilege for tables. Although 
it is correct and works.

Dmitry.