Use new var field names in the codebase

The codebase is updated to use varattnosync and varnosyn and we defined
the macros for older versions. This way we can just remove the macros
when we drop an older version.
pull/3900/head
Sait Talha Nisanci 2020-07-24 13:17:17 +03:00
parent b641f63bfd
commit 8e9b52971c
7 changed files with 20 additions and 20 deletions

View File

@ -93,7 +93,7 @@ RemoteScanTargetList(List *workerTargetList)
Var *remoteScanColumn = makeVarFromTargetEntry(tableId, workerTargetEntry); Var *remoteScanColumn = makeVarFromTargetEntry(tableId, workerTargetEntry);
remoteScanColumn->varattno = columnId; remoteScanColumn->varattno = columnId;
remoteScanColumn->varoattno = columnId; remoteScanColumn->varattnosyn = columnId;
columnId++; columnId++;
if (remoteScanColumn->vartype == RECORDOID || remoteScanColumn->vartype == if (remoteScanColumn->vartype == RECORDOID || remoteScanColumn->vartype ==

View File

@ -514,7 +514,7 @@ CreateTargetListForCombineQuery(List *targetList)
Var *column = makeVarFromTargetEntry(masterTableId, originalTargetEntry); Var *column = makeVarFromTargetEntry(masterTableId, originalTargetEntry);
column->varattno = columnId; column->varattno = columnId;
column->varoattno = columnId; column->varattnosyn = columnId;
columnId++; columnId++;
if (column->vartype == RECORDOID || column->vartype == RECORDARRAYOID) if (column->vartype == RECORDOID || column->vartype == RECORDARRAYOID)

View File

@ -1365,7 +1365,7 @@ PartitionColumn(Oid relationId, uint32 rangeTableId)
partitionColumn = partitionKey; partitionColumn = partitionKey;
partitionColumn->varno = rangeTableId; partitionColumn->varno = rangeTableId;
partitionColumn->varnoold = rangeTableId; partitionColumn->varnosyn = rangeTableId;
return partitionColumn; return partitionColumn;
} }

View File

@ -1438,7 +1438,7 @@ MasterExtendedOpNode(MultiExtendedOp *originalOpNode,
*/ */
Var *column = makeVarFromTargetEntry(masterTableId, originalTargetEntry); Var *column = makeVarFromTargetEntry(masterTableId, originalTargetEntry);
column->varattno = walkerContext.columnId; column->varattno = walkerContext.columnId;
column->varoattno = walkerContext.columnId; column->varattnosyn = walkerContext.columnId;
walkerContext.columnId++; walkerContext.columnId++;
if (column->vartype == RECORDOID || column->vartype == RECORDARRAYOID) if (column->vartype == RECORDOID || column->vartype == RECORDARRAYOID)
@ -1673,9 +1673,9 @@ MasterAggregateExpression(Aggref *originalAggregate,
} }
columnToUpdate->varno = masterTableId; columnToUpdate->varno = masterTableId;
columnToUpdate->varnoold = masterTableId; columnToUpdate->varnosyn = masterTableId;
columnToUpdate->varattno = startColumnCount + columnIndex; columnToUpdate->varattno = startColumnCount + columnIndex;
columnToUpdate->varoattno = startColumnCount + columnIndex; columnToUpdate->varattnosyn = startColumnCount + columnIndex;
} }
/* we added that many columns */ /* we added that many columns */

View File

