map_and_merge_partitions.diff
text/x-diff
Filename: map_and_merge_partitions.diff
Type: text/x-diff
Part: 1
Patch
Format: unified
| File | + | − |
|---|---|---|
| src/backend/catalog/partition.c | 0 | 0 |
diff --git a/src/backend/catalog/partition.c b/src/backend/catalog/partition.c
new file mode 100644
index eb35fab..aa9c70d
*** a/src/backend/catalog/partition.c
--- b/src/backend/catalog/partition.c
*************** partition_list_bounds_merge(int partnatt
*** 3110,3116 ****
--- 3110,3119 ----
*/
if (jointype == JOIN_INNER || jointype == JOIN_RIGHT ||
jointype == JOIN_SEMI)
+ {
merged_index = -1;
+ merged_datum = NULL;
+ }
else if (jointype == JOIN_LEFT || jointype == JOIN_FULL ||
jointype == JOIN_ANTI)
{
*************** partition_list_bounds_merge(int partnatt
*** 3140,3146 ****
--- 3143,3152 ----
*/
if (jointype == JOIN_INNER || jointype == JOIN_LEFT ||
jointype == JOIN_SEMI || jointype == JOIN_ANTI)
+ {
merged_index = -1;
+ merged_datum = NULL;
+ }
else if (jointype == JOIN_RIGHT || jointype == JOIN_FULL)
{
/*
*************** map_and_merge_partitions(int *partmap1,
*** 3334,3346 ****
/*
* If the given to partitions map to each other, find the corresponding
! * merged partition index .
*/
if (partmap1[index1] == index2 && partmap2[index2] == index1)
{
/*
! * If both the partitions are mapped to the same merged partition, get
! * the index of merged partition.
*/
if (mergemap1[index1] == mergemap2[index2])
{
--- 3340,3352 ----
/*
* If the given to partitions map to each other, find the corresponding
! * merged partition index.
*/
if (partmap1[index1] == index2 && partmap2[index2] == index1)
{
/*
! * If both the partitions are mapped to the same merged partition, or
! * neither maps at all yet, get the index of merged partition.
*/
if (mergemap1[index1] == mergemap2[index2])
{
*************** map_and_merge_partitions(int *partmap1,
*** 3352,3359 ****
*/
if (merged_index < 0)
{
! merged_index = *next_index;
! *next_index = *next_index + 1;
mergemap1[index1] = merged_index;
mergemap2[index2] = merged_index;
}
--- 3358,3364 ----
*/
if (merged_index < 0)
{
! merged_index = (*next_index)++;
mergemap1[index1] = merged_index;
mergemap2[index2] = merged_index;
}
*************** map_and_merge_partitions(int *partmap1,
*** 3366,3380 ****
* partitions map to the same merged partition.
*/
else if (mergemap1[index1] >= 0 && mergemap2[index2] < 0)
! {
! mergemap2[index2] = mergemap1[index1];
! merged_index = mergemap1[index1];
! }
else if (mergemap1[index1] < 0 && mergemap2[index2] >= 0)
! {
! mergemap1[index1] = mergemap2[index2];
! merged_index = mergemap2[index2];
! }
else
{
Assert(mergemap1[index1] != mergemap2[index2] &&
--- 3371,3379 ----
* partitions map to the same merged partition.
*/
else if (mergemap1[index1] >= 0 && mergemap2[index2] < 0)
! merged_index = mergemap2[index2] = mergemap1[index1];
else if (mergemap1[index1] < 0 && mergemap2[index2] >= 0)
! merged_index = mergemap1[index1] = mergemap2[index2];
else
{
Assert(mergemap1[index1] != mergemap2[index2] &&