Replace Set_ptr_value as SetListCellPtr to be more explicit

Move header to right place and fix comment style
pull/3900/head
Sait Talha Nisanci 2020-07-24 13:21:07 +03:00
parent 8e9b52971c
commit fe1e1c9b68
5 changed files with 17 additions and 14 deletions

View File

@ -93,13 +93,14 @@
#include "distributed/hash_helpers.h"
#include "executor/executor.h"
#include "foreign/foreign.h"
#if PG_VERSION_NUM >= PG_VERSION_13
#include "tcop/cmdtag.h"
#endif
#include "libpq/libpq.h"
#include "libpq/pqformat.h"
#include "nodes/makefuncs.h"
#include "nodes/nodeFuncs.h"
#if PG_VERSION_NUM >= PG_VERSION_13
#include "tcop/cmdtag.h"
#endif
#include "tsearch/ts_locale.h"
#include "utils/builtins.h"
#include "utils/lsyscache.h"

View File

@ -3556,9 +3556,10 @@ get_variable(Var *var, int levelsup, bool istoplevel, deparse_context *context)
if (var->varnosyn > 0 && var->varnosyn <= list_length(dpns->rtable) && dpns->plan == NULL) {
rte = rt_fetch(var->varnosyn, dpns->rtable);
// if the rte var->varnosync points to is not a regular table and it is a join
// then the correct relname will be found with var->varnosync and var->varattnosync
// TODO:: this is a workaround and it can be simplified.
/*
* if the rte var->varnosyn points to is not a regular table and it is a join
* then the correct relname will be found with var->varnosyn and var->varattnosyn
*/
if (rte->rtekind == RTE_JOIN && rte->relid == 0 && var->varnosyn != var->varno) {
varno = var->varnosyn;
varattno = var->varattnosyn;
@ -3969,9 +3970,10 @@ get_name_for_var_field(Var *var, int fieldno,
if (var->varnosyn > 0 && var->varnosyn <= list_length(dpns->rtable) && dpns->plan == NULL) {
rte = rt_fetch(var->varnosyn, dpns->rtable);
// if the rte var->varnosync points to is not a regular table and it is a join
// then the correct relname will be found with var->varnosync and var->varattnosync
// TODO:: this is a workaround and it can be simplified.
/*
* if the rte var->varnosyn points to is not a regular table and it is a join
* then the correct relname will be found with var->varnosyn and var->varattnosyn
*/
if (rte->rtekind == RTE_JOIN && rte->relid == 0 && var->varnosyn != var->varno) {
varno = var->varnosyn;
varattno = var->varattnosyn;

View File

@ -5171,7 +5171,7 @@ GreedyAssignTask(WorkerNode *workerNode, List *taskList, List *activeShardPlacem
rotatePlacementListBy = replicaIndex;
/* overwrite task list to signal that this task is assigned */
Set_ptr_value(taskCell, NULL);
SetListCellPtr(taskCell, NULL);
break;
}
}

View File

@ -2976,7 +2976,7 @@ NormalizeMultiRowInsertTargetList(Query *query)
expandedValuesList = lappend(expandedValuesList, targetExpr);
}
Set_ptr_value(valuesListCell, (void *) expandedValuesList);
SetListCellPtr(valuesListCell, (void *) expandedValuesList);
}
/* reset coltypes, coltypmods, colcollations and rebuild them below */

View File

@ -38,7 +38,7 @@
#define CMDTAG_SELECT_COMPAT CMDTAG_SELECT
#define ExplainOnePlanCompat(a, b, c, d, e, f, g) ExplainOnePlan(a, b, c, d, e, f, g, \
NULL)
#define Set_ptr_value(a, b) ((a)->ptr_value = (b))
#define SetListCellPtr(a, b) ((a)->ptr_value = (b))
#define RangeTableEntryFromNSItem(a) ((a)->p_rte)
#define QueryCompletionCompat QueryCompletion
#else /* pre PG13 */
@ -50,11 +50,11 @@
#define CMDTAG_SELECT_COMPAT "SELECT"
#define getOwnedSequencesCompat(a, b) getOwnedSequences(a, b)
#define ExplainOnePlanCompat(a, b, c, d, e, f, g) ExplainOnePlan(a, b, c, d, e, f, g)
#define Set_ptr_value(a, b) ((a)->data.ptr_value = (b))
#define SetListCellPtr(a, b) ((a)->data.ptr_value = (b))
#define RangeTableEntryFromNSItem(a) (a)
#define QueryCompletionCompat char
#define varattnosyn varoattno
#define varnosyn varnoold
#define varnosyn varnoold
#endif
#if PG_VERSION_NUM >= PG_VERSION_12