mirror of https://github.com/citusdata/citus.git
Fix access permission checks for distributed relations
With this commit, we add the range table list of the original query to our custom plan. Therefore, PostgreSQL can check relations in the original query for access permissions and error out if the proper access is not granted.pull/1281/head
parent
1fa2a25695
commit
b1ee7ec93e
|
@ -454,6 +454,9 @@ FinalizeNonRouterPlan(PlannedStmt *localPlan, MultiPlan *multiPlan,
|
||||||
finalPlan->queryId = localPlan->queryId;
|
finalPlan->queryId = localPlan->queryId;
|
||||||
finalPlan->utilityStmt = localPlan->utilityStmt;
|
finalPlan->utilityStmt = localPlan->utilityStmt;
|
||||||
|
|
||||||
|
/* add original range table list for access permission checks */
|
||||||
|
finalPlan->rtable = list_concat(finalPlan->rtable, localPlan->rtable);
|
||||||
|
|
||||||
return finalPlan;
|
return finalPlan;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -473,7 +476,7 @@ FinalizeRouterPlan(PlannedStmt *localPlan, CustomScan *customScan)
|
||||||
List *targetList = NIL;
|
List *targetList = NIL;
|
||||||
List *columnNameList = NIL;
|
List *columnNameList = NIL;
|
||||||
|
|
||||||
/* we will have only one range table entry */
|
/* we will have custom scan range table entry as the first one in the list */
|
||||||
int customScanRangeTableIndex = 1;
|
int customScanRangeTableIndex = 1;
|
||||||
|
|
||||||
/* build a targetlist to read from the custom scan output */
|
/* build a targetlist to read from the custom scan output */
|
||||||
|
@ -514,6 +517,9 @@ FinalizeRouterPlan(PlannedStmt *localPlan, CustomScan *customScan)
|
||||||
remoteScanRangeTableEntry = RemoteScanRangeTableEntry(columnNameList);
|
remoteScanRangeTableEntry = RemoteScanRangeTableEntry(columnNameList);
|
||||||
routerPlan->rtable = list_make1(remoteScanRangeTableEntry);
|
routerPlan->rtable = list_make1(remoteScanRangeTableEntry);
|
||||||
|
|
||||||
|
/* add original range table list for access permission checks */
|
||||||
|
routerPlan->rtable = list_concat(routerPlan->rtable, localPlan->rtable);
|
||||||
|
|
||||||
routerPlan->canSetTag = true;
|
routerPlan->canSetTag = true;
|
||||||
routerPlan->relationOids = NIL;
|
routerPlan->relationOids = NIL;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue