mirror of https://github.com/citusdata/citus.git
Fix the bug by adding comma before the values
parent
b576e69260
commit
e3446692f3
|
@ -923,6 +923,7 @@ ShardListInsertCommand(List *shardIntervalList)
|
||||||
"shardlength, groupid, placementid) AS (VALUES ");
|
"shardlength, groupid, placementid) AS (VALUES ");
|
||||||
|
|
||||||
ShardInterval *shardInterval = NULL;
|
ShardInterval *shardInterval = NULL;
|
||||||
|
bool isFirstValue = true;
|
||||||
foreach_ptr(shardInterval, shardIntervalList)
|
foreach_ptr(shardInterval, shardIntervalList)
|
||||||
{
|
{
|
||||||
uint64 shardId = shardInterval->shardId;
|
uint64 shardId = shardInterval->shardId;
|
||||||
|
@ -931,6 +932,16 @@ ShardListInsertCommand(List *shardIntervalList)
|
||||||
ShardPlacement *placement = NULL;
|
ShardPlacement *placement = NULL;
|
||||||
foreach_ptr(placement, shardPlacementList)
|
foreach_ptr(placement, shardPlacementList)
|
||||||
{
|
{
|
||||||
|
if (!isFirstValue)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* As long as this is not the first placement of the first shard,
|
||||||
|
* append the comma.
|
||||||
|
*/
|
||||||
|
appendStringInfo(insertPlacementCommand, ", ");
|
||||||
|
}
|
||||||
|
isFirstValue = false;
|
||||||
|
|
||||||
appendStringInfo(insertPlacementCommand,
|
appendStringInfo(insertPlacementCommand,
|
||||||
"(%ld, %d, %ld, %d, %ld)",
|
"(%ld, %d, %ld, %d, %ld)",
|
||||||
shardId,
|
shardId,
|
||||||
|
@ -938,16 +949,6 @@ ShardListInsertCommand(List *shardIntervalList)
|
||||||
placement->shardLength,
|
placement->shardLength,
|
||||||
placement->groupId,
|
placement->groupId,
|
||||||
placement->placementId);
|
placement->placementId);
|
||||||
|
|
||||||
if (!(llast(shardPlacementList) == placement &&
|
|
||||||
llast(shardIntervalList) == shardInterval))
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* As long as this is not the last placement of the last shard,
|
|
||||||
* append the comma.
|
|
||||||
*/
|
|
||||||
appendStringInfo(insertPlacementCommand, ", ");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue