Skip to content

Commit

Permalink
Fix a few whitespaces in the code
Browse files Browse the repository at this point in the history
Issues with the style of the code spotted while applying automatically
some checks onto it.  This change has no consequence for the code.
  • Loading branch information
michaelpq committed Dec 9, 2022
1 parent 9dea568 commit 005264a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 28 deletions.
4 changes: 2 additions & 2 deletions make_join_rel.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,10 @@ make_join_rel(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
*/
set_joinrel_size_estimates(root, joinrel, rel1, rel2, sjinfo,
restrictlist);

joinrel->rows = adjust_rows(joinrel->rows, domultiply);
}

}
}
/* !!! END: HERE IS THE PART WHICH IS ADDED FOR PG_HINT_PLAN !!! */
Expand Down
50 changes: 25 additions & 25 deletions pg_hint_plan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1803,7 +1803,7 @@ parse_hints(HintState *hstate, Query *parse, const char *str)
}


/*
/*
* Get hints from table by client-supplied query string and application name.
*/
static const char *
Expand Down Expand Up @@ -1835,28 +1835,28 @@ get_hints_from_table(const char *client_query, const char *client_application)
PushActiveSnapshot(GetTransactionSnapshot());
snapshot_set = true;
}

SPI_connect();

if (plan == NULL)
{
SPIPlanPtr p;
p = SPI_prepare(search_query, 2, argtypes);
plan = SPI_saveplan(p);
SPI_freeplan(p);
}

qry = cstring_to_text(client_query);
app = cstring_to_text(client_application);
values[0] = PointerGetDatum(qry);
values[1] = PointerGetDatum(app);

SPI_execute_plan(plan, values, nulls, true, 1);

if (SPI_processed > 0)
{
char *buf;

hints = SPI_getvalue(SPI_tuptable->vals[0],
SPI_tuptable->tupdesc, 1);
/*
Expand All @@ -1869,7 +1869,7 @@ get_hints_from_table(const char *client_query, const char *client_application)
strcpy(buf, hints);
hints = buf;
}

SPI_finish();

if (snapshot_set)
Expand Down Expand Up @@ -2361,7 +2361,7 @@ RowsHintParse(RowsHint *hint, HintState *hstate, Query *parse,

return str;
}


/*
* Transform relation names from list to array to sort them with qsort
Expand Down Expand Up @@ -2460,7 +2460,7 @@ ParallelHintParse(ParallelHint *hint, HintState *hstate, Query *parse,
}

hint->relname = linitial(name_list);

/* The second parameter is number of workers */
hint->nworkers_str = list_nth(name_list, 1);
nworkers = strtod(hint->nworkers_str, &end_ptr);
Expand Down Expand Up @@ -2930,7 +2930,7 @@ get_current_hint_string(Query *query, const char *query_str,
normalized_query),
errhidestmt(msgqno != qno),
errhidecontext(msgqno != qno)));

msgqno = qno;
}

Expand Down Expand Up @@ -3003,7 +3003,7 @@ pg_hint_plan_planner(Query *parse, const char *query_string, int cursorOptions,
const char *prev_hint_str = NULL;

/*
* Use standard planner if pg_hint_plan is disabled or current nesting
* Use standard planner if pg_hint_plan is disabled or current nesting
* depth is nesting depth of SPI calls. Other hook functions try to change
* plan with current_hint_state if any, so set it to NULL.
*/
Expand Down Expand Up @@ -3062,10 +3062,10 @@ pg_hint_plan_planner(Query *parse, const char *query_string, int cursorOptions,
pfree((void *)current_hint_str);
current_hint_str = NULL;
}

goto standard_planner_proc;
}

/*
* Push new hint struct to the hint stack to disable previous hint context.
*/
Expand All @@ -3078,7 +3078,7 @@ pg_hint_plan_planner(Query *parse, const char *query_string, int cursorOptions,
setup_guc_enforcement(current_hint_state->set_hints,
current_hint_state->num_hints[HINT_TYPE_SET],
current_hint_state->context);

current_hint_state->init_scan_mask = get_current_scan_mask();
current_hint_state->init_join_mask = get_current_join_mask();
current_hint_state->init_min_para_tablescan_size =
Expand All @@ -3101,7 +3101,7 @@ pg_hint_plan_planner(Query *parse, const char *query_string, int cursorOptions,
{
ereport(pg_hint_plan_debug_message_level,
(errhidestmt(msgqno != qno),
errmsg("pg_hint_plan%s: planner", qnostr)));
errmsg("pg_hint_plan%s: planner", qnostr)));
msgqno = qno;
}

Expand All @@ -3113,7 +3113,7 @@ pg_hint_plan_planner(Query *parse, const char *query_string, int cursorOptions,
recurse_level++;
prev_hint_str = current_hint_str;
current_hint_str = NULL;

/*
* Use PG_TRY mechanism to recover GUC parameters and current_hint_state to
* the state when this planner started when error occurred in planner.
Expand Down Expand Up @@ -3286,7 +3286,7 @@ find_parallel_hint(PlannerInfo *root, Index relid)

/*
* Parallel planning is appliable only on base relation, which has
* RelOptInfo.
* RelOptInfo.
*/
if (!rel)
return NULL;
Expand Down Expand Up @@ -3483,7 +3483,7 @@ restrict_indexes(PlannerInfo *root, ScanMethodHint *hint, RelOptInfo *rel,
p_info->indcollation[i] != info->indexcollations[i] ||
p_info->opclass[i] != info->opcintype[i])
break;

/*
* Compare index ordering if this index is ordered.
*
Expand Down Expand Up @@ -3594,7 +3594,7 @@ restrict_indexes(PlannerInfo *root, ScanMethodHint *hint, RelOptInfo *rel,

if (!use_index)
rel->indexlist = foreach_delete_current(rel->indexlist, cell);

pfree(indexname);
}

Expand All @@ -3611,7 +3611,7 @@ restrict_indexes(PlannerInfo *root, ScanMethodHint *hint, RelOptInfo *rel,
disprelname = get_rel_name(rte->relid);
else
disprelname = hint->relname;


initStringInfo(&rel_buf);
quote_value(&rel_buf, disprelname);
Expand All @@ -3626,7 +3626,7 @@ restrict_indexes(PlannerInfo *root, ScanMethodHint *hint, RelOptInfo *rel,
}
}

/*
/*
* Return information of index definition.
*/
static ParentIndexInfo *
Expand Down Expand Up @@ -3796,7 +3796,7 @@ setup_hint_enforcement(PlannerInfo *root, RelOptInfo *rel,
* redundant setup cost.
*/
current_hint_state->parent_relid = new_parent_relid;

/* Find hints for the parent */
current_hint_state->parent_scan_hint =
find_scan_hint(root, current_hint_state->parent_relid);
Expand Down Expand Up @@ -4428,7 +4428,7 @@ make_join_rel_wrapper(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2)
/* reject non-matching hints */
if (join_hint && join_hint->inner_nrels != 0)
join_hint = NULL;

if (memoize_hint && memoize_hint->inner_nrels != 0)
memoize_hint = NULL;

Expand Down Expand Up @@ -4620,7 +4620,7 @@ pg_hint_plan_join_search(PlannerInfo *root, int levels_needed,
{
ListCell *lc;
int nworkers = 0;

foreach (lc, initial_rels)
{
ListCell *lcp;
Expand Down
2 changes: 1 addition & 1 deletion pg_stat_statements.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*-------------------------------------------------------------------------
*
* pg_stat_statements.c
*
*
* Part of pg_stat_statements.c in PostgreSQL 10.
*
* Copyright (c) 2008-2020, PostgreSQL Global Development Group
Expand Down

0 comments on commit 005264a

Please sign in to comment.