@ -1915,14 +1915,15 @@ has_table_privilege_name_id(PG_FUNCTION_ARGS)
Oid roleid ;
AclMode mode ;
AclResult aclresult ;
bool is_missing = false ;
roleid = get_role_oid_or_public ( NameStr ( * username ) ) ;
mode = convert_table_priv_string ( priv_type_text ) ;
if ( ! SearchSysCacheExists1 ( RELOID , ObjectIdGetDatum ( tableoid ) ) )
PG_RETURN_NULL ( ) ;
aclresult = pg_class_aclcheck_ext ( tableoid , roleid , mode , & is_missing ) ;
aclresult = pg_class_aclcheck ( tableoid , roleid , mode ) ;
if ( is_missing )
PG_RETURN_NULL ( ) ;
PG_RETURN_BOOL ( aclresult = = ACLCHECK_OK ) ;
}
@ -1941,14 +1942,15 @@ has_table_privilege_id(PG_FUNCTION_ARGS)
Oid roleid ;
AclMode mode ;
AclResult aclresult ;
bool is_missing = false ;
roleid = GetUserId ( ) ;
mode = convert_table_priv_string ( priv_type_text ) ;
if ( ! SearchSysCacheExists1 ( RELOID , ObjectIdGetDatum ( tableoid ) ) )
PG_RETURN_NULL ( ) ;
aclresult = pg_class_aclcheck_ext ( tableoid , roleid , mode , & is_missing ) ;
aclresult = pg_class_aclcheck ( tableoid , roleid , mode ) ;
if ( is_missing )
PG_RETURN_NULL ( ) ;
PG_RETURN_BOOL ( aclresult = = ACLCHECK_OK ) ;
}
@ -1989,13 +1991,14 @@ has_table_privilege_id_id(PG_FUNCTION_ARGS)
text * priv_type_text = PG_GETARG_TEXT_PP ( 2 ) ;
AclMode mode ;
AclResult aclresult ;
bool is_missing = false ;
mode = convert_table_priv_string ( priv_type_text ) ;
if ( ! SearchSysCacheExists1 ( RELOID , ObjectIdGetDatum ( tableoid ) ) )
PG_RETURN_NULL ( ) ;
aclresult = pg_class_aclcheck_ext ( tableoid , roleid , mode , & is_missing ) ;
aclresult = pg_class_aclcheck ( tableoid , roleid , mode ) ;
if ( is_missing )
PG_RETURN_NULL ( ) ;
PG_RETURN_BOOL ( aclresult = = ACLCHECK_OK ) ;
}
@ -2134,6 +2137,7 @@ has_sequence_privilege_name_id(PG_FUNCTION_ARGS)
AclMode mode ;
AclResult aclresult ;
char relkind ;
bool is_missing = false ;
roleid = get_role_oid_or_public ( NameStr ( * username ) ) ;
mode = convert_sequence_priv_string ( priv_type_text ) ;
@ -2146,7 +2150,10 @@ has_sequence_privilege_name_id(PG_FUNCTION_ARGS)
errmsg ( " \" %s \" is not a sequence " ,
get_rel_name ( sequenceoid ) ) ) ) ;
aclresult = pg_class_aclcheck ( sequenceoid , roleid , mode ) ;
aclresult = pg_class_aclcheck_ext ( sequenceoid , roleid , mode , & is_missing ) ;
if ( is_missing )
PG_RETURN_NULL ( ) ;
PG_RETURN_BOOL ( aclresult = = ACLCHECK_OK ) ;
}
@ -2166,6 +2173,7 @@ has_sequence_privilege_id(PG_FUNCTION_ARGS)
AclMode mode ;
AclResult aclresult ;
char relkind ;
bool is_missing = false ;
roleid = GetUserId ( ) ;
mode = convert_sequence_priv_string ( priv_type_text ) ;
@ -2178,7 +2186,10 @@ has_sequence_privilege_id(PG_FUNCTION_ARGS)
errmsg ( " \" %s \" is not a sequence " ,
get_rel_name ( sequenceoid ) ) ) ) ;
aclresult = pg_class_aclcheck ( sequenceoid , roleid , mode ) ;
aclresult = pg_class_aclcheck_ext ( sequenceoid , roleid , mode , & is_missing ) ;
if ( is_missing )
PG_RETURN_NULL ( ) ;
PG_RETURN_BOOL ( aclresult = = ACLCHECK_OK ) ;
}
@ -2225,6 +2236,7 @@ has_sequence_privilege_id_id(PG_FUNCTION_ARGS)
AclMode mode ;
AclResult aclresult ;
char relkind ;
bool is_missing = false ;
mode = convert_sequence_priv_string ( priv_type_text ) ;
relkind = get_rel_relkind ( sequenceoid ) ;
@ -2236,7 +2248,10 @@ has_sequence_privilege_id_id(PG_FUNCTION_ARGS)
errmsg ( " \" %s \" is not a sequence " ,
get_rel_name ( sequenceoid ) ) ) ) ;
aclresult = pg_class_aclcheck ( sequenceoid , roleid , mode ) ;
aclresult = pg_class_aclcheck_ext ( sequenceoid , roleid , mode , & is_missing ) ;
if ( is_missing )
PG_RETURN_NULL ( ) ;
PG_RETURN_BOOL ( aclresult = = ACLCHECK_OK ) ;
}
@ -2345,18 +2360,22 @@ has_any_column_privilege_name_id(PG_FUNCTION_ARGS)
Oid roleid ;
AclMode mode ;
AclResult aclresult ;
bool is_missing = false ;
roleid = get_role_oid_or_public ( NameStr ( * username ) ) ;
mode = convert_column_priv_string ( priv_type_text ) ;
if ( ! SearchSysCacheExists1 ( RELOID , ObjectIdGetDatum ( tableoid ) ) )
PG_RETURN_NULL ( ) ;
/* First check at table level, then examine each column if needed */
aclresult = pg_class_aclcheck ( tableoid , roleid , mode ) ;
aclresult = pg_class_aclcheck_ext ( tableoid , roleid , mode , & is_missing ) ;
if ( aclresult ! = ACLCHECK_OK )
aclresult = pg_attribute_aclcheck_all ( tableoid , roleid , mode ,
ACLMASK_ANY ) ;
{
if ( is_missing )
PG_RETURN_NULL ( ) ;
aclresult = pg_attribute_aclcheck_all_ext ( tableoid , roleid , mode ,
ACLMASK_ANY , & is_missing ) ;
if ( is_missing )
PG_RETURN_NULL ( ) ;
}
PG_RETURN_BOOL ( aclresult = = ACLCHECK_OK ) ;
}
@ -2375,18 +2394,22 @@ has_any_column_privilege_id(PG_FUNCTION_ARGS)
Oid roleid ;
AclMode mode ;
AclResult aclresult ;
bool is_missing = false ;
roleid = GetUserId ( ) ;
mode = convert_column_priv_string ( priv_type_text ) ;
if ( ! SearchSysCacheExists1 ( RELOID , ObjectIdGetDatum ( tableoid ) ) )
PG_RETURN_NULL ( ) ;
/* First check at table level, then examine each column if needed */
aclresult = pg_class_aclcheck ( tableoid , roleid , mode ) ;
aclresult = pg_class_aclcheck_ext ( tableoid , roleid , mode , & is_missing ) ;
if ( aclresult ! = ACLCHECK_OK )
aclresult = pg_attribute_aclcheck_all ( tableoid , roleid , mode ,
ACLMASK_ANY ) ;
{
if ( is_missing )
PG_RETURN_NULL ( ) ;
aclresult = pg_attribute_aclcheck_all_ext ( tableoid , roleid , mode ,
ACLMASK_ANY , & is_missing ) ;
if ( is_missing )
PG_RETURN_NULL ( ) ;
}
PG_RETURN_BOOL ( aclresult = = ACLCHECK_OK ) ;
}
@ -2431,17 +2454,21 @@ has_any_column_privilege_id_id(PG_FUNCTION_ARGS)
text * priv_type_text = PG_GETARG_TEXT_PP ( 2 ) ;
AclMode mode ;
AclResult aclresult ;
bool is_missing = false ;
mode = convert_column_priv_string ( priv_type_text ) ;
if ( ! SearchSysCacheExists1 ( RELOID , ObjectIdGetDatum ( tableoid ) ) )
PG_RETURN_NULL ( ) ;
/* First check at table level, then examine each column if needed */
aclresult = pg_class_aclcheck ( tableoid , roleid , mode ) ;
aclresult = pg_class_aclcheck_ext ( tableoid , roleid , mode , & is_missing ) ;
if ( aclresult ! = ACLCHECK_OK )
aclresult = pg_attribute_aclcheck_all ( tableoid , roleid , mode ,
ACLMASK_ANY ) ;
{
if ( is_missing )
PG_RETURN_NULL ( ) ;
aclresult = pg_attribute_aclcheck_all_ext ( tableoid , roleid , mode ,
ACLMASK_ANY , & is_missing ) ;
if ( is_missing )
PG_RETURN_NULL ( ) ;
}
PG_RETURN_BOOL ( aclresult = = ACLCHECK_OK ) ;
}
@ -2981,14 +3008,17 @@ has_database_privilege_name_id(PG_FUNCTION_ARGS)
Oid roleid ;
AclMode mode ;
AclResult aclresult ;
bool is_missing = false ;
roleid = get_role_oid_or_public ( NameStr ( * username ) ) ;
mode = convert_database_priv_string ( priv_type_text ) ;
if ( ! SearchSysCacheExists1 ( DATABASEOID , ObjectIdGetDatum ( databaseoid ) ) )
PG_RETURN_NULL ( ) ;
aclresult = object_aclcheck_ext ( DatabaseRelationId , databaseoid ,
roleid , mode ,
& is_missing ) ;
aclresult = object_aclcheck ( DatabaseRelationId , databaseoid , roleid , mode ) ;
if ( is_missing )
PG_RETURN_NULL ( ) ;
PG_RETURN_BOOL ( aclresult = = ACLCHECK_OK ) ;
}
@ -3007,14 +3037,17 @@ has_database_privilege_id(PG_FUNCTION_ARGS)
Oid roleid ;
AclMode mode ;
AclResult aclresult ;
bool is_missing = false ;
roleid = GetUserId ( ) ;
mode = convert_database_priv_string ( priv_type_text ) ;
if ( ! SearchSysCacheExists1 ( DATABASEOID , ObjectIdGetDatum ( databaseoid ) ) )
PG_RETURN_NULL ( ) ;
aclresult = object_aclcheck_ext ( DatabaseRelationId , databaseoid ,
roleid , mode ,
& is_missing ) ;
aclresult = object_aclcheck ( DatabaseRelationId , databaseoid , roleid , mode ) ;
if ( is_missing )
PG_RETURN_NULL ( ) ;
PG_RETURN_BOOL ( aclresult = = ACLCHECK_OK ) ;
}
@ -3055,13 +3088,16 @@ has_database_privilege_id_id(PG_FUNCTION_ARGS)
text * priv_type_text = PG_GETARG_TEXT_PP ( 2 ) ;
AclMode mode ;
AclResult aclresult ;
bool is_missing = false ;
mode = convert_database_priv_string ( priv_type_text ) ;
if ( ! SearchSysCacheExists1 ( DATABASEOID , ObjectIdGetDatum ( databaseoid ) ) )
PG_RETURN_NULL ( ) ;
aclresult = object_aclcheck_ext ( DatabaseRelationId , databaseoid ,
roleid , mode ,
& is_missing ) ;
aclresult = object_aclcheck ( DatabaseRelationId , databaseoid , roleid , mode ) ;
if ( is_missing )
PG_RETURN_NULL ( ) ;
PG_RETURN_BOOL ( aclresult = = ACLCHECK_OK ) ;
}
@ -3178,14 +3214,17 @@ has_foreign_data_wrapper_privilege_name_id(PG_FUNCTION_ARGS)
Oid roleid ;
AclMode mode ;
AclResult aclresult ;
bool is_missing = false ;
roleid = get_role_oid_or_public ( NameStr ( * username ) ) ;
mode = convert_foreign_data_wrapper_priv_string ( priv_type_text ) ;
if ( ! SearchSysCacheExists1 ( FOREIGNDATAWRAPPEROID , ObjectIdGetDatum ( fdwid ) ) )
PG_RETURN_NULL ( ) ;
aclresult = object_aclcheck_ext ( ForeignDataWrapperRelationId , fdwid ,
roleid , mode ,
& is_missing ) ;
aclresult = object_aclcheck ( ForeignDataWrapperRelationId , fdwid , roleid , mode ) ;
if ( is_missing )
PG_RETURN_NULL ( ) ;
PG_RETURN_BOOL ( aclresult = = ACLCHECK_OK ) ;
}
@ -3204,14 +3243,17 @@ has_foreign_data_wrapper_privilege_id(PG_FUNCTION_ARGS)
Oid roleid ;
AclMode mode ;
AclResult aclresult ;
bool is_missing = false ;
roleid = GetUserId ( ) ;
mode = convert_foreign_data_wrapper_priv_string ( priv_type_text ) ;
if ( ! SearchSysCacheExists1 ( FOREIGNDATAWRAPPEROID , ObjectIdGetDatum ( fdwid ) ) )
PG_RETURN_NULL ( ) ;
aclresult = object_aclcheck_ext ( ForeignDataWrapperRelationId , fdwid ,
roleid , mode ,
& is_missing ) ;
aclresult = object_aclcheck ( ForeignDataWrapperRelationId , fdwid , roleid , mode ) ;
if ( is_missing )
PG_RETURN_NULL ( ) ;
PG_RETURN_BOOL ( aclresult = = ACLCHECK_OK ) ;
}
@ -3252,13 +3294,16 @@ has_foreign_data_wrapper_privilege_id_id(PG_FUNCTION_ARGS)
text * priv_type_text = PG_GETARG_TEXT_PP ( 2 ) ;
AclMode mode ;
AclResult aclresult ;
bool is_missing = false ;
mode = convert_foreign_data_wrapper_priv_string ( priv_type_text ) ;
if ( ! SearchSysCacheExists1 ( FOREIGNDATAWRAPPEROID , ObjectIdGetDatum ( fdwid ) ) )
PG_RETURN_NULL ( ) ;
aclresult = object_aclcheck_ext ( ForeignDataWrapperRelationId , fdwid ,
roleid , mode ,
& is_missing ) ;
aclresult = object_aclcheck ( ForeignDataWrapperRelationId , fdwid , roleid , mode ) ;
if ( is_missing )
PG_RETURN_NULL ( ) ;
PG_RETURN_BOOL ( aclresult = = ACLCHECK_OK ) ;
}
@ -3369,14 +3414,17 @@ has_function_privilege_name_id(PG_FUNCTION_ARGS)
Oid roleid ;
AclMode mode ;
AclResult aclresult ;
bool is_missing = false ;
roleid = get_role_oid_or_public ( NameStr ( * username ) ) ;
mode = convert_function_priv_string ( priv_type_text ) ;
if ( ! SearchSysCacheExists1 ( PROCOID , ObjectIdGetDatum ( functionoid ) ) )
PG_RETURN_NULL ( ) ;
aclresult = object_aclcheck_ext ( ProcedureRelationId , functionoid ,
roleid , mode ,
& is_missing ) ;
aclresult = object_aclcheck ( ProcedureRelationId , functionoid , roleid , mode ) ;
if ( is_missing )
PG_RETURN_NULL ( ) ;
PG_RETURN_BOOL ( aclresult = = ACLCHECK_OK ) ;
}
@ -3395,14 +3443,17 @@ has_function_privilege_id(PG_FUNCTION_ARGS)
Oid roleid ;
AclMode mode ;
AclResult aclresult ;
bool is_missing = false ;
roleid = GetUserId ( ) ;
mode = convert_function_priv_string ( priv_type_text ) ;
if ( ! SearchSysCacheExists1 ( PROCOID , ObjectIdGetDatum ( functionoid ) ) )
PG_RETURN_NULL ( ) ;
aclresult = object_aclcheck_ext ( ProcedureRelationId , functionoid ,
roleid , mode ,
& is_missing ) ;
aclresult = object_aclcheck ( ProcedureRelationId , functionoid , roleid , mode ) ;
if ( is_missing )
PG_RETURN_NULL ( ) ;
PG_RETURN_BOOL ( aclresult = = ACLCHECK_OK ) ;
}
@ -3443,13 +3494,16 @@ has_function_privilege_id_id(PG_FUNCTION_ARGS)
text * priv_type_text = PG_GETARG_TEXT_PP ( 2 ) ;
AclMode mode ;
AclResult aclresult ;
bool is_missing = false ;
mode = convert_function_priv_string ( priv_type_text ) ;
if ( ! SearchSysCacheExists1 ( PROCOID , ObjectIdGetDatum ( functionoid ) ) )
PG_RETURN_NULL ( ) ;
aclresult = object_aclcheck_ext ( ProcedureRelationId , functionoid ,
roleid , mode ,
& is_missing ) ;
aclresult = object_aclcheck ( ProcedureRelationId , functionoid , roleid , mode ) ;
if ( is_missing )
PG_RETURN_NULL ( ) ;
PG_RETURN_BOOL ( aclresult = = ACLCHECK_OK ) ;
}
@ -3569,14 +3623,17 @@ has_language_privilege_name_id(PG_FUNCTION_ARGS)
Oid roleid ;
AclMode mode ;
AclResult aclresult ;
bool is_missing = false ;
roleid = get_role_oid_or_public ( NameStr ( * username ) ) ;
mode = convert_language_priv_string ( priv_type_text ) ;
if ( ! SearchSysCacheExists1 ( LANGOID , ObjectIdGetDatum ( languageoid ) ) )
PG_RETURN_NULL ( ) ;
aclresult = object_aclcheck_ext ( LanguageRelationId , languageoid ,
roleid , mode ,
& is_missing ) ;
aclresult = object_aclcheck ( LanguageRelationId , languageoid , roleid , mode ) ;
if ( is_missing )
PG_RETURN_NULL ( ) ;
PG_RETURN_BOOL ( aclresult = = ACLCHECK_OK ) ;
}
@ -3595,14 +3652,17 @@ has_language_privilege_id(PG_FUNCTION_ARGS)
Oid roleid ;
AclMode mode ;
AclResult aclresult ;
bool is_missing = false ;
roleid = GetUserId ( ) ;
mode = convert_language_priv_string ( priv_type_text ) ;
if ( ! SearchSysCacheExists1 ( LANGOID , ObjectIdGetDatum ( languageoid ) ) )
PG_RETURN_NULL ( ) ;
aclresult = object_aclcheck_ext ( LanguageRelationId , languageoid ,
roleid , mode ,
& is_missing ) ;
aclresult = object_aclcheck ( LanguageRelationId , languageoid , roleid , mode ) ;
if ( is_missing )
PG_RETURN_NULL ( ) ;
PG_RETURN_BOOL ( aclresult = = ACLCHECK_OK ) ;
}
@ -3643,13 +3703,16 @@ has_language_privilege_id_id(PG_FUNCTION_ARGS)
text * priv_type_text = PG_GETARG_TEXT_PP ( 2 ) ;
AclMode mode ;
AclResult aclresult ;
bool is_missing = false ;
mode = convert_language_priv_string ( priv_type_text ) ;
if ( ! SearchSysCacheExists1 ( LANGOID , ObjectIdGetDatum ( languageoid ) ) )
PG_RETURN_NULL ( ) ;
aclresult = object_aclcheck_ext ( LanguageRelationId , languageoid ,
roleid , mode ,
& is_missing ) ;
aclresult = object_aclcheck ( LanguageRelationId , languageoid , roleid , mode ) ;
if ( is_missing )
PG_RETURN_NULL ( ) ;
PG_RETURN_BOOL ( aclresult = = ACLCHECK_OK ) ;
}
@ -3760,14 +3823,17 @@ has_schema_privilege_name_id(PG_FUNCTION_ARGS)
Oid roleid ;
AclMode mode ;
AclResult aclresult ;
bool is_missing = false ;
roleid = get_role_oid_or_public ( NameStr ( * username ) ) ;
mode = convert_schema_priv_string ( priv_type_text ) ;
if ( ! SearchSysCacheExists1 ( NAMESPACEOID , ObjectIdGetDatum ( schemaoid ) ) )
PG_RETURN_NULL ( ) ;
aclresult = object_aclcheck_ext ( NamespaceRelationId , schemaoid ,
roleid , mode ,
& is_missing ) ;
aclresult = object_aclcheck ( NamespaceRelationId , schemaoid , roleid , mode ) ;
if ( is_missing )
PG_RETURN_NULL ( ) ;
PG_RETURN_BOOL ( aclresult = = ACLCHECK_OK ) ;
}
@ -3786,14 +3852,17 @@ has_schema_privilege_id(PG_FUNCTION_ARGS)
Oid roleid ;
AclMode mode ;
AclResult aclresult ;
bool is_missing = false ;
roleid = GetUserId ( ) ;
mode = convert_schema_priv_string ( priv_type_text ) ;
if ( ! SearchSysCacheExists1 ( NAMESPACEOID , ObjectIdGetDatum ( schemaoid ) ) )
PG_RETURN_NULL ( ) ;
aclresult = object_aclcheck_ext ( NamespaceRelationId , schemaoid ,
roleid , mode ,
& is_missing ) ;
aclresult = object_aclcheck ( NamespaceRelationId , schemaoid , roleid , mode ) ;
if ( is_missing )
PG_RETURN_NULL ( ) ;
PG_RETURN_BOOL ( aclresult = = ACLCHECK_OK ) ;
}
@ -3834,13 +3903,16 @@ has_schema_privilege_id_id(PG_FUNCTION_ARGS)
text * priv_type_text = PG_GETARG_TEXT_PP ( 2 ) ;
AclMode mode ;
AclResult aclresult ;
bool is_missing = false ;
mode = convert_schema_priv_string ( priv_type_text ) ;
if ( ! SearchSysCacheExists1 ( NAMESPACEOID , ObjectIdGetDatum ( schemaoid ) ) )
PG_RETURN_NULL ( ) ;
aclresult = object_aclcheck_ext ( NamespaceRelationId , schemaoid ,
roleid , mode ,
& is_missing ) ;
aclresult = object_aclcheck ( NamespaceRelationId , schemaoid , roleid , mode ) ;
if ( is_missing )
PG_RETURN_NULL ( ) ;
PG_RETURN_BOOL ( aclresult = = ACLCHECK_OK ) ;
}
@ -3953,14 +4025,17 @@ has_server_privilege_name_id(PG_FUNCTION_ARGS)
Oid roleid ;
AclMode mode ;
AclResult aclresult ;
bool is_missing = false ;
roleid = get_role_oid_or_public ( NameStr ( * username ) ) ;
mode = convert_server_priv_string ( priv_type_text ) ;
if ( ! SearchSysCacheExists1 ( FOREIGNSERVEROID , ObjectIdGetDatum ( serverid ) ) )
PG_RETURN_NULL ( ) ;
aclresult = object_aclcheck_ext ( ForeignServerRelationId , serverid ,
roleid , mode ,
& is_missing ) ;
aclresult = object_aclcheck ( ForeignServerRelationId , serverid , roleid , mode ) ;
if ( is_missing )
PG_RETURN_NULL ( ) ;
PG_RETURN_BOOL ( aclresult = = ACLCHECK_OK ) ;
}
@ -3979,14 +4054,17 @@ has_server_privilege_id(PG_FUNCTION_ARGS)
Oid roleid ;
AclMode mode ;
AclResult aclresult ;
bool is_missing = false ;
roleid = GetUserId ( ) ;
mode = convert_server_priv_string ( priv_type_text ) ;
if ( ! SearchSysCacheExists1 ( FOREIGNSERVEROID , ObjectIdGetDatum ( serverid ) ) )
PG_RETURN_NULL ( ) ;
aclresult = object_aclcheck_ext ( ForeignServerRelationId , serverid ,
roleid , mode ,
& is_missing ) ;
aclresult = object_aclcheck ( ForeignServerRelationId , serverid , roleid , mode ) ;
if ( is_missing )
PG_RETURN_NULL ( ) ;
PG_RETURN_BOOL ( aclresult = = ACLCHECK_OK ) ;
}
@ -4027,13 +4105,16 @@ has_server_privilege_id_id(PG_FUNCTION_ARGS)
text * priv_type_text = PG_GETARG_TEXT_PP ( 2 ) ;
AclMode mode ;
AclResult aclresult ;
bool is_missing = false ;
mode = convert_server_priv_string ( priv_type_text ) ;
if ( ! SearchSysCacheExists1 ( FOREIGNSERVEROID , ObjectIdGetDatum ( serverid ) ) )
PG_RETURN_NULL ( ) ;
aclresult = object_aclcheck_ext ( ForeignServerRelationId , serverid ,
roleid , mode ,
& is_missing ) ;
aclresult = object_aclcheck ( ForeignServerRelationId , serverid , roleid , mode ) ;
if ( is_missing )
PG_RETURN_NULL ( ) ;
PG_RETURN_BOOL ( aclresult = = ACLCHECK_OK ) ;
}
@ -4144,14 +4225,17 @@ has_tablespace_privilege_name_id(PG_FUNCTION_ARGS)
Oid roleid ;
AclMode mode ;
AclResult aclresult ;
bool is_missing = false ;
roleid = get_role_oid_or_public ( NameStr ( * username ) ) ;
mode = convert_tablespace_priv_string ( priv_type_text ) ;
if ( ! SearchSysCacheExists1 ( TABLESPACEOID , ObjectIdGetDatum ( tablespaceoid ) ) )
PG_RETURN_NULL ( ) ;
aclresult = object_aclcheck_ext ( TableSpaceRelationId , tablespaceoid ,
roleid , mode ,
& is_missing ) ;
aclresult = object_aclcheck ( TableSpaceRelationId , tablespaceoid , roleid , mode ) ;
if ( is_missing )
PG_RETURN_NULL ( ) ;
PG_RETURN_BOOL ( aclresult = = ACLCHECK_OK ) ;
}
@ -4170,14 +4254,17 @@ has_tablespace_privilege_id(PG_FUNCTION_ARGS)
Oid roleid ;
AclMode mode ;
AclResult aclresult ;
bool is_missing = false ;
roleid = GetUserId ( ) ;
mode = convert_tablespace_priv_string ( priv_type_text ) ;
if ( ! SearchSysCacheExists1 ( TABLESPACEOID , ObjectIdGetDatum ( tablespaceoid ) ) )
PG_RETURN_NULL ( ) ;
aclresult = object_aclcheck_ext ( TableSpaceRelationId , tablespaceoid ,
roleid , mode ,
& is_missing ) ;
aclresult = object_aclcheck ( TableSpaceRelationId , tablespaceoid , roleid , mode ) ;
if ( is_missing )
PG_RETURN_NULL ( ) ;
PG_RETURN_BOOL ( aclresult = = ACLCHECK_OK ) ;
}
@ -4218,13 +4305,16 @@ has_tablespace_privilege_id_id(PG_FUNCTION_ARGS)
text * priv_type_text = PG_GETARG_TEXT_PP ( 2 ) ;
AclMode mode ;
AclResult aclresult ;
bool is_missing = false ;
mode = convert_tablespace_priv_string ( priv_type_text ) ;
if ( ! SearchSysCacheExists1 ( TABLESPACEOID , ObjectIdGetDatum ( tablespaceoid ) ) )
PG_RETURN_NULL ( ) ;
aclresult = object_aclcheck_ext ( TableSpaceRelationId , tablespaceoid ,
roleid , mode ,
& is_missing ) ;
aclresult = object_aclcheck ( TableSpaceRelationId , tablespaceoid , roleid , mode ) ;
if ( is_missing )
PG_RETURN_NULL ( ) ;
PG_RETURN_BOOL ( aclresult = = ACLCHECK_OK ) ;
}
@ -4334,14 +4424,17 @@ has_type_privilege_name_id(PG_FUNCTION_ARGS)
Oid roleid ;
AclMode mode ;
AclResult aclresult ;
bool is_missing = false ;
roleid = get_role_oid_or_public ( NameStr ( * username ) ) ;
mode = convert_type_priv_string ( priv_type_text ) ;
if ( ! SearchSysCacheExists1 ( TYPEOID , ObjectIdGetDatum ( typeoid ) ) )
PG_RETURN_NULL ( ) ;
aclresult = object_aclcheck_ext ( TypeRelationId , typeoid ,
roleid , mode ,
& is_missing ) ;
aclresult = object_aclcheck ( TypeRelationId , typeoid , roleid , mode ) ;
if ( is_missing )
PG_RETURN_NULL ( ) ;
PG_RETURN_BOOL ( aclresult = = ACLCHECK_OK ) ;
}
@ -4360,14 +4453,17 @@ has_type_privilege_id(PG_FUNCTION_ARGS)
Oid roleid ;
AclMode mode ;
AclResult aclresult ;
bool is_missing = false ;
roleid = GetUserId ( ) ;
mode = convert_type_priv_string ( priv_type_text ) ;
if ( ! SearchSysCacheExists1 ( TYPEOID , ObjectIdGetDatum ( typeoid ) ) )
PG_RETURN_NULL ( ) ;
aclresult = object_aclcheck_ext ( TypeRelationId , typeoid ,
roleid , mode ,
& is_missing ) ;
aclresult = object_aclcheck ( TypeRelationId , typeoid , roleid , mode ) ;
if ( is_missing )
PG_RETURN_NULL ( ) ;
PG_RETURN_BOOL ( aclresult = = ACLCHECK_OK ) ;
}
@ -4408,13 +4504,16 @@ has_type_privilege_id_id(PG_FUNCTION_ARGS)
text * priv_type_text = PG_GETARG_TEXT_PP ( 2 ) ;
AclMode mode ;
AclResult aclresult ;
bool is_missing = false ;
mode = convert_type_priv_string ( priv_type_text ) ;
if ( ! SearchSysCacheExists1 ( TYPEOID , ObjectIdGetDatum ( typeoid ) ) )
PG_RETURN_NULL ( ) ;
aclresult = object_aclcheck_ext ( TypeRelationId , typeoid ,
roleid , mode ,
& is_missing ) ;
aclresult = object_aclcheck ( TypeRelationId , typeoid , roleid , mode ) ;
if ( is_missing )
PG_RETURN_NULL ( ) ;
PG_RETURN_BOOL ( aclresult = = ACLCHECK_OK ) ;
}