@ -1086,8 +1086,8 @@ QueryJoinTree(MultiNode *multiNode, List *dependentJobList, List **rangeTableLis
UpdateColumnAttributes(column, *rangeTableList, dependentJobList); UpdateColumnAttributes(column, *rangeTableList, dependentJobList);
/* adjust our column old attributes for partition pruning to work */ /* adjust our column old attributes for partition pruning to work */
column->varnoold = column->varno; column->varnosyn = column->varno;
column->varoattno = column->varattno; column->varattnosyn = column->varattno;
} }
/* make AND clauses explicit after fixing them */ /* make AND clauses explicit after fixing them */
@ -1561,8 +1561,8 @@ UpdateAllColumnAttributes(Node *columnContainer, List *rangeTableList,
static void static void
UpdateColumnAttributes(Var *column, List *rangeTableList, List *dependentJobList) UpdateColumnAttributes(Var *column, List *rangeTableList, List *dependentJobList)
{ {
Index originalTableId = column->varnoold; Index originalTableId = column->varnosyn;
AttrNumber originalColumnId = column->varoattno; AttrNumber originalColumnId = column->varattnosyn;
/* find the new table identifier */ /* find the new table identifier */
Index newTableId = NewTableId(originalTableId, rangeTableList); Index newTableId = NewTableId(originalTableId, rangeTableList);
@ -1646,8 +1646,8 @@ NewColumnId(Index originalTableId, AttrNumber originalColumnId,
* Check against the *old* values for this column, as the new values * Check against the *old* values for this column, as the new values
* would have been updated already. * would have been updated already.
*/ */
if (column->varnoold == originalTableId && if (column->varnosyn == originalTableId &&
column->varoattno == originalColumnId) column->varattnosyn == originalColumnId)
{ {
newColumnId = columnIndex; newColumnId = columnIndex;
break; break;
@ -2977,8 +2977,8 @@ AnchorRangeTableIdList(List *rangeTableList, List *baseRangeTableIdList)
/* /*
* AdjustColumnOldAttributes adjust the old tableId (varnoold) and old columnId * AdjustColumnOldAttributes adjust the old tableId (varnosyn) and old columnId
* (varoattno), and sets them equal to the new values. We need this adjustment * (varattnosyn), and sets them equal to the new values. We need this adjustment
* for partition pruning where we compare these columns with partition columns * for partition pruning where we compare these columns with partition columns
* loaded from system catalogs. Since columns loaded from system catalogs always * loaded from system catalogs. Since columns loaded from system catalogs always
* have the same old and new values, we also need to adjust column values here. * have the same old and new values, we also need to adjust column values here.
@ -2992,8 +2992,8 @@ AdjustColumnOldAttributes(List *expressionList)
foreach(columnCell, columnList) foreach(columnCell, columnList)
{ {
Var *column = (Var *) lfirst(columnCell); Var *column = (Var *) lfirst(columnCell);
column->varnoold = column->varno; column->varnosyn = column->varno;
column->varoattno = column->varattno; column->varattnosyn = column->varattno;
} }
} }

View File

@ -1681,8 +1681,8 @@ BuildReadIntermediateResultsQuery(List *targetEntryList, List *columnAliasList,
functionColumnVar->vartypmod = columnTypMod; functionColumnVar->vartypmod = columnTypMod;
functionColumnVar->varcollid = columnCollation; functionColumnVar->varcollid = columnCollation;
functionColumnVar->varlevelsup = 0; functionColumnVar->varlevelsup = 0;
functionColumnVar->varnoold = 1; functionColumnVar->varnosyn = 1;
functionColumnVar->varoattno = columnNumber; functionColumnVar->varattnosyn = columnNumber;
functionColumnVar->location = -1; functionColumnVar->location = -1;
TargetEntry *newTargetEntry = makeNode(TargetEntry); TargetEntry *newTargetEntry = makeNode(TargetEntry);

View File

@ -38,8 +38,6 @@
#define CMDTAG_SELECT_COMPAT CMDTAG_SELECT #define CMDTAG_SELECT_COMPAT CMDTAG_SELECT
#define ExplainOnePlanCompat(a, b, c, d, e, f, g) ExplainOnePlan(a, b, c, d, e, f, g, \ #define ExplainOnePlanCompat(a, b, c, d, e, f, g) ExplainOnePlan(a, b, c, d, e, f, g, \
NULL) NULL)
#define varoattno varattnosyn
#define varnoold varnosyn
#define Set_ptr_value(a, b) ((a)->ptr_value = (b)) #define Set_ptr_value(a, b) ((a)->ptr_value = (b))
#define RangeTableEntryFromNSItem(a) ((a)->p_rte) #define RangeTableEntryFromNSItem(a) ((a)->p_rte)
#define QueryCompletionCompat QueryCompletion #define QueryCompletionCompat QueryCompletion
@ -55,6 +53,8 @@
#define Set_ptr_value(a, b) ((a)->data.ptr_value = (b)) #define Set_ptr_value(a, b) ((a)->data.ptr_value = (b))
#define RangeTableEntryFromNSItem(a) (a) #define RangeTableEntryFromNSItem(a) (a)
#define QueryCompletionCompat char #define QueryCompletionCompat char
#define varattnosyn varoattno
#define varnosyn varnoold
#endif #endif
#if PG_VERSION_NUM >= PG_VERSION_12 #if PG_VERSION_NUM >= PG_VERSION_12