@ -108,25 +108,25 @@ RangeVarCallbackForPolicy(const RangeVar *rv, Oid relid, Oid oldrelid,
static char
static char
parse_policy_command ( const char * cmd_name )
parse_policy_command ( const char * cmd_name )
{
{
char cmd ;
char pol cmd;
if ( ! cmd_name )
if ( ! cmd_name )
elog ( ERROR , " unrecognized policy command " ) ;
elog ( ERROR , " unrecognized policy command " ) ;
if ( strcmp ( cmd_name , " all " ) = = 0 )
if ( strcmp ( cmd_name , " all " ) = = 0 )
cmd = ' * ' ;
pol cmd = ' * ' ;
else if ( strcmp ( cmd_name , " select " ) = = 0 )
else if ( strcmp ( cmd_name , " select " ) = = 0 )
cmd = ACL_SELECT_CHR ;
pol cmd = ACL_SELECT_CHR ;
else if ( strcmp ( cmd_name , " insert " ) = = 0 )
else if ( strcmp ( cmd_name , " insert " ) = = 0 )
cmd = ACL_INSERT_CHR ;
pol cmd = ACL_INSERT_CHR ;
else if ( strcmp ( cmd_name , " update " ) = = 0 )
else if ( strcmp ( cmd_name , " update " ) = = 0 )
cmd = ACL_UPDATE_CHR ;
pol cmd = ACL_UPDATE_CHR ;
else if ( strcmp ( cmd_name , " delete " ) = = 0 )
else if ( strcmp ( cmd_name , " delete " ) = = 0 )
cmd = ACL_DELETE_CHR ;
pol cmd = ACL_DELETE_CHR ;
else
else
elog ( ERROR , " unrecognized policy command " ) ;
elog ( ERROR , " unrecognized policy command " ) ;
return cmd ;
return pol cmd;
}
}
/*
/*
@ -480,7 +480,7 @@ CreatePolicy(CreatePolicyStmt *stmt)
int i ;
int i ;
/* Parse command */
/* Parse command */
polcmd = parse_policy_command ( stmt - > cmd ) ;
polcmd = parse_policy_command ( stmt - > cmd_name ) ;
/*
/*
* If the command is SELECT or DELETE then WITH CHECK should be NULL .
* If the command is SELECT or DELETE then WITH CHECK should be NULL .
@ -674,7 +674,7 @@ AlterPolicy(AlterPolicyStmt *stmt)
bool replaces [ Natts_pg_policy ] ;
bool replaces [ Natts_pg_policy ] ;
ObjectAddress target ;
ObjectAddress target ;
ObjectAddress myself ;
ObjectAddress myself ;
Datum cmd_datum ;
Datum pol cmd_datum;
char polcmd ;
char polcmd ;
bool polcmd_isnull ;
bool polcmd_isnull ;
int i ;
int i ;
@ -775,11 +775,11 @@ AlterPolicy(AlterPolicyStmt *stmt)
RelationGetRelationName ( target_table ) ) ) ) ;
RelationGetRelationName ( target_table ) ) ) ) ;
/* Get policy command */
/* Get policy command */
cmd_datum = heap_getattr ( policy_tuple , Anum_pg_policy_polcmd ,
pol cmd_datum = heap_getattr ( policy_tuple , Anum_pg_policy_polcmd ,
RelationGetDescr ( pg_policy_rel ) ,
RelationGetDescr ( pg_policy_rel ) ,
& polcmd_isnull ) ;
& polcmd_isnull ) ;
Assert ( ! polcmd_isnull ) ;
Assert ( ! polcmd_isnull ) ;
polcmd = DatumGetChar ( cmd_datum ) ;
polcmd = DatumGetChar ( pol cmd_datum) ;
/*
/*
* If the command is SELECT or DELETE then WITH CHECK should be NULL .
* If the command is SELECT or DELETE then WITH CHECK should be NULL .