Thursday, August 7, 2008

[HACKERS] [PATCH] allow has_table_privilege(..., 'usage') on sequences

*** a/src/backend/utils/adt/acl.c
--- b/src/backend/utils/adt/acl.c
***************
*** 1558,1563 **** convert_table_priv_string(text *priv_type_text)
--- 1558,1568 ----
if (pg_strcasecmp(priv_type, "TRIGGER WITH GRANT OPTION") == 0)
return ACL_GRANT_OPTION_FOR(ACL_TRIGGER);

+ if (pg_strcasecmp(priv_type, "USAGE") == 0)
+ return ACL_USAGE;
+ if (pg_strcasecmp(priv_type, "USAGE WITH GRANT OPTION") == 0)
+ return ACL_GRANT_OPTION_FOR(ACL_USAGE);
+
if (pg_strcasecmp(priv_type, "RULE") == 0)
return 0; /* ignore old RULE privileges */
if (pg_strcasecmp(priv_type, "RULE WITH GRANT OPTION") == 0)
I just noticed, to my dismay, that has_table_privilege() does not allow
me to check for usage privileges on sequences. I suspect this may have
been an oversight. If so, the attached patch fixes it for me.

-- ams

No comments: