@ -547,7 +547,6 @@ ExecCheckRTEPerms(RangeTblEntry *rte)
AclMode remainingPerms ;
AclMode remainingPerms ;
Oid relOid ;
Oid relOid ;
Oid userid ;
Oid userid ;
Bitmapset * tmpset ;
int col ;
int col ;
/*
/*
@ -614,12 +613,13 @@ ExecCheckRTEPerms(RangeTblEntry *rte)
return false ;
return false ;
}
}
tmpset = bms_copy ( rte - > selectedCols ) ;
col = - 1 ;
while ( ( col = bms_first_member ( tmpset ) ) > = 0 )
while ( ( col = bms_next_member ( rte - > selectedCols , col ) ) > = 0 )
{
{
/* remove the column number offset */
/* bit #s are offset by FirstLowInvalidHeapAttributeNumber */
col + = FirstLowInvalidHeapAttributeNumber ;
AttrNumber attno = col + FirstLowInvalidHeapAttributeNumber ;
if ( col = = InvalidAttrNumber )
if ( attno = = InvalidAttrNumber )
{
{
/* Whole-row reference, must have priv on all cols */
/* Whole-row reference, must have priv on all cols */
if ( pg_attribute_aclcheck_all ( relOid , userid , ACL_SELECT ,
if ( pg_attribute_aclcheck_all ( relOid , userid , ACL_SELECT ,
@ -628,12 +628,11 @@ ExecCheckRTEPerms(RangeTblEntry *rte)
}
}
else
else
{
{
if ( pg_attribute_aclcheck ( relOid , col , userid ,
if ( pg_attribute_aclcheck ( relOid , attno , userid ,
ACL_SELECT ) ! = ACLCHECK_OK )
ACL_SELECT ) ! = ACLCHECK_OK )
return false ;
return false ;
}
}
}
}
bms_free ( tmpset ) ;
}
}
/*
/*
@ -656,24 +655,24 @@ ExecCheckRTEPerms(RangeTblEntry *rte)
return false ;
return false ;
}
}
tmpset = bms_copy ( rte - > modifiedCols ) ;
col = - 1 ;
while ( ( col = bms_first_member ( tmpset ) ) > = 0 )
while ( ( col = bms_next_member ( rte - > modifiedCols , col ) ) > = 0 )
{
{
/* remove the column number offset */
/* bit #s are offset by FirstLowInvalidHeapAttributeNumber */
col + = FirstLowInvalidHeapAttributeNumber ;
AttrNumber attno = col + FirstLowInvalidHeapAttributeNumber ;
if ( col = = InvalidAttrNumber )
if ( attno = = InvalidAttrNumber )
{
{
/* whole-row reference can't happen here */
/* whole-row reference can't happen here */
elog ( ERROR , " whole-row update is not implemented " ) ;
elog ( ERROR , " whole-row update is not implemented " ) ;
}
}
else
else
{
{
if ( pg_attribute_aclcheck ( relOid , col , userid ,
if ( pg_attribute_aclcheck ( relOid , attno , userid ,
remainingPerms ) ! = ACLCHECK_OK )
remainingPerms ) ! = ACLCHECK_OK )
return false ;
return false ;
}
}
}
}
bms_free ( tmpset ) ;
}
}
}
}
return true ;
return true ;