revert example use where it was not applicable

feature/foreach_index
Nils Dijk 2021-11-03 16:38:49 +01:00
parent 4c15e0fbd5
commit 0a704da5fe
No known key found for this signature in database
GPG Key ID: CA1177EF9434F241
1 changed files with 3 additions and 1 deletions

View File

@ -921,6 +921,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;
@ -929,7 +930,7 @@ ShardListInsertCommand(List *shardIntervalList)
ShardPlacement *placement = NULL; ShardPlacement *placement = NULL;
foreach_ptr(placement, shardPlacementList) foreach_ptr(placement, shardPlacementList)
{ {
if (!foreach_first(shardInterval) || foreach_first(placement)) if (!isFirstValue)
{ {
/* /*
* As long as this is not the first placement of the first shard, * As long as this is not the first placement of the first shard,
@ -937,6 +938,7 @@ ShardListInsertCommand(List *shardIntervalList)
*/ */
appendStringInfo(insertPlacementCommand, ", "); appendStringInfo(insertPlacementCommand, ", ");
} }
isFirstValue = false;
appendStringInfo(insertPlacementCommand, appendStringInfo(insertPlacementCommand,
"(%ld, %d, %ld, %d, %ld)", "(%ld, %d, %ld, %d, %ld)",