ResultRelInfo *resultRelInfo);
static int postgresIsForeignRelUpdatable(Relation rel);
static bool postgresPlanDirectModify(PlannerInfo *root,
- ModifyTable *plan,
- Index resultRelation,
- int subplan_index);
+ ModifyTable *plan,
+ Index resultRelation,
+ int subplan_index);
static void postgresBeginDirectModify(ForeignScanState *node, int eflags);
static TupleTableSlot *postgresIterateDirectModify(ForeignScanState *node);
static void postgresEndDirectModify(ForeignScanState *node);
int subplan_index,
ExplainState *es);
static void postgresExplainDirectModify(ForeignScanState *node,
- ExplainState *es);
+ ExplainState *es);
static bool postgresAnalyzeForeignTable(Relation relation,
AcquireSampleRowsFunc *func,
BlockNumber *totalpages);
int col;
/*
- * We transmit only columns that were explicitly targets of the UPDATE,
- * so as to avoid unnecessary data transmission.
+ * We transmit only columns that were explicitly targets of the
+ * UPDATE, so as to avoid unnecessary data transmission.
*/
col = -1;
while ((col = bms_next_member(rte->updatedCols, col)) >= 0)
dmstate->conn = GetConnection(user, false);
/* Initialize state variable */
- dmstate->num_tuples = -1; /* -1 means not set yet */
+ dmstate->num_tuples = -1; /* -1 means not set yet */
/* Get private info created by planner functions. */
dmstate->query = strVal(list_nth(fsplan->fdw_private,
FdwDirectModifyPrivateUpdateSql));
dmstate->has_returning = intVal(list_nth(fsplan->fdw_private,
- FdwDirectModifyPrivateHasReturning));
+ FdwDirectModifyPrivateHasReturning));
dmstate->retrieved_attrs = (List *) list_nth(fsplan->fdw_private,
- FdwDirectModifyPrivateRetrievedAttrs);
+ FdwDirectModifyPrivateRetrievedAttrs);
dmstate->set_processed = intVal(list_nth(fsplan->fdw_private,
- FdwDirectModifyPrivateSetProcessed));
+ FdwDirectModifyPrivateSetProcessed));
/* Create context for per-tuple temp workspace. */
dmstate->temp_cxt = AllocSetContextCreate(estate->es_query_cxt,
List *otherclauses;
/*
- * Core code may call GetForeignJoinPaths hook even when the join
- * relation doesn't have a valid user mapping associated with it. See
- * build_join_rel() for details. We can't push down such join, since
- * there doesn't exist a user mapping which can be used to connect to the
+ * Core code may call GetForeignJoinPaths hook even when the join relation
+ * doesn't have a valid user mapping associated with it. See
+ * build_join_rel() for details. We can't push down such join, since there
+ * doesn't exist a user mapping which can be used to connect to the
* foreign server.
*/
if (!OidIsValid(joinrel->umid))
ExplainPrintPlan(ExplainState *es, QueryDesc *queryDesc)
{
Bitmapset *rels_used = NULL;
- PlanState *ps;
+ PlanState *ps;
Assert(queryDesc->plannedstmt != NULL);
es->pstmt = queryDesc->plannedstmt;
break;
case T_Gather:
{
- Gather *gather = (Gather *) plan;
+ Gather *gather = (Gather *) plan;
show_scan_qual(plan->qual, "Filter", planstate, ancestors, es);
if (plan->qual)
gather->num_workers, es);
if (gather->single_copy)
ExplainPropertyText("Single Copy",
- gather->single_copy ? "true" : "false",
+ gather->single_copy ? "true" : "false",
es);
}
break;
appendStringInfo(es->str, "Worker %d: ", n);
if (es->timing)
appendStringInfo(es->str,
- "actual time=%.3f..%.3f rows=%.0f loops=%.0f\n",
- startup_sec, total_sec, rows, nloops);
+ "actual time=%.3f..%.3f rows=%.0f loops=%.0f\n",
+ startup_sec, total_sec, rows, nloops);
else
appendStringInfo(es->str,
"actual rows=%.0f loops=%.0f\n",
return;
if (IsA(plan, RecursiveUnion))
return;
+
/*
* Likewise for ForeignScan that executes a direct INSERT/UPDATE/DELETE
*
bool has_temp = (usage->temp_blks_read > 0 ||
usage->temp_blks_written > 0);
bool has_timing = (!INSTR_TIME_IS_ZERO(usage->blk_read_time) ||
- !INSTR_TIME_IS_ZERO(usage->blk_write_time));
+ !INSTR_TIME_IS_ZERO(usage->blk_write_time));
/* Show only positive counter values. */
if (has_shared || has_local || has_temp)
appendStringInfoString(es->str, "I/O Timings:");
if (!INSTR_TIME_IS_ZERO(usage->blk_read_time))
appendStringInfo(es->str, " read=%0.3f",
- INSTR_TIME_GET_MILLISEC(usage->blk_read_time));
+ INSTR_TIME_GET_MILLISEC(usage->blk_read_time));
if (!INSTR_TIME_IS_ZERO(usage->blk_write_time))
appendStringInfo(es->str, " write=%0.3f",
- INSTR_TIME_GET_MILLISEC(usage->blk_write_time));
+ INSTR_TIME_GET_MILLISEC(usage->blk_write_time));
appendStringInfoChar(es->str, '\n');
}
}
static ExtensibleNode *
_copyExtensibleNode(const ExtensibleNode *from)
{
- ExtensibleNode *newnode;
+ ExtensibleNode *newnode;
const ExtensibleNodeMethods *methods;
methods = GetExtensibleNodeMethods(from->extnodename, false);
static bool
_equalExtensibleNode(const ExtensibleNode *a, const ExtensibleNode *b)
{
- const ExtensibleNodeMethods *methods;
+ const ExtensibleNodeMethods *methods;
COMPARE_STRING_FIELD(extnodename);
static void
_outExtensibleNode(StringInfo str, const ExtensibleNode *node)
{
- const ExtensibleNodeMethods *methods;
+ const ExtensibleNodeMethods *methods;
methods = GetExtensibleNodeMethods(node->extnodename, false);
* plan nodes below the LIMIT node) are set without regard to any LIMIT, so
* that this equation works properly. (Note: while path->rows is never zero
* for ordinary relations, it is zero for paths for provably-empty relations,
- * so beware of division-by-zero.) The LIMIT is applied as a top-level
+ * so beware of division-by-zero.) The LIMIT is applied as a top-level
* plan node.
*
* For largely historical reasons, most of the routines in this module use
/* Adjust costing for parallelism, if used. */
if (path->parallel_degree > 0)
{
- double parallel_divisor = path->parallel_degree;
- double leader_contribution;
+ double parallel_divisor = path->parallel_degree;
+ double leader_contribution;
/*
* Early experience with parallel query suggests that when there is
*/
static void
try_partial_nestloop_path(PlannerInfo *root,
- RelOptInfo *joinrel,
- Path *outer_path,
- Path *inner_path,
- List *pathkeys,
- JoinType jointype,
- JoinPathExtraData *extra)
+ RelOptInfo *joinrel,
+ Path *outer_path,
+ Path *inner_path,
+ List *pathkeys,
+ JoinType jointype,
+ JoinPathExtraData *extra)
{
JoinCostWorkspace workspace;
}
/*
- * Before creating a path, get a quick lower bound on what it is likely
- * to cost. Bail out right away if it looks terrible.
+ * Before creating a path, get a quick lower bound on what it is likely to
+ * cost. Bail out right away if it looks terrible.
*/
initial_cost_nestloop(root, &workspace, jointype,
outer_path, inner_path,
/* Might be good enough to be worth trying, so let's try it. */
add_partial_path(joinrel, (Path *)
- create_nestloop_path(root,
- joinrel,
- jointype,
- &workspace,
- extra->sjinfo,
- &extra->semifactors,
- outer_path,
- inner_path,
- extra->restrictlist,
- pathkeys,
- NULL));
+ create_nestloop_path(root,
+ joinrel,
+ jointype,
+ &workspace,
+ extra->sjinfo,
+ &extra->semifactors,
+ outer_path,
+ inner_path,
+ extra->restrictlist,
+ pathkeys,
+ NULL));
}
/*
}
/*
- * Before creating a path, get a quick lower bound on what it is likely
- * to cost. Bail out right away if it looks terrible.
+ * Before creating a path, get a quick lower bound on what it is likely to
+ * cost. Bail out right away if it looks terrible.
*/
initial_cost_hashjoin(root, &workspace, jointype, hashclauses,
outer_path, inner_path,
/* Might be good enough to be worth trying, so let's try it. */
add_partial_path(joinrel, (Path *)
- create_hashjoin_path(root,
- joinrel,
- jointype,
- &workspace,
- extra->sjinfo,
- &extra->semifactors,
- outer_path,
- inner_path,
- extra->restrictlist,
- NULL,
- hashclauses));
+ create_hashjoin_path(root,
+ joinrel,
+ jointype,
+ &workspace,
+ extra->sjinfo,
+ &extra->semifactors,
+ outer_path,
+ inner_path,
+ extra->restrictlist,
+ NULL,
+ hashclauses));
}
/*
}
/*
- * If the joinrel is parallel-safe and the join type supports nested loops,
- * we may be able to consider a partial nestloop plan. However, we can't
- * handle JOIN_UNIQUE_OUTER, because the outer path will be partial, and
- * therefore we won't be able to properly guarantee uniqueness. Nor can
- * we handle extra_lateral_rels, since partial paths must not be
+ * If the joinrel is parallel-safe and the join type supports nested
+ * loops, we may be able to consider a partial nestloop plan. However, we
+ * can't handle JOIN_UNIQUE_OUTER, because the outer path will be partial,
+ * and therefore we won't be able to properly guarantee uniqueness. Nor
+ * can we handle extra_lateral_rels, since partial paths must not be
* parameterized.
*/
if (joinrel->consider_parallel && nestjoinOK &&
outerpath->pathkeys);
/*
- * Try the cheapest parameterized paths; only those which will
- * produce an unparameterized path when joined to this outerrel
- * will survive try_partial_nestloop_path. The cheapest
- * unparameterized path is also in this list.
+ * Try the cheapest parameterized paths; only those which will produce
+ * an unparameterized path when joined to this outerrel will survive
+ * try_partial_nestloop_path. The cheapest unparameterized path is
+ * also in this list.
*/
foreach(lc2, innerrel->cheapest_parameterized_paths)
{
/*
* Like match_unsorted_outer, we only consider a single nestloop
- * path when the jointype is JOIN_UNIQUE_INNER. But we have to scan
- * cheapest_parameterized_paths to find the one we want to consider,
- * because cheapest_total_path might not be parallel-safe.
+ * path when the jointype is JOIN_UNIQUE_INNER. But we have to
+ * scan cheapest_parameterized_paths to find the one we want to
+ * consider, because cheapest_total_path might not be
+ * parallel-safe.
*/
if (jointype == JOIN_UNIQUE_INNER)
{
if (!bms_is_empty(PATH_REQ_OUTER(innerpath)))
continue;
innerpath = (Path *) create_unique_path(root, innerrel,
- innerpath, extra->sjinfo);
+ innerpath, extra->sjinfo);
Assert(innerpath);
}
outerrel->partial_pathlist != NIL &&
bms_is_empty(joinrel->lateral_relids))
{
- Path *cheapest_partial_outer;
- Path *cheapest_safe_inner = NULL;
+ Path *cheapest_partial_outer;
+ Path *cheapest_safe_inner = NULL;
cheapest_partial_outer =
(Path *) linitial(outerrel->partial_pathlist);
final_rel = build_empty_join_rel(root);
/*
- * If query allows parallelism in general, check whether the quals
- * are parallel-restricted. There's currently no real benefit to
- * setting this flag correctly because we can't yet reference subplans
- * from parallel workers. But that might change someday, so set this
+ * If query allows parallelism in general, check whether the quals are
+ * parallel-restricted. There's currently no real benefit to setting
+ * this flag correctly because we can't yet reference subplans from
+ * parallel workers. But that might change someday, so set this
* correctly anyway.
*/
if (root->glob->parallelModeOK)
static void set_join_references(PlannerInfo *root, Join *join, int rtoffset);
static void set_upper_references(PlannerInfo *root, Plan *plan, int rtoffset);
static void set_combineagg_references(PlannerInfo *root, Plan *plan,
- int rtoffset);
+ int rtoffset);
static void set_dummy_tlist_references(Plan *plan, int rtoffset);
static indexed_tlist *build_tlist_index(List *tlist);
static Var *search_indexed_tlist_for_var(Var *var,
indexed_tlist *itlist,
Index newvarno);
static Var *search_indexed_tlist_for_partial_aggref(Aggref *aggref,
- indexed_tlist *itlist, Index newvarno);
+ indexed_tlist *itlist, Index newvarno);
static List *fix_join_expr(PlannerInfo *root,
List *clauses,
indexed_tlist *outer_itlist,
static Node *fix_upper_expr_mutator(Node *node,
fix_upper_expr_context *context);
static Node *fix_combine_agg_expr(PlannerInfo *root,
- Node *node,
- indexed_tlist *subplan_itlist,
- Index newvarno,
- int rtoffset);
+ Node *node,
+ indexed_tlist *subplan_itlist,
+ Index newvarno,
+ int rtoffset);
static Node *fix_combine_agg_expr_mutator(Node *node,
- fix_upper_expr_context *context);
+ fix_upper_expr_context *context);
static List *set_returning_clause_references(PlannerInfo *root,
List *rlist,
Plan *topplan,
break;
case T_Agg:
{
- Agg *aggplan = (Agg *) plan;
+ Agg *aggplan = (Agg *) plan;
if (aggplan->combineStates)
set_combineagg_references(root, plan, rtoffset);
search_indexed_tlist_for_partial_aggref(Aggref *aggref, indexed_tlist *itlist,
Index newvarno)
{
- ListCell *lc;
+ ListCell *lc;
foreach(lc, itlist->tlist)
{
continue;
newvar = makeVarFromTargetEntry(newvarno, tle);
- newvar->varnoold = 0; /* wasn't ever a plain Var */
+ newvar->varnoold = 0; /* wasn't ever a plain Var */
newvar->varoattno = 0;
return newvar;
*/
static Node *
fix_combine_agg_expr(PlannerInfo *root,
- Node *node,
- indexed_tlist *subplan_itlist,
- Index newvarno,
- int rtoffset)
+ Node *node,
+ indexed_tlist *subplan_itlist,
+ Index newvarno,
+ int rtoffset)
{
fix_upper_expr_context context;
return fix_param_node(context->root, (Param *) node);
if (IsA(node, Aggref))
{
- Aggref *aggref = (Aggref *) node;
+ Aggref *aggref = (Aggref *) node;
newvar = search_indexed_tlist_for_partial_aggref(aggref,
context->subplan_itlist,
context->newvarno);
if (newvar)
{
- Aggref *newaggref;
- TargetEntry *newtle;
+ Aggref *newaggref;
+ TargetEntry *newtle;
/*
* Now build a new TargetEntry for the Aggref's arguments which is
/*
* This should match what ExecCheckRTEPerms() does.
*
- * Note that if the plan ends up depending on the user OID in any
- * way - e.g. if it depends on the computed user mapping OID - we must
+ * Note that if the plan ends up depending on the user OID in any way
+ * - e.g. if it depends on the computed user mapping OID - we must
* ensure that it gets invalidated in the case of a user OID change.
* See RevalidateCachedQuery and more generally the hasForeignJoin
* flags in PlannerGlobal and PlannedStmt.
* InvalidOid even though rel->serverid is set. That just means there
* is a server with no user mapping.
*/
- Oid userid;
+ Oid userid;
userid = OidIsValid(rte->checkAsUser) ? rte->checkAsUser : GetUserId();
rel->umid = GetUserMappingId(userid, rel->serverid, true);
/*
* Set up foreign-join fields if outer and inner relation are foreign
- * tables (or joins) belonging to the same server and using the same
- * user mapping.
+ * tables (or joins) belonging to the same server and using the same user
+ * mapping.
*
* Otherwise those fields are left invalid, so FDW API will not be called
* for the join relation.
*
* For FDWs like file_fdw, which ignore user mapping, the user mapping id
* associated with the joining relation may be invalid. A valid serverid
- * distinguishes between a pushed down join with no user mapping and
- * a join which can not be pushed down because of user mapping mismatch.
+ * distinguishes between a pushed down join with no user mapping and a
+ * join which can not be pushed down because of user mapping mismatch.
*/
if (OidIsValid(outer_rel->serverid) &&
inner_rel->serverid == outer_rel->serverid &&
Node *n2 = flatten_grouping_sets(n1, false, NULL);
if (IsA(n1, GroupingSet) &&
- ((GroupingSet *)n1)->kind == GROUPING_SET_SETS)
+ ((GroupingSet *) n1)->kind == GROUPING_SET_SETS)
{
result_set = list_concat(result_set, (List *) n2);
}
if (IsCatalogRelation(pstate->p_target_relation))
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("ON CONFLICT is not supported with system catalog tables"),
+ errmsg("ON CONFLICT is not supported with system catalog tables"),
parser_errposition(pstate,
exprLocation((Node *) onConflictClause))));
*/
extern char *nodeToString(const void *obj);
-struct Bitmapset; /* not to include bitmapset.h here */
-struct StringInfoData; /* not to include stringinfo.h here */
+struct Bitmapset; /* not to include bitmapset.h here */
+struct StringInfoData; /* not to include stringinfo.h here */
extern void outToken(struct StringInfoData *str, const char *s);
extern void outBitmapset(struct StringInfoData *str,
- const struct Bitmapset *bms);
+ const struct Bitmapset *bms);
/*
* nodes/{readfuncs.c,read.c}
bool wholePlanParallelSafe; /* is the entire plan parallel safe? */
- bool hasForeignJoin; /* does have a pushed down foreign join */
+ bool hasForeignJoin; /* does have a pushed down foreign join */
} PlannerGlobal;
/* macro for fetching the Plan associated with a SubPlan node */
/* materialization information */
List *pathlist; /* Path structures */
List *ppilist; /* ParamPathInfos used in pathlist */
- List *partial_pathlist; /* partial Paths */
+ List *partial_pathlist; /* partial Paths */
struct Path *cheapest_startup_path;
struct Path *cheapest_total_path;
struct Path *cheapest_unique_path;
/* Information about foreign tables and foreign joins */
Oid serverid; /* identifies server for the table or join */
- Oid umid; /* identifies user mapping for the table or join */
+ Oid umid; /* identifies user mapping for the table or
+ * join */
/* use "struct FdwRoutine" to avoid including fdwapi.h here */
struct FdwRoutine *fdwroutine;
void *fdw_private;
bool parallel_aware; /* engage parallel-aware logic? */
bool parallel_safe; /* OK to use as part of parallel plan? */
- int parallel_degree; /* desired parallel degree; 0 = not parallel */
+ int parallel_degree; /* desired parallel degree; 0 = not parallel */
/* estimated size/costs for path (see costsize.c for more info) */
double rows; /* estimated number of result tuples */
FORCE_PARALLEL_OFF,
FORCE_PARALLEL_ON,
FORCE_PARALLEL_REGRESS
-} ForceParallelMode;
+} ForceParallelMode;
/* GUC parameters */
#define DEFAULT_CURSOR_TUPLE_FRACTION 0.1
extern double cursor_tuple_fraction;
-extern int force_parallel_mode;
+extern int force_parallel_mode;
/* query_planner callback to compute query_pathkeys */
typedef void (*query_pathkeys_callback) (PlannerInfo *root, void *extra);
extern Plan *materialize_finished_plan(Plan *subplan);
extern bool is_projection_capable_path(Path *path);
extern bool is_projection_capable_plan(Plan *plan);
+
/* External use of these functions is deprecated: */
extern Sort *make_sort_from_sortclauses(List *sortcls, Plan *lefttree);
extern Agg *make_agg(List *tlist, List *qual, AggStrategy aggstrategy,