All, * Joshua D. Drake (j...@commandprompt.com) wrote: > On Thu, 2010-03-04 at 11:23 -0500, Tom Lane wrote: > > I'm not sure offhand about a reasonable way to rearrange the code to > > avoid duplicate messages. > > Perhaps just add what can't be revoked? meaning: > WARNING: no privileges could be revoked for "tbl" for column "foo" > Then they aren't actually duplicate.
Yeah, they really aren't, after all. I don't know how we could rearrange the code to prevent it- we're checking and trying to change privileges on each of the columns in the table, after all. Attached is a patch to add column name to the error message when it's a column-level failure. I'm not really thrilled with it, due to the expansion of code and addition of a bunch of conditionals, but at least this isn't a terribly complicated function.. In the process of trying to build/run regression tests, but having some build issues w/ HEAD (probably my fault). Thanks, Stephen
Index: src/backend/catalog/aclchk.c =================================================================== RCS file: /projects/cvsroot/pgsql/src/backend/catalog/aclchk.c,v retrieving revision 1.163 diff -c -r1.163 aclchk.c *** src/backend/catalog/aclchk.c 26 Feb 2010 02:00:35 -0000 1.163 --- src/backend/catalog/aclchk.c 5 Mar 2010 01:18:42 -0000 *************** *** 304,327 **** if (is_grant) { if (this_privileges == 0) ! ereport(WARNING, ! (errcode(ERRCODE_WARNING_PRIVILEGE_NOT_GRANTED), ! errmsg("no privileges were granted for \"%s\"", objname))); ! else if (!all_privs && this_privileges != privileges) ! ereport(WARNING, ! (errcode(ERRCODE_WARNING_PRIVILEGE_NOT_GRANTED), ! errmsg("not all privileges were granted for \"%s\"", objname))); } else { if (this_privileges == 0) ! ereport(WARNING, ! (errcode(ERRCODE_WARNING_PRIVILEGE_NOT_REVOKED), ! errmsg("no privileges could be revoked for \"%s\"", objname))); ! else if (!all_privs && this_privileges != privileges) ! ereport(WARNING, ! (errcode(ERRCODE_WARNING_PRIVILEGE_NOT_REVOKED), ! errmsg("not all privileges could be revoked for \"%s\"", objname))); } return this_privileges; --- 304,365 ---- if (is_grant) { if (this_privileges == 0) ! { ! if (objkind == ACL_KIND_COLUMN && colname) ! ereport(WARNING, ! (errcode(ERRCODE_WARNING_PRIVILEGE_NOT_GRANTED), ! errmsg("no privileges were granted for \"%s\", for column \"%s\"", ! objname, colname))); ! else ! ereport(WARNING, ! (errcode(ERRCODE_WARNING_PRIVILEGE_NOT_GRANTED), ! errmsg("no privileges were granted for \"%s\"", objname))); ! } ! else ! { ! if (!all_privs && this_privileges != privileges) ! { ! if (objkind == ACL_KIND_COLUMN && colname) ! ereport(WARNING, ! (errcode(ERRCODE_WARNING_PRIVILEGE_NOT_GRANTED), ! errmsg("not all privileges were granted for \"%s\", for column \"%s\"", ! objname, colname))); ! else ! ereport(WARNING, ! (errcode(ERRCODE_WARNING_PRIVILEGE_NOT_GRANTED), ! errmsg("not all privileges were granted for \"%s\"", objname))); ! } ! } } else { if (this_privileges == 0) ! { ! if (objkind == ACL_KIND_COLUMN && colname) ! ereport(WARNING, ! (errcode(ERRCODE_WARNING_PRIVILEGE_NOT_REVOKED), ! errmsg("no privileges could be revoked for \"%s\", for column \"%s\"", ! objname, colname))); ! else ! ereport(WARNING, ! (errcode(ERRCODE_WARNING_PRIVILEGE_NOT_REVOKED), ! errmsg("no privileges could be revoked for \"%s\"", objname))); ! } ! else ! { ! if (!all_privs && this_privileges != privileges) ! { ! if (objkind == ACL_KIND_COLUMN && colname) ! ereport(WARNING, ! (errcode(ERRCODE_WARNING_PRIVILEGE_NOT_REVOKED), ! errmsg("not all privileges could be revoked for \"%s\", for column \"%s\"", ! objname, colname))); ! else ! ereport(WARNING, ! (errcode(ERRCODE_WARNING_PRIVILEGE_NOT_REVOKED), ! errmsg("not all privileges could be revoked for \"%s\"", objname))); ! } ! } } return this_privileges;
signature.asc
Description: Digital signature