diff --git a/src/backend/distributed/commands/create_distributed_table.c b/src/backend/distributed/commands/create_distributed_table.c index 8659758b0..2b56a134c 100644 --- a/src/backend/distributed/commands/create_distributed_table.c +++ b/src/backend/distributed/commands/create_distributed_table.c @@ -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); diff --git a/src/backend/distributed/master/master_metadata_utility.c b/src/backend/distributed/master/master_metadata_utility.c index ee1462c79..da176db4a 100644 --- a/src/backend/distributed/master/master_metadata_utility.c +++ b/src/backend/distributed/master/master_metadata_utility.c @@ -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; }