On Fri, Aug 22, 2008 at 10:19 PM, Bruce Momjian <[EMAIL PROTECTED]> wrote: > > Added to September commit fest. >
updating the patch with one that only extends inserts. though, i haven't look at the col level privs patch yet. -- regards, Jaime Casanova Soporte y capacitación de PostgreSQL AsesorÃa y desarrollo de sistemas Guayaquil - Ecuador Cel. (593) 87171157
Index: doc/src/sgml/ref/grant.sgml =================================================================== RCS file: /var/lib/postgresql/CVSREPO/pgsql/doc/src/sgml/ref/grant.sgml,v retrieving revision 1.70 diff -c -r1.70 grant.sgml *** doc/src/sgml/ref/grant.sgml 3 Jul 2008 15:59:55 -0000 1.70 --- doc/src/sgml/ref/grant.sgml 1 Sep 2008 06:43:08 -0000 *************** *** 401,410 **** </para> <para> ! Granting permission on a table does not automatically extend ! permissions to any sequences used by the table, including ! sequences tied to <type>SERIAL</> columns. Permissions on ! sequence must be set separately. </para> <para> --- 401,410 ---- </para> <para> ! Granting INSERT permissions on a table automatically extends it ! to any sequences owned by the table, including sequences tied to ! <type>SERIAL</> columns. All other permissions must be set ! separately. </para> <para> Index: src/backend/catalog/aclchk.c =================================================================== RCS file: /var/lib/postgresql/CVSREPO/pgsql/src/backend/catalog/aclchk.c,v retrieving revision 1.147 diff -c -r1.147 aclchk.c *** src/backend/catalog/aclchk.c 19 Jun 2008 00:46:03 -0000 1.147 --- src/backend/catalog/aclchk.c 1 Sep 2008 06:06:26 -0000 *************** *** 361,366 **** --- 361,396 ---- } ExecGrantStmt_oids(&istmt); + + /* + * If the objtype is a relation and the privileges includes INSERT + * then extend it as USAGE to the sequences owned by the + * relation + */ + if (istmt.objtype == ACL_OBJECT_RELATION && + (istmt.all_privs || (istmt.privileges & ACL_INSERT))) + { + InternalGrant istmt_seq; + + istmt_seq.is_grant = istmt.is_grant; + istmt_seq.objtype = ACL_OBJECT_SEQUENCE; + istmt_seq.grantees = istmt.grantees; + istmt_seq.grant_option = istmt.grant_option; + istmt_seq.behavior = istmt.behavior; + + istmt_seq.all_privs = false; + istmt_seq.privileges = ACL_NO_RIGHTS; + + istmt_seq.privileges |= ACL_USAGE; + + istmt_seq.objects = NIL; + foreach(cell, istmt.objects) + istmt_seq.objects = list_concat(istmt_seq.objects, + getOwnedSequences(lfirst_oid(cell))); + + if (istmt_seq.objects != NIL) + ExecGrantStmt_oids(&istmt_seq); + } } /* Index: src/test/regress/expected/dependency.out =================================================================== RCS file: /var/lib/postgresql/CVSREPO/pgsql/src/test/regress/expected/dependency.out,v retrieving revision 1.7 diff -c -r1.7 dependency.out *** src/test/regress/expected/dependency.out 3 Jul 2008 15:59:55 -0000 1.7 --- src/test/regress/expected/dependency.out 1 Sep 2008 06:18:43 -0000 *************** *** 13,19 **** -- can't drop neither because they have privileges somewhere DROP USER regression_user; ERROR: role "regression_user" cannot be dropped because some objects depend on it ! DETAIL: access to table deptest DROP GROUP regression_group; ERROR: role "regression_group" cannot be dropped because some objects depend on it DETAIL: access to table deptest --- 13,20 ---- -- can't drop neither because they have privileges somewhere DROP USER regression_user; ERROR: role "regression_user" cannot be dropped because some objects depend on it ! DETAIL: access to sequence deptest_f1_seq ! access to table deptest DROP GROUP regression_group; ERROR: role "regression_group" cannot be dropped because some objects depend on it DETAIL: access to table deptest
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers