mirror of https://github.com/citusdata/citus.git
Conditionally read INT4 or INT8 from nodePort
parent
bceedcf2b1
commit
f4d5773f73
|
@ -291,8 +291,8 @@ master_create_distributed_table(PG_FUNCTION_ARGS)
|
|||
CharGetDatum(distributionMethod);
|
||||
newValues[Anum_pg_dist_partition_partkey - 1] =
|
||||
CStringGetTextDatum(distributionKeyString);
|
||||
newValues[Anum_pg_dist_partition_colocationid - 1] = Int64GetDatum(
|
||||
INVALID_COLOCATION_ID);
|
||||
newValues[Anum_pg_dist_partition_colocationid - 1] =
|
||||
Int64GetDatum(INVALID_COLOCATION_ID);
|
||||
newValues[Anum_pg_dist_partition_repmodel - 1] = CharGetDatum(replicationModel);
|
||||
|
||||
newTuple = heap_form_tuple(RelationGetDescr(pgDistPartition), newValues, newNulls);
|
||||
|
|
|
@ -325,6 +325,8 @@ TupleToShardPlacement(TupleDesc tupleDescriptor, HeapTuple heapTuple)
|
|||
{
|
||||
ShardPlacement *shardPlacement = NULL;
|
||||
bool isNull = false;
|
||||
Oid nodePortAttTypeId =
|
||||
tupleDescriptor->attrs[Anum_pg_dist_shard_placement_nodeport - 1]->atttypid;
|
||||
|
||||
Datum placementId = heap_getattr(heapTuple, Anum_pg_dist_shard_placement_placementid,
|
||||
tupleDescriptor, &isNull);
|
||||
|
@ -350,7 +352,14 @@ TupleToShardPlacement(TupleDesc tupleDescriptor, HeapTuple heapTuple)
|
|||
shardPlacement->shardLength = DatumGetInt64(shardLength);
|
||||
shardPlacement->shardState = DatumGetUInt32(shardState);
|
||||
shardPlacement->nodeName = TextDatumGetCString(nodeName);
|
||||
shardPlacement->nodePort = DatumGetInt32(nodePort);
|
||||
if (nodePortAttTypeId == INT4OID)
|
||||
{
|
||||
shardPlacement->nodePort = DatumGetInt32(nodePort);
|
||||
}
|
||||
else
|
||||
{
|
||||
shardPlacement->nodePort = DatumGetInt64(nodePort);
|
||||
}
|
||||
|
||||
return shardPlacement;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue