From 15b1918e7d3532f0e4ec3455ae6ce45fae09c86f Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Fri, 15 Jun 2012 22:55:03 +0300 Subject: Improve reporting of permission errors for array types Because permissions are assigned to element types, not array types, complaining about permission denied on an array type would be misleading to users. So adjust the reporting to refer to the element type instead. In order not to duplicate the required logic in two dozen places, refactor the permission denied reporting for types a bit. pointed out by Yeb Havinga during the review of the type privilege feature --- src/backend/commands/operatorcmds.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/backend/commands/operatorcmds.c') diff --git a/src/backend/commands/operatorcmds.c b/src/backend/commands/operatorcmds.c index afae5e406e8..410c708975f 100644 --- a/src/backend/commands/operatorcmds.c +++ b/src/backend/commands/operatorcmds.c @@ -181,16 +181,14 @@ DefineOperator(List *names, List *parameters) { aclresult = pg_type_aclcheck(typeId1, GetUserId(), ACL_USAGE); if (aclresult != ACLCHECK_OK) - aclcheck_error(aclresult, ACL_KIND_TYPE, - format_type_be(typeId1)); + aclcheck_error_type(aclresult, typeId1); } if (typeName2) { aclresult = pg_type_aclcheck(typeId2, GetUserId(), ACL_USAGE); if (aclresult != ACLCHECK_OK) - aclcheck_error(aclresult, ACL_KIND_TYPE, - format_type_be(typeId2)); + aclcheck_error_type(aclresult, typeId2); } /* @@ -227,8 +225,7 @@ DefineOperator(List *names, List *parameters) rettype = get_func_rettype(functionOid); aclresult = pg_type_aclcheck(rettype, GetUserId(), ACL_USAGE); if (aclresult != ACLCHECK_OK) - aclcheck_error(aclresult, ACL_KIND_TYPE, - format_type_be(rettype)); + aclcheck_error_type(aclresult, rettype); /* * Look up restriction estimator if specified -- cgit v1.2.3