From 7bae5a289c8fbe33aceb56f04e273eee2c1e7c39 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 5 Sep 2006 21:08:36 +0000 Subject: 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 --- doc/src/sgml/ddl.sgml | 4 ++-- doc/src/sgml/func.sgml | 9 +++++---- doc/src/sgml/information_schema.sgml | 6 +++--- doc/src/sgml/ref/create_rule.sgml | 5 ++--- doc/src/sgml/ref/grant.sgml | 26 +++++++------------------- doc/src/sgml/ref/revoke.sgml | 4 ++-- doc/src/sgml/user-manag.sgml | 4 ++-- 7 files changed, 23 insertions(+), 35 deletions(-) (limited to 'doc/src') 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 @@ - + Data Definition @@ -1342,7 +1342,7 @@ ALTER TABLE products RENAME TO items; There are several different privileges: SELECT, INSERT, UPDATE, DELETE, - RULE, REFERENCES, TRIGGER, + REFERENCES, TRIGGER, CREATE, CONNECT, TEMPORARY, EXECUTE, and 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 @@ - + Functions and Operators @@ -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 SELECT, INSERT, UPDATE, - DELETE, RULE, REFERENCES, or - TRIGGER. (Case of the string is not significant, however.) + values SELECT, INSERT, + UPDATE, DELETE, + REFERENCES, or TRIGGER. + (Case of the string is not significant, however.) An example is: 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 @@ - + The Information Schema @@ -2832,7 +2832,7 @@ ORDER BY c.ordinal_position; Type of the privilege: SELECT, DELETE, INSERT, UPDATE, REFERENCES, - RULE, or TRIGGER + or TRIGGER @@ -4418,7 +4418,7 @@ ORDER BY c.ordinal_position; Type of the privilege: SELECT, DELETE, INSERT, UPDATE, REFERENCES, - RULE, or TRIGGER + or TRIGGER 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 @@ @@ -200,8 +200,7 @@ CREATE [ OR REPLACE ] RULE name AS Notes - You must have the privilege RULE 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. 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 @@ @@ -20,7 +20,7 @@ PostgreSQL documentation -GRANT { { SELECT | INSERT | UPDATE | DELETE | RULE | REFERENCES | TRIGGER } +GRANT { { SELECT | INSERT | UPDATE | DELETE | REFERENCES | TRIGGER } [,...] | ALL [ PRIVILEGES ] } ON [ TABLE ] tablename [, ...] TO { username | GROUP groupname | PUBLIC } [, ...] [ WITH GRANT OPTION ] @@ -178,16 +178,6 @@ GRANT role [, ...] TO - - RULE - - - Allows the creation of a rule on the table/view. (See the statement.) - - - - REFERENCES @@ -418,8 +408,8 @@ GRANT role [, ...] TO The entries shown by \z are interpreted thus: @@ -432,7 +422,6 @@ GRANT role [, ...] TO role [, ...] TO PUBLIC depending on the object type, as explained above. The first GRANT or REVOKE on an object will instantiate the default privileges (producing, for example, -{miriam=arwdRxt/miriam}) and then modify them per the +{miriam=arwdxt/miriam}) and then modify them per the specified request. @@ -548,8 +537,7 @@ GRANT privileges - The RULE privilege, and privileges on - databases, tablespaces, schemas, and languages are + Privileges on databases, tablespaces, schemas, and languages are PostgreSQL extensions. 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 @@ @@ -21,7 +21,7 @@ PostgreSQL documentation REVOKE [ GRANT OPTION FOR ] - { { SELECT | INSERT | UPDATE | DELETE | RULE | REFERENCES | TRIGGER } + { { SELECT | INSERT | UPDATE | DELETE | REFERENCES | TRIGGER } [,...] | ALL [ PRIVILEGES ] } ON [ TABLE ] tablename [, ...] FROM { username | GROUP groupname | 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 @@ - + Database Roles and Privileges @@ -293,7 +293,7 @@ ALTER ROLE myname SET enable_indexscan TO off; granted. There are several different kinds of privilege: SELECT, INSERT, UPDATE, DELETE, - RULE, REFERENCES, TRIGGER, + REFERENCES, TRIGGER, CREATE, CONNECT, TEMPORARY, EXECUTE, and USAGE. For more information on the different types of privileges supported by -- cgit v1.2.3