From 8b0d5949a81e1ffe456355b471c0a491fce52879 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 28 May 2008 00:46:12 +0000 Subject: [PATCH] Improve GRANT documentation to point out that UPDATE and DELETE typically require SELECT privilege as well, since you normally need to read existing column values within such commands. This behavior is according to spec, but we'd never documented it before. Per gripe from Volkan Yazici. --- doc/src/sgml/ref/grant.sgml | 42 ++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/doc/src/sgml/ref/grant.sgml b/doc/src/sgml/ref/grant.sgml index a43de6356d9..5aa40cb933d 100644 --- a/doc/src/sgml/ref/grant.sgml +++ b/doc/src/sgml/ref/grant.sgml @@ -1,5 +1,5 @@ @@ -104,10 +104,15 @@ GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] } SELECT - Allows from any column of the - specified table, view, or sequence. Also allows the use of - TO. For sequences, this - privilege also allows the use of the currval function. + Allows from + any column of the specified table, view, or sequence. + Also allows the use of + TO. + This privilege is also needed to reference existing column values in + or + . + For sequences, this privilege also allows the use of the + currval function. @@ -116,8 +121,9 @@ GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] } INSERT - Allows of a new row into the - specified table. Also allows FROM. + Allows of a new + row into the specified table. + Also allows FROM. @@ -126,10 +132,15 @@ GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] } UPDATE - Allows of any column of the - specified table. SELECT ... FOR UPDATE - also requires this privilege (besides the - SELECT privilege). For sequences, this + Allows of any + column of the specified table. + (In practice, any nontrivial UPDATE command will require + SELECT privilege as well, since it must reference table + columns to determine which rows to update, and/or to compute new + values for columns.) + SELECT ... FOR UPDATE + also requires this privilege, in addition to the + SELECT privilege. For sequences, this privilege allows the use of the nextval and setval functions. @@ -140,8 +151,11 @@ GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] } DELETE - Allows of a row from the - specified table. + Allows of a row + from the specified table. + (In practice, any nontrivial DELETE command will require + SELECT privilege as well, since it must reference table + columns to determine which rows to delete.) @@ -196,7 +210,7 @@ GRANT { { CREATE | USAGE } [,...] | ALL [ PRIVILEGES ] } TEMP - Allows temporary tables to be created while using the database. + Allows temporary tables to be created while using the specified database.