mirror of https://github.com/citusdata/citus.git
Disallow INSERT ... SELECT to pushdown joins on non-partition keys
With this commit, we disallow JOINs on non-partition keys. Simply, while instantiating the qual we check whether the qual is on the partition key.pull/1250/head
parent
681da71251
commit
fd8df25daf
|
@ -387,6 +387,7 @@ RouterModifyTaskForShardInterval(Query *originalQuery, ShardInterval *shardInter
|
||||||
List *originalBaserestrictInfo = restriction->relOptInfo->baserestrictinfo;
|
List *originalBaserestrictInfo = restriction->relOptInfo->baserestrictinfo;
|
||||||
InstantiateQualContext instantiateQualWalker;
|
InstantiateQualContext instantiateQualWalker;
|
||||||
Var *relationPartitionKey = PartitionKey(restriction->relationId);
|
Var *relationPartitionKey = PartitionKey(restriction->relationId);
|
||||||
|
Var *relationPartitionKey = PartitionKey(restriction->relationId);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We haven't added the quals if all participating tables are reference
|
* We haven't added the quals if all participating tables are reference
|
||||||
|
@ -3047,6 +3048,13 @@ InstantiatePartitionQualWalker(Node *node, void *context)
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* if the qual is not on the partition column, do not instantiate */
|
||||||
|
if (relationPartitionColumn && currentColumn &&
|
||||||
|
currentColumn->varattno != relationPartitionColumn->varattno)
|
||||||
|
{
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
/* get the integer >=, <= operators from the catalog */
|
/* get the integer >=, <= operators from the catalog */
|
||||||
integer4GEoperatorId = get_opfamily_member(INTEGER_BTREE_FAM_OID, INT4OID,
|
integer4GEoperatorId = get_opfamily_member(INTEGER_BTREE_FAM_OID, INT4OID,
|
||||||
INT4OID,
|
INT4OID,
|
||||||
|
|
Loading…
Reference in New Issue