@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $ PostgreSQL : pgsql / src / backend / commands / functioncmds . c , v 1.65 2005 / 08 / 01 04 : 03 : 55 tgl Exp $
* $ PostgreSQL : pgsql / src / backend / commands / functioncmds . c , v 1.66 2005 / 08 / 22 17 : 38 : 20 tgl Exp $
*
* DESCRIPTION
* These routines take the parse tree and pick out the
@ -894,6 +894,9 @@ AlterFunctionOwner(List *name, List *argtypes, Oid newOwnerId)
bool isNull ;
HeapTuple newtuple ;
/* Superusers can always do it */
if ( ! superuser ( ) )
{
/* Otherwise, must be owner of the existing object */
if ( ! pg_proc_ownercheck ( procOid , GetUserId ( ) ) )
aclcheck_error ( ACLCHECK_NOT_OWNER , ACL_KIND_PROC ,
@ -903,11 +906,13 @@ AlterFunctionOwner(List *name, List *argtypes, Oid newOwnerId)
check_is_member_of_role ( GetUserId ( ) , newOwnerId ) ;
/* New owner must have CREATE privilege on namespace */
aclresult = pg_namespace_aclcheck ( procForm - > pronamespace , newOwnerId ,
aclresult = pg_namespace_aclcheck ( procForm - > pronamespace ,
newOwnerId ,
ACL_CREATE ) ;
if ( aclresult ! = ACLCHECK_OK )
aclcheck_error ( aclresult , ACL_KIND_NAMESPACE ,
get_namespace_name ( procForm - > pronamespace ) ) ;
}
memset ( repl_null , ' ' , sizeof ( repl_null ) ) ;
memset ( repl_repl , ' ' , sizeof ( repl_repl ) ) ;