Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename foreach_ macros to foreach_declared_ macros #7700

Merged
merged 2 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/backend/columnar/columnar_customscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ ColumnarGetRelationInfoHook(PlannerInfo *root, Oid relationObjectId,

/* disable index-only scan */
IndexOptInfo *indexOptInfo = NULL;
foreach_ptr(indexOptInfo, rel->indexlist)
foreach_declared_ptr(indexOptInfo, rel->indexlist)
{
memset(indexOptInfo->canreturn, false, indexOptInfo->ncolumns * sizeof(bool));
}
Expand All @@ -381,7 +381,7 @@ RemovePathsByPredicate(RelOptInfo *rel, PathPredicate removePathPredicate)
List *filteredPathList = NIL;

Path *path = NULL;
foreach_ptr(path, rel->pathlist)
foreach_declared_ptr(path, rel->pathlist)
{
if (!removePathPredicate(path))
{
Expand Down Expand Up @@ -428,7 +428,7 @@ static void
CostColumnarPaths(PlannerInfo *root, RelOptInfo *rel, Oid relationId)
{
Path *path = NULL;
foreach_ptr(path, rel->pathlist)
foreach_declared_ptr(path, rel->pathlist)
{
if (IsA(path, IndexPath))
{
Expand Down Expand Up @@ -783,7 +783,7 @@ ExtractPushdownClause(PlannerInfo *root, RelOptInfo *rel, Node *node)
List *pushdownableArgs = NIL;

Node *boolExprArg = NULL;
foreach_ptr(boolExprArg, boolExpr->args)
foreach_declared_ptr(boolExprArg, boolExpr->args)
{
Expr *pushdownableArg = ExtractPushdownClause(root, rel,
(Node *) boolExprArg);
Expand Down Expand Up @@ -1550,7 +1550,7 @@ ColumnarPerStripeScanCost(RelOptInfo *rel, Oid relationId, int numberOfColumnsRe
uint32 maxColumnCount = 0;
uint64 totalStripeSize = 0;
StripeMetadata *stripeMetadata = NULL;
foreach_ptr(stripeMetadata, stripeList)
foreach_declared_ptr(stripeMetadata, stripeList)
{
totalStripeSize += stripeMetadata->dataLength;
maxColumnCount = Max(maxColumnCount, stripeMetadata->columnCount);
Expand Down
2 changes: 1 addition & 1 deletion src/backend/columnar/columnar_metadata.c
Original file line number Diff line number Diff line change
Expand Up @@ -2042,7 +2042,7 @@
List *stripeMetadataList = ReadDataFileStripeList(storageId,
GetTransactionSnapshot());
StripeMetadata *stripeMetadata = NULL;
foreach_ptr(stripeMetadata, stripeMetadataList)
foreach_declared_ptr(stripeMetadata, stripeMetadataList)

Check warning on line 2045 in src/backend/columnar/columnar_metadata.c

View check run for this annotation

Codecov / codecov/patch

src/backend/columnar/columnar_metadata.c#L2045

Added line #L2045 was not covered by tests
{
highestRowNumber = Max(highestRowNumber,
StripeGetHighestRowNumber(stripeMetadata));
Expand Down
4 changes: 2 additions & 2 deletions src/backend/columnar/columnar_reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ ReadChunkGroupNextRow(ChunkGroupReadState *chunkGroupReadState, Datum *columnVal
memset(columnNulls, true, sizeof(bool) * chunkGroupReadState->columnCount);

int attno;
foreach_int(attno, chunkGroupReadState->projectedColumnList)
foreach_declared_int(attno, chunkGroupReadState->projectedColumnList)
{
const ChunkData *chunkGroupData = chunkGroupReadState->chunkGroupData;
const int rowIndex = chunkGroupReadState->currentRow;
Expand Down Expand Up @@ -1489,7 +1489,7 @@ ProjectedColumnMask(uint32 columnCount, List *projectedColumnList)
bool *projectedColumnMask = palloc0(columnCount * sizeof(bool));
int attno;

foreach_int(attno, projectedColumnList)
foreach_declared_int(attno, projectedColumnList)
{
/* attno is 1-indexed; projectedColumnMask is 0-indexed */
int columnIndex = attno - 1;
Expand Down
2 changes: 1 addition & 1 deletion src/backend/columnar/columnar_tableam.c
Original file line number Diff line number Diff line change
Expand Up @@ -3083,7 +3083,7 @@
GetExtensionOption(List *extensionOptions, const char *defname)
{
DefElem *defElement = NULL;
foreach_ptr(defElement, extensionOptions)
foreach_declared_ptr(defElement, extensionOptions)

Check warning on line 3086 in src/backend/columnar/columnar_tableam.c

View check run for this annotation

Codecov / codecov/patch

src/backend/columnar/columnar_tableam.c#L3086

Added line #L3086 was not covered by tests
{
if (IsA(defElement, DefElem) &&
strncmp(defElement->defname, defname, NAMEDATALEN) == 0)
Expand Down
4 changes: 2 additions & 2 deletions src/backend/distributed/clock/causal_clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ GetHighestClockInTransaction(List *nodeConnectionList)
{
MultiConnection *connection = NULL;

foreach_ptr(connection, nodeConnectionList)
foreach_declared_ptr(connection, nodeConnectionList)
{
int querySent =
SendRemoteCommand(connection, "SELECT citus_get_node_clock();");
Expand All @@ -349,7 +349,7 @@ GetHighestClockInTransaction(List *nodeConnectionList)
globalClockValue->counter)));

/* fetch the results and pick the highest clock value of all the nodes */
foreach_ptr(connection, nodeConnectionList)
foreach_declared_ptr(connection, nodeConnectionList)
{
bool raiseInterrupts = true;

Expand Down
36 changes: 18 additions & 18 deletions src/backend/distributed/commands/alter_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ UndistributeTables(List *relationIdList)
*/
List *originalForeignKeyRecreationCommands = NIL;
Oid relationId = InvalidOid;
foreach_oid(relationId, relationIdList)
foreach_declared_oid(relationId, relationIdList)
{
List *fkeyCommandsForRelation =
GetFKeyCreationCommandsRelationInvolvedWithTableType(relationId,
Expand Down Expand Up @@ -803,7 +803,7 @@ ConvertTableInternal(TableConversionState *con)
List *partitionList = PartitionList(con->relationId);

Oid partitionRelationId = InvalidOid;
foreach_oid(partitionRelationId, partitionList)
foreach_declared_oid(partitionRelationId, partitionList)
{
char *tableQualifiedName = generate_qualified_relation_name(
partitionRelationId);
Expand Down Expand Up @@ -876,7 +876,7 @@ ConvertTableInternal(TableConversionState *con)
}

TableDDLCommand *tableCreationCommand = NULL;
foreach_ptr(tableCreationCommand, preLoadCommands)
foreach_declared_ptr(tableCreationCommand, preLoadCommands)
{
Assert(CitusIsA(tableCreationCommand, TableDDLCommand));

Expand Down Expand Up @@ -950,7 +950,7 @@ ConvertTableInternal(TableConversionState *con)
con->suppressNoticeMessages);

TableDDLCommand *tableConstructionCommand = NULL;
foreach_ptr(tableConstructionCommand, postLoadCommands)
foreach_declared_ptr(tableConstructionCommand, postLoadCommands)
{
Assert(CitusIsA(tableConstructionCommand, TableDDLCommand));
char *tableConstructionSQL = GetTableDDLCommand(tableConstructionCommand);
Expand All @@ -968,7 +968,7 @@ ConvertTableInternal(TableConversionState *con)
MemoryContext oldContext = MemoryContextSwitchTo(citusPerPartitionContext);

char *attachPartitionCommand = NULL;
foreach_ptr(attachPartitionCommand, attachPartitionCommands)
foreach_declared_ptr(attachPartitionCommand, attachPartitionCommands)
{
MemoryContextReset(citusPerPartitionContext);

Expand All @@ -993,7 +993,7 @@ ConvertTableInternal(TableConversionState *con)

/* For now we only support cascade to colocation for alter_distributed_table UDF */
Assert(con->conversionType == ALTER_DISTRIBUTED_TABLE);
foreach_oid(colocatedTableId, con->colocatedTableList)
foreach_declared_oid(colocatedTableId, con->colocatedTableList)
{
if (colocatedTableId == con->relationId)
{
Expand Down Expand Up @@ -1023,7 +1023,7 @@ ConvertTableInternal(TableConversionState *con)
if (con->cascadeToColocated != CASCADE_TO_COLOCATED_NO_ALREADY_CASCADED)
{
char *foreignKeyCommand = NULL;
foreach_ptr(foreignKeyCommand, foreignKeyCommands)
foreach_declared_ptr(foreignKeyCommand, foreignKeyCommands)
{
ExecuteQueryViaSPI(foreignKeyCommand, SPI_OK_UTILITY);
}
Expand Down Expand Up @@ -1059,7 +1059,7 @@ CopyTableConversionReturnIntoCurrentContext(TableConversionReturn *tableConversi
tableConversionReturnCopy = palloc0(sizeof(TableConversionReturn));
List *copyForeignKeyCommands = NIL;
char *foreignKeyCommand = NULL;
foreach_ptr(foreignKeyCommand, tableConversionReturn->foreignKeyCommands)
foreach_declared_ptr(foreignKeyCommand, tableConversionReturn->foreignKeyCommands)
{
char *copyForeignKeyCommand = MemoryContextStrdup(CurrentMemoryContext,
foreignKeyCommand);
Expand Down Expand Up @@ -1134,7 +1134,7 @@ DropIndexesNotSupportedByColumnar(Oid relationId, bool suppressNoticeMessages)
RelationClose(columnarRelation);

Oid indexId = InvalidOid;
foreach_oid(indexId, indexIdList)
foreach_declared_oid(indexId, indexIdList)
{
char *indexAmName = GetIndexAccessMethodName(indexId);
if (extern_ColumnarSupportsIndexAM(indexAmName))
Expand Down Expand Up @@ -1394,7 +1394,7 @@ CreateTableConversion(TableConversionParameters *params)
* since they will be handled separately.
*/
Oid colocatedTableId = InvalidOid;
foreach_oid(colocatedTableId, colocatedTableList)
foreach_declared_oid(colocatedTableId, colocatedTableList)
{
if (PartitionTable(colocatedTableId))
{
Expand Down Expand Up @@ -1610,7 +1610,7 @@ DoesCascadeDropUnsupportedObject(Oid classId, Oid objectId, HTAB *nodeMap)
targetObjectId);

HeapTuple depTup = NULL;
foreach_ptr(depTup, dependencyTupleList)
foreach_declared_ptr(depTup, dependencyTupleList)
{
Form_pg_depend pg_depend = (Form_pg_depend) GETSTRUCT(depTup);

Expand Down Expand Up @@ -1650,7 +1650,7 @@ GetViewCreationCommandsOfTable(Oid relationId)
List *commands = NIL;

Oid viewOid = InvalidOid;
foreach_oid(viewOid, views)
foreach_declared_oid(viewOid, views)
{
StringInfo query = makeStringInfo();

Expand Down Expand Up @@ -1688,7 +1688,7 @@ WrapTableDDLCommands(List *commandStrings)
List *tableDDLCommands = NIL;

char *command = NULL;
foreach_ptr(command, commandStrings)
foreach_declared_ptr(command, commandStrings)
{
tableDDLCommands = lappend(tableDDLCommands, makeTableDDLCommandString(command));
}
Expand Down Expand Up @@ -1851,7 +1851,7 @@ ReplaceTable(Oid sourceId, Oid targetId, List *justBeforeDropCommands,
*/
List *ownedSequences = getOwnedSequences_internal(sourceId, 0, DEPENDENCY_AUTO);
Oid sequenceOid = InvalidOid;
foreach_oid(sequenceOid, ownedSequences)
foreach_declared_oid(sequenceOid, ownedSequences)
{
changeDependencyFor(RelationRelationId, sequenceOid,
RelationRelationId, sourceId, targetId);
Expand Down Expand Up @@ -1887,7 +1887,7 @@ ReplaceTable(Oid sourceId, Oid targetId, List *justBeforeDropCommands,
}

char *justBeforeDropCommand = NULL;
foreach_ptr(justBeforeDropCommand, justBeforeDropCommands)
foreach_declared_ptr(justBeforeDropCommand, justBeforeDropCommands)
{
ExecuteQueryViaSPI(justBeforeDropCommand, SPI_OK_UTILITY);
}
Expand Down Expand Up @@ -2003,7 +2003,7 @@ CheckAlterDistributedTableConversionParameters(TableConversionState *con)
Oid colocatedTableOid = InvalidOid;
text *colocateWithText = cstring_to_text(con->colocateWith);
Oid colocateWithTableOid = ResolveRelationId(colocateWithText, false);
foreach_oid(colocatedTableOid, con->colocatedTableList)
foreach_declared_oid(colocatedTableOid, con->colocatedTableList)
{
if (colocateWithTableOid == colocatedTableOid)
{
Expand Down Expand Up @@ -2235,7 +2235,7 @@ WillRecreateForeignKeyToReferenceTable(Oid relationId,
{
List *colocatedTableList = ColocatedTableList(relationId);
Oid colocatedTableOid = InvalidOid;
foreach_oid(colocatedTableOid, colocatedTableList)
foreach_declared_oid(colocatedTableOid, colocatedTableList)
{
if (HasForeignKeyToReferenceTable(colocatedTableOid))
{
Expand Down Expand Up @@ -2263,7 +2263,7 @@ WarningsForDroppingForeignKeysWithDistributedTables(Oid relationId)
List *foreignKeys = list_concat(referencingForeingKeys, referencedForeignKeys);

Oid foreignKeyOid = InvalidOid;
foreach_oid(foreignKeyOid, foreignKeys)
foreach_declared_oid(foreignKeyOid, foreignKeys)
{
ereport(WARNING, (errmsg("foreign key %s will be dropped",
get_constraint_name(foreignKeyOid))));
Expand Down
2 changes: 1 addition & 1 deletion src/backend/distributed/commands/begin.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ SaveBeginCommandProperties(TransactionStmt *transactionStmt)
*
* While BEGIN can be quite frequent it will rarely have options set.
*/
foreach_ptr(item, transactionStmt->options)
foreach_declared_ptr(item, transactionStmt->options)
{
A_Const *constant = (A_Const *) item->arg;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ GetPartitionRelationIds(List *relationIdList)
List *partitionRelationIdList = NIL;

Oid relationId = InvalidOid;
foreach_oid(relationId, relationIdList)
foreach_declared_oid(relationId, relationIdList)
{
if (PartitionTable(relationId))
{
Expand All @@ -189,7 +189,7 @@ LockRelationsWithLockMode(List *relationIdList, LOCKMODE lockMode)
{
Oid relationId;
relationIdList = SortList(relationIdList, CompareOids);
foreach_oid(relationId, relationIdList)
foreach_declared_oid(relationId, relationIdList)
{
LockRelationOid(relationId, lockMode);
}
Expand All @@ -207,7 +207,7 @@ static void
ErrorIfConvertingMultiLevelPartitionedTable(List *relationIdList)
{
Oid relationId;
foreach_oid(relationId, relationIdList)
foreach_declared_oid(relationId, relationIdList)
{
if (PartitionedTable(relationId) && PartitionTable(relationId))
{
Expand Down Expand Up @@ -236,7 +236,7 @@ void
ErrorIfAnyPartitionRelationInvolvedInNonInheritedFKey(List *relationIdList)
{
Oid relationId = InvalidOid;
foreach_oid(relationId, relationIdList)
foreach_declared_oid(relationId, relationIdList)
{
if (!PartitionTable(relationId))
{
Expand Down Expand Up @@ -300,7 +300,7 @@ bool
RelationIdListHasReferenceTable(List *relationIdList)
{
Oid relationId = InvalidOid;
foreach_oid(relationId, relationIdList)
foreach_declared_oid(relationId, relationIdList)
{
if (IsCitusTableType(relationId, REFERENCE_TABLE))
{
Expand All @@ -322,7 +322,7 @@ GetFKeyCreationCommandsForRelationIdList(List *relationIdList)
List *fKeyCreationCommands = NIL;

Oid relationId = InvalidOid;
foreach_oid(relationId, relationIdList)
foreach_declared_oid(relationId, relationIdList)
{
List *relationFKeyCreationCommands =
GetReferencingForeignConstaintCommands(relationId);
Expand All @@ -342,7 +342,7 @@ static void
DropRelationIdListForeignKeys(List *relationIdList, int fKeyFlags)
{
Oid relationId = InvalidOid;
foreach_oid(relationId, relationIdList)
foreach_declared_oid(relationId, relationIdList)
{
DropRelationForeignKeys(relationId, fKeyFlags);
}
Expand Down Expand Up @@ -399,7 +399,7 @@ GetRelationDropFkeyCommands(Oid relationId, int fKeyFlags)
List *relationFKeyIdList = GetForeignKeyOids(relationId, fKeyFlags);

Oid foreignKeyId;
foreach_oid(foreignKeyId, relationFKeyIdList)
foreach_declared_oid(foreignKeyId, relationFKeyIdList)
{
char *dropFkeyCascadeCommand = GetDropFkeyCascadeCommand(foreignKeyId);
dropFkeyCascadeCommandList = lappend(dropFkeyCascadeCommandList,
Expand Down Expand Up @@ -450,7 +450,7 @@ ExecuteCascadeOperationForRelationIdList(List *relationIdList,
cascadeOperationType)
{
Oid relationId = InvalidOid;
foreach_oid(relationId, relationIdList)
foreach_declared_oid(relationId, relationIdList)
{
/*
* The reason behind skipping certain table types in below loop is
Expand Down Expand Up @@ -531,7 +531,7 @@ ExecuteAndLogUtilityCommandListInTableTypeConversionViaSPI(List *utilityCommandL
PG_TRY();
{
char *utilityCommand = NULL;
foreach_ptr(utilityCommand, utilityCommandList)
foreach_declared_ptr(utilityCommand, utilityCommandList)
{
/*
* CREATE MATERIALIZED VIEW commands need to be parsed/transformed,
Expand Down Expand Up @@ -569,7 +569,7 @@ void
ExecuteAndLogUtilityCommandList(List *utilityCommandList)
{
char *utilityCommand = NULL;
foreach_ptr(utilityCommand, utilityCommandList)
foreach_declared_ptr(utilityCommand, utilityCommandList)
{
ExecuteAndLogUtilityCommand(utilityCommand);
}
Expand Down Expand Up @@ -597,7 +597,7 @@ void
ExecuteForeignKeyCreateCommandList(List *ddlCommandList, bool skip_validation)
{
char *ddlCommand = NULL;
foreach_ptr(ddlCommand, ddlCommandList)
foreach_declared_ptr(ddlCommand, ddlCommandList)
{
ExecuteForeignKeyCreateCommand(ddlCommand, skip_validation);
}
Expand Down
Loading
Loading