1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Implement has_sequence_privilege()

Add family of functions that did not exist earlier,
mainly due to historical omission. Original patch by
Abhijit Menon-Sen, with review and modifications by
Joe Conway. catversion.h bumped.
This commit is contained in:
Joe Conway
2009-08-03 21:11:40 +00:00
parent 7ffb14f9db
commit be6bca23b3
7 changed files with 304 additions and 6 deletions

View File

@ -1,4 +1,4 @@
<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.483 2009/07/22 18:07:26 petere Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.484 2009/08/03 21:11:39 joe Exp $ -->
<chapter id="functions">
<title>Functions and Operators</title>
@ -11788,6 +11788,21 @@ SET search_path TO <replaceable>schema</> <optional>, <replaceable>schema</>, ..
<entry><type>boolean</type></entry>
<entry>does current user have privilege for foreign server</entry>
</row>
<row>
<entry><literal><function>has_sequence_privilege</function>(<parameter>user</parameter>,
<parameter>sequence</parameter>,
<parameter>privilege</parameter>)</literal>
</entry>
<entry><type>boolean</type></entry>
<entry>does user have privilege for sequence</entry>
</row>
<row>
<entry><literal><function>has_sequence_privilege</function>(<parameter>sequence</parameter>,
<parameter>privilege</parameter>)</literal>
</entry>
<entry><type>boolean</type></entry>
<entry>does current user have privilege for sequence</entry>
</row>
<row>
<entry><literal><function>has_table_privilege</function>(<parameter>user</parameter>,
<parameter>table</parameter>,
@ -11861,6 +11876,9 @@ SET search_path TO <replaceable>schema</> <optional>, <replaceable>schema</>, ..
<indexterm>
<primary>has_server_privilege</primary>
</indexterm>
<indexterm>
<primary>has_sequence_privilege</primary>
</indexterm>
<indexterm>
<primary>has_table_privilege</primary>
</indexterm>
@ -11900,6 +11918,16 @@ SELECT has_table_privilege('joe', 'mytable', 'INSERT, SELECT WITH GRANT OPTION')
</programlisting>
</para>
<para>
<function>has_sequence_privilege</function> checks whether a user
can access a sequence in a particular way. The possibilities for its
arguments are analogous to <function>has_table_privilege</function>.
The desired access privilege type must evaluate to one of
<literal>USAGE</literal>,
<literal>SELECT</literal>, or
<literal>UPDATE</literal>.
</para>
<para>
<function>has_any_column_privilege</function> checks whether a user can
access any column of a table in a particular way.