Fix node copy error

Instead of directly returning heap tuple obtained from heap scan
we return copied version of it.
pull/1938/head
Burak Yucesoy 2017-04-17 19:28:19 +03:00
parent 24eecde0cc
commit 5aefe20725
1 changed files with 4 additions and 1 deletions

View File

@ -639,6 +639,7 @@ GetNodeTuple(char *nodeName, int32 nodePort)
ScanKeyData scanKey[scanKeyCount];
SysScanDesc scanDescriptor = NULL;
HeapTuple heapTuple = NULL;
HeapTuple nodeTuple = NULL;
ScanKeyInit(&scanKey[0], Anum_pg_dist_node_nodename,
BTEqualStrategyNumber, F_TEXTEQ, CStringGetTextDatum(nodeName));
@ -654,10 +655,12 @@ GetNodeTuple(char *nodeName, int32 nodePort)
nodeName, nodePort)));
}
nodeTuple = heap_copytuple(heapTuple);
systable_endscan(scanDescriptor);
heap_close(pgDistNode, AccessShareLock);
return heapTuple;
return nodeTuple;
}