List *outer_tlist; /* referent for OUTER_VAR Vars */
List *inner_tlist; /* referent for INNER_VAR Vars */
List *index_tlist; /* referent for INDEX_VAR Vars */
-#ifdef PGXC
- bool remotequery; /* deparse context for remote query */
-#endif
} deparse_namespace;
/*
/* Build one-element rtable */
dpns->rtable = list_make1(rte);
dpns->ctes = NIL;
-#ifdef PGXC
- dpns->remotequery = false;
-#endif
set_rtable_names(dpns, NIL, NULL);
set_simple_column_names(dpns);
return list_make1(dpns);
}
-#ifdef PGXC
-List *
-deparse_context_for_remotequery(Alias *aliasname, Oid relid)
-{
- deparse_namespace *dpns;
- RangeTblEntry *rte;
-
- dpns = (deparse_namespace *) palloc(sizeof(deparse_namespace));
-
- /* Build a minimal RTE for the rel */
- rte = makeNode(RangeTblEntry);
- rte->rtekind = RTE_RELATION;
- rte->relid = relid;
- rte->eref = aliasname;
- rte->inh = false;
- rte->inFromCl = true;
-
- /* Build one-element rtable */
- dpns->rtable = list_make1(rte);
- dpns->ctes = NIL;
- dpns->planstate = NULL;
- dpns->ancestors = NIL;
- dpns->outer_planstate = dpns->inner_planstate = NULL;
- dpns->remotequery = true;
-
- /* Return a one-deep namespace stack */
- return list_make1(dpns);
-}
-#endif
-
/*
* deparse_context_for_plan_rtable - Build deparse context for a plan's rtable
*
/* Initialize fields that stay the same across the whole plan tree */
dpns->rtable = rtable;
dpns->ctes = NIL;
- dpns->remotequery = false;
/* Set our attention on the specific plan node passed in */
set_deparse_plan(dpns, (Plan *) plan);
dpns->rtable = query->rtable;
dpns->ctes = query->cteList;
-#ifdef PGXC
- dpns->remotequery = false;
-#endif
-
/* Assign a unique relation alias to each RTE */
set_rtable_names(dpns, parent_namespaces, NULL);
dpns.planstate = NULL;
dpns.ancestors = NIL;
dpns.outer_planstate = dpns.inner_planstate = NULL;
- dpns.remotequery = false;
/*
* If it's an INSERT ... SELECT or VALUES (...), (...), ... there will be
* down into the subplans, or INDEX_VAR, which is resolved similarly. Also
* find the aliases previously assigned for this RTE.
*/
-#ifdef PGXC
- if (dpns->remotequery)
- {
- rte = rt_fetch(1, dpns->rtable);
- attnum = var->varattno;
- }
- else
-#endif
if (var->varno >= 1 && var->varno <= list_length(dpns->rtable))
{
rte = rt_fetch(var->varno, dpns->rtable);
extern Datum pg_get_function_result(PG_FUNCTION_ARGS);
extern Datum pg_get_function_arg_default(PG_FUNCTION_ARGS);
#ifdef PGXC
-extern List *deparse_context_for_remotequery(Alias *aliasname, Oid relid);
extern void get_query_def_from_valuesList(Query *query, StringInfo buf);
extern void deparse_query(Query *query, StringInfo buf, List *parentnamespace,
bool finalise_aggs, bool sortgroup_colno);