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

When a superuser does GRANT or REVOKE on an object he doesn't own,

process the command as though it were issued by the object owner.
This prevents creating weird scenarios in which the same privileges
may appear to flow from different sources, and ensures that a superuser
can in fact revoke all privileges if he wants to.  In particular this
means that the regression tests work when run by a superuser other than
the original bootstrap userid.  Per report from Larry Rosenman.
This commit is contained in:
Tom Lane
2003-10-31 20:00:49 +00:00
parent 19554ed487
commit 8545482947
3 changed files with 135 additions and 67 deletions

View File

@ -1,5 +1,5 @@
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/revoke.sgml,v 1.27 2003/08/31 17:32:24 petere Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/revoke.sgml,v 1.28 2003/10/31 20:00:48 tgl Exp $
PostgreSQL documentation
-->
@ -63,6 +63,11 @@ REVOKE [ GRANT OPTION FOR ]
all users.
</para>
<para>
See the description of the <xref linkend="sql-grant" endterm="sql-grant-title"> command for
the meaning of the privilege types.
</para>
<para>
Note that any particular user will have the sum
of privileges granted directly to him, privileges granted to any group he
@ -73,11 +78,6 @@ REVOKE [ GRANT OPTION FOR ]
directly or via a group will still have it.
</para>
<para>
See the description of the <xref linkend="sql-grant" endterm="sql-grant-title"> command for
the meaning of the privilege types.
</para>
<para>
If <literal>GRANT OPTION FOR</literal> is specified, only the grant
option for the privilege is revoked, not the privilege itself.
@ -116,6 +116,15 @@ REVOKE [ GRANT OPTION FOR ]
the <literal>CASCADE</literal> option so that the privilege is
automatically revoked from user C.
</para>
<para>
If a superuser chooses to issue a <command>GRANT</> or <command>REVOKE</>
command, the command is performed as though it were issued by the
owner of the affected object. Since all privileges ultimately come
from the object owner (possibly indirectly via chains of grant options),
it is possible for a superuser to revoke all privileges, but this may
require use of <literal>CASCADE</literal> as stated above.
</para>
</refsect1>
<refsect1 id="SQL-REVOKE-examples">
@ -153,7 +162,8 @@ REVOKE [ GRANT OPTION FOR ] <replaceable class="PARAMETER">privileges</replaceab
{ RESTRICT | CASCADE }
</synopsis>
One of <literal>RESTRICT</literal> or <literal>CASCADE</literal>
is required.
is required according to the standard, but <productname>PostgreSQL</>
assumes <literal>RESTRICT</literal> by default.
</para>
</refsect1>