mirror of https://github.com/citusdata/citus.git
Again, permission check refactor, be careful with details, PG commit a61b1f74823c9c4f79c95226a461f1e7a367764b
parent
5205411e4d
commit
45259d2b87
|
@ -3190,6 +3190,10 @@ CheckCopyPermissions(CopyStmt *copyStatement)
|
||||||
RangeTblEntry *rte = (RangeTblEntry*) linitial(range_table);
|
RangeTblEntry *rte = (RangeTblEntry*) linitial(range_table);
|
||||||
tupDesc = RelationGetDescr(rel);
|
tupDesc = RelationGetDescr(rel);
|
||||||
|
|
||||||
|
RTEPermissionInfo *perminfo = (RTEPermissionInfo *) palloc(sizeof(RTEPermissionInfo));
|
||||||
|
perminfo->requiredPerms = required_access;
|
||||||
|
perminfo->relid = rel->rd_id;
|
||||||
|
|
||||||
attnums = CopyGetAttnums(tupDesc, rel, copyStatement->attlist);
|
attnums = CopyGetAttnums(tupDesc, rel, copyStatement->attlist);
|
||||||
foreach(cur, attnums)
|
foreach(cur, attnums)
|
||||||
{
|
{
|
||||||
|
@ -3197,15 +3201,15 @@ CheckCopyPermissions(CopyStmt *copyStatement)
|
||||||
|
|
||||||
if (is_from)
|
if (is_from)
|
||||||
{
|
{
|
||||||
rte->insertedCols = bms_add_member(rte->insertedCols, attno);
|
perminfo->insertedCols = bms_add_member(perminfo->insertedCols, attno);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rte->selectedCols = bms_add_member(rte->selectedCols, attno);
|
perminfo->selectedCols = bms_add_member(perminfo->selectedCols, attno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ExecCheckRTPerms(range_table, true);
|
ExecCheckPermissions(list_make1(rte), list_make1(perminfo), true);
|
||||||
|
|
||||||
/* TODO: Perform RLS checks once supported */
|
/* TODO: Perform RLS checks once supported */
|
||||||
|
|
||||||
|
@ -3224,7 +3228,6 @@ CreateRangeTable(Relation rel, AclMode requiredAccess)
|
||||||
rte->rtekind = RTE_RELATION;
|
rte->rtekind = RTE_RELATION;
|
||||||
rte->relid = rel->rd_id;
|
rte->relid = rel->rd_id;
|
||||||
rte->relkind = rel->rd_rel->relkind;
|
rte->relkind = rel->rd_rel->relkind;
|
||||||
rte->requiredPerms = requiredAccess;
|
|
||||||
return list_make1(rte);
|
return list_make1(rte);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue