diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-09-05 21:08:36 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-09-05 21:08:36 +0000 |
commit | 7bae5a289c8fbe33aceb56f04e273eee2c1e7c39 (patch) | |
tree | 6a682bb192d1966cc86ece22d51963fb86951f5d /doc/src | |
parent | d5eb52a511bda6a975cc59ec69dca1da38675bf4 (diff) |
Get rid of the separate RULE privilege for tables: now only a table's owner
can create or modify rules for the table. Do setRuleCheckAsUser() while
loading rules into the relcache, rather than when defining a rule. This
ensures that permission checks for tables referenced in a rule are done with
respect to the current owner of the rule's table, whereas formerly ALTER TABLE
OWNER would fail to update the permission checking for associated rules.
Removal of separate RULE privilege is needed to prevent various scenarios
in which a grantee of RULE privilege could effectively have any privilege
of the table owner. For backwards compatibility, GRANT/REVOKE RULE is still
accepted, but it doesn't do anything. Per discussion here:
http://archives.postgresql.org/pgsql-hackers/2006-04/msg01138.php
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/ddl.sgml | 4 | ||||
-rw-r--r-- | doc/src/sgml/func.sgml | 9 | ||||
-rw-r--r-- | doc/src/sgml/information_schema.sgml | 6 | ||||
-rw-r--r-- | doc/src/sgml/ref/create_rule.sgml | 5 | ||||
-rw-r--r-- | doc/src/sgml/ref/grant.sgml | 26 | ||||
-rw-r--r-- | doc/src/sgml/ref/revoke.sgml | 4 | ||||
-rw-r--r-- | doc/src/sgml/user-manag.sgml | 4 |
7 files changed, 23 insertions, 35 deletions
diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 5f3f724b7c6..f21a4797bdb 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -1,4 +1,4 @@ -<!-- $PostgreSQL: pgsql/doc/src/sgml/ddl.sgml,v 1.60 2006/07/14 00:13:05 neilc Exp $ --> +<!-- $PostgreSQL: pgsql/doc/src/sgml/ddl.sgml,v 1.61 2006/09/05 21:08:33 tgl Exp $ --> <chapter id="ddl"> <title>Data Definition</title> @@ -1342,7 +1342,7 @@ ALTER TABLE products RENAME TO items; <para> There are several different privileges: <literal>SELECT</>, <literal>INSERT</>, <literal>UPDATE</>, <literal>DELETE</>, - <literal>RULE</>, <literal>REFERENCES</>, <literal>TRIGGER</>, + <literal>REFERENCES</>, <literal>TRIGGER</>, <literal>CREATE</>, <literal>CONNECT</>, <literal>TEMPORARY</>, <literal>EXECUTE</>, and <literal>USAGE</>. The privileges applicable to a particular diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index ebf793ae55e..13209c87a29 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -1,4 +1,4 @@ -<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.333 2006/09/04 21:47:25 momjian Exp $ --> +<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.334 2006/09/05 21:08:33 tgl Exp $ --> <chapter id="functions"> <title>Functions and Operators</title> @@ -9543,9 +9543,10 @@ SELECT has_function_privilege('joeuser', 'myfunc(int, text)', 'execute'); the name can be schema-qualified if necessary. The desired access privilege type is specified by a text string, which must evaluate to one of the - values <literal>SELECT</literal>, <literal>INSERT</literal>, <literal>UPDATE</literal>, - <literal>DELETE</literal>, <literal>RULE</literal>, <literal>REFERENCES</literal>, or - <literal>TRIGGER</literal>. (Case of the string is not significant, however.) + values <literal>SELECT</literal>, <literal>INSERT</literal>, + <literal>UPDATE</literal>, <literal>DELETE</literal>, + <literal>REFERENCES</literal>, or <literal>TRIGGER</literal>. + (Case of the string is not significant, however.) An example is: <programlisting> SELECT has_table_privilege('myschema.mytable', 'select'); diff --git a/doc/src/sgml/information_schema.sgml b/doc/src/sgml/information_schema.sgml index 1ce808463df..544b811c546 100644 --- a/doc/src/sgml/information_schema.sgml +++ b/doc/src/sgml/information_schema.sgml @@ -1,4 +1,4 @@ -<!-- $PostgreSQL: pgsql/doc/src/sgml/information_schema.sgml,v 1.26 2006/05/02 18:07:51 tgl Exp $ --> +<!-- $PostgreSQL: pgsql/doc/src/sgml/information_schema.sgml,v 1.27 2006/09/05 21:08:34 tgl Exp $ --> <chapter id="information-schema"> <title>The Information Schema</title> @@ -2832,7 +2832,7 @@ ORDER BY c.ordinal_position; Type of the privilege: <literal>SELECT</literal>, <literal>DELETE</literal>, <literal>INSERT</literal>, <literal>UPDATE</literal>, <literal>REFERENCES</literal>, - <literal>RULE</literal>, or <literal>TRIGGER</literal> + or <literal>TRIGGER</literal> </entry> </row> @@ -4418,7 +4418,7 @@ ORDER BY c.ordinal_position; Type of the privilege: <literal>SELECT</literal>, <literal>DELETE</literal>, <literal>INSERT</literal>, <literal>UPDATE</literal>, <literal>REFERENCES</literal>, - <literal>RULE</literal>, or <literal>TRIGGER</literal> + or <literal>TRIGGER</literal> </entry> </row> diff --git a/doc/src/sgml/ref/create_rule.sgml b/doc/src/sgml/ref/create_rule.sgml index 9380ab5a184..1c9cf0b91a8 100644 --- a/doc/src/sgml/ref/create_rule.sgml +++ b/doc/src/sgml/ref/create_rule.sgml @@ -1,5 +1,5 @@ <!-- -$PostgreSQL: pgsql/doc/src/sgml/ref/create_rule.sgml,v 1.46 2006/09/02 17:06:52 tgl Exp $ +$PostgreSQL: pgsql/doc/src/sgml/ref/create_rule.sgml,v 1.47 2006/09/05 21:08:35 tgl Exp $ PostgreSQL documentation --> @@ -200,8 +200,7 @@ CREATE [ OR REPLACE ] RULE <replaceable class="parameter">name</replaceable> AS <title>Notes</title> <para> - You must have the privilege <literal>RULE</literal> on a table to - be allowed to define a rule on it. + You must be the owner of a table to create or change rules for it. </para> <para> diff --git a/doc/src/sgml/ref/grant.sgml b/doc/src/sgml/ref/grant.sgml index d846cd07fde..e00ea521e93 100644 --- a/doc/src/sgml/ref/grant.sgml +++ b/doc/src/sgml/ref/grant.sgml @@ -1,5 +1,5 @@ <!-- -$PostgreSQL: pgsql/doc/src/sgml/ref/grant.sgml,v 1.60 2006/08/02 16:29:49 tgl Exp $ +$PostgreSQL: pgsql/doc/src/sgml/ref/grant.sgml,v 1.61 2006/09/05 21:08:35 tgl Exp $ PostgreSQL documentation --> @@ -20,7 +20,7 @@ PostgreSQL documentation <refsynopsisdiv> <synopsis> -GRANT { { SELECT | INSERT | UPDATE | DELETE | RULE | REFERENCES | TRIGGER } +GRANT { { SELECT | INSERT | UPDATE | DELETE | REFERENCES | TRIGGER } [,...] | ALL [ PRIVILEGES ] } ON [ TABLE ] <replaceable class="PARAMETER">tablename</replaceable> [, ...] TO { <replaceable class="PARAMETER">username</replaceable> | GROUP <replaceable class="PARAMETER">groupname</replaceable> | PUBLIC } [, ...] [ WITH GRANT OPTION ] @@ -179,16 +179,6 @@ GRANT <replaceable class="PARAMETER">role</replaceable> [, ...] TO <replaceable </varlistentry> <varlistentry> - <term>RULE</term> - <listitem> - <para> - Allows the creation of a rule on the table/view. (See the <xref - linkend="sql-createrule" endterm="sql-createrule-title"> statement.) - </para> - </listitem> - </varlistentry> - - <varlistentry> <term>REFERENCES</term> <listitem> <para> @@ -418,8 +408,8 @@ GRANT <replaceable class="PARAMETER">role</replaceable> [, ...] TO <replaceable Access privileges for database "lusitania" Schema | Name | Type | Access privileges ---------+---------+-------+------------------------------------------------------------ - public | mytable | table | {miriam=arwdRxt/miriam,=r/miriam,"group todos=arw/miriam"} +--------+---------+-------+----------------------------------------------------------- + public | mytable | table | {miriam=arwdxt/miriam,=r/miriam,"group todos=arw/miriam"} (1 row) </programlisting> The entries shown by <command>\z</command> are interpreted thus: @@ -432,7 +422,6 @@ GRANT <replaceable class="PARAMETER">role</replaceable> [, ...] TO <replaceable w -- UPDATE ("write") a -- INSERT ("append") d -- DELETE - R -- RULE x -- REFERENCES t -- TRIGGER X -- EXECUTE @@ -440,7 +429,7 @@ GRANT <replaceable class="PARAMETER">role</replaceable> [, ...] TO <replaceable C -- CREATE c -- CONNECT T -- TEMPORARY - arwdRxt -- ALL PRIVILEGES (for tables) + arwdxt -- ALL PRIVILEGES (for tables) * -- grant option for preceding privilege /yyyy -- user who granted this privilege @@ -463,7 +452,7 @@ and may include some privileges for <literal>PUBLIC</> depending on the object type, as explained above. The first <command>GRANT</> or <command>REVOKE</> on an object will instantiate the default privileges (producing, for example, -<literal>{miriam=arwdRxt/miriam}</>) and then modify them per the +<literal>{miriam=arwdxt/miriam}</>) and then modify them per the specified request. </para> @@ -548,8 +537,7 @@ GRANT <replaceable class="PARAMETER">privileges</replaceable> </para> <para> - The <literal>RULE</literal> privilege, and privileges on - databases, tablespaces, schemas, and languages are + Privileges on databases, tablespaces, schemas, and languages are <productname>PostgreSQL</productname> extensions. </para> </refsect1> diff --git a/doc/src/sgml/ref/revoke.sgml b/doc/src/sgml/ref/revoke.sgml index df38437436f..03746d56229 100644 --- a/doc/src/sgml/ref/revoke.sgml +++ b/doc/src/sgml/ref/revoke.sgml @@ -1,5 +1,5 @@ <!-- -$PostgreSQL: pgsql/doc/src/sgml/ref/revoke.sgml,v 1.39 2006/08/02 16:29:49 tgl Exp $ +$PostgreSQL: pgsql/doc/src/sgml/ref/revoke.sgml,v 1.40 2006/09/05 21:08:35 tgl Exp $ PostgreSQL documentation --> @@ -21,7 +21,7 @@ PostgreSQL documentation <refsynopsisdiv> <synopsis> REVOKE [ GRANT OPTION FOR ] - { { SELECT | INSERT | UPDATE | DELETE | RULE | REFERENCES | TRIGGER } + { { SELECT | INSERT | UPDATE | DELETE | REFERENCES | TRIGGER } [,...] | ALL [ PRIVILEGES ] } ON [ TABLE ] <replaceable class="PARAMETER">tablename</replaceable> [, ...] FROM { <replaceable class="PARAMETER">username</replaceable> | GROUP <replaceable class="PARAMETER">groupname</replaceable> | PUBLIC } [, ...] diff --git a/doc/src/sgml/user-manag.sgml b/doc/src/sgml/user-manag.sgml index c86837d1f7a..ec5c6e43c4d 100644 --- a/doc/src/sgml/user-manag.sgml +++ b/doc/src/sgml/user-manag.sgml @@ -1,4 +1,4 @@ -<!-- $PostgreSQL: pgsql/doc/src/sgml/user-manag.sgml,v 1.36 2006/08/02 16:29:49 tgl Exp $ --> +<!-- $PostgreSQL: pgsql/doc/src/sgml/user-manag.sgml,v 1.37 2006/09/05 21:08:34 tgl Exp $ --> <chapter id="user-manag"> <title>Database Roles and Privileges</title> @@ -293,7 +293,7 @@ ALTER ROLE myname SET enable_indexscan TO off; granted. There are several different kinds of privilege: <literal>SELECT</>, <literal>INSERT</>, <literal>UPDATE</>, <literal>DELETE</>, - <literal>RULE</>, <literal>REFERENCES</>, <literal>TRIGGER</>, + <literal>REFERENCES</>, <literal>TRIGGER</>, <literal>CREATE</>, <literal>CONNECT</>, <literal>TEMPORARY</>, <literal>EXECUTE</>, and <literal>USAGE</>. For more information on the different types of privileges supported by |