Only look in top-level rtable in ExtractFirstDistributedTableId

pull/2633/head
Marco Slot 2019-03-04 14:27:34 +01:00 committed by Onder Kalaci
parent ee6a0b6943
commit e8152d9b6d
1 changed files with 5 additions and 3 deletions

View File

@ -1543,16 +1543,18 @@ CreateTask(TaskType taskType)
* ExtractFirstDistributedTableId takes a given query, and finds the relationId
* for the first distributed table in that query. If the function cannot find a
* distributed table, it returns InvalidOid.
*
* We only use this function for modifications and fast path queries, which
* should have the first distributed table in the top-level rtable.
*/
Oid
ExtractFirstDistributedTableId(Query *query)
{
List *rangeTableList = NIL;
List *rangeTableList = query->rtable;
ListCell *rangeTableCell = NULL;
Oid distributedTableId = InvalidOid;
/* extract range table entries */
ExtractRangeTableEntryWalker((Node *) query, &rangeTableList);
Assert(IsModifyCommand(query) || FastPathRouterQuery(query));
foreach(rangeTableCell, rangeTableList)
{