提交 2d59bf27 编写于 作者: H Heikki Linnakangas

Whitespace, comment and formatting fixes, to match upstream code closer.

Also rename the argument to adjust_inherited_tlist() to what it is in
the upstream.
上级 1884f7a2
......@@ -78,8 +78,8 @@ typedef struct ExplainState
extern bool Test_print_direct_dispatch_info;
static void ExplainOneQuery(Query *query, ExplainStmt *stmt,
const char *queryString,
ParamListInfo params, TupOutputState *tstate);
const char *queryString,
ParamListInfo params, TupOutputState *tstate);
static void report_triggers(ResultRelInfo *rInfo, bool show_relname,
StringInfo buf);
......@@ -370,10 +370,10 @@ ExplainOnePlan(PlannedStmt *plannedstmt, ParamListInfo params,
instr_time starttime;
double totaltime = 0;
ExplainState *es;
StringInfoData buf;
EState *estate = NULL;
StringInfoData buf;
EState *estate = NULL;
int eflags;
int nb;
int nb;
MemoryContext explaincxt = CurrentMemoryContext;
/*
......@@ -414,7 +414,7 @@ ExplainOnePlan(PlannedStmt *plannedstmt, ParamListInfo params,
/* If analyzing, we need to cope with queued triggers */
if (stmt->analyze)
AfterTriggerBeginQuery();
AfterTriggerBeginQuery();
/* Allocate workarea for summary stats. */
if (stmt->analyze)
......@@ -428,7 +428,7 @@ ExplainOnePlan(PlannedStmt *plannedstmt, ParamListInfo params,
/* Select execution options */
if (stmt->analyze)
eflags = 0; /* default run-to-completion flags */
eflags = 0; /* default run-to-completion flags */
else
eflags = EXEC_FLAG_EXPLAIN_ONLY;
......@@ -544,7 +544,6 @@ ExplainOnePlan(PlannedStmt *plannedstmt, ParamListInfo params,
else
f = format_node_dump(s);
pfree(s);
do_text_output_multiline(tstate, f);
pfree(f);
do_text_output_oneline(tstate, ""); /* separator line */
......@@ -876,7 +875,6 @@ appendGangAndDirectDispatchInfo(StringInfo str, PlanState *planstate, int sliceI
}
}
/*
* explain_outNode -
* converts a Plan node into ascii string and appends it to 'str'
......@@ -1816,7 +1814,6 @@ explain_outNode(StringInfo str,
for (i = 0; i < indent; i++)
appendStringInfo(str, " ");
appendStringInfo(str, " -> ");
/*
......
......@@ -8,10 +8,10 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.88.2.1 2009/02/24 01:38:49 tgl Exp $
*
*
* DESCRIPTION
* These routines take the parse tree and pick out the
* appropriate arguments/flags, and pass the results to the
......@@ -61,6 +61,7 @@
#include "cdb/cdbvars.h"
#include "cdb/cdbdisp_query.h"
static void AlterFunctionOwner_internal(cqContext *pcqCtx,
Relation rel, HeapTuple tup,
Oid newOwnerId);
......
此差异已折叠。
......@@ -1942,7 +1942,6 @@ InitPlan(QueryDesc *queryDesc, int eflags)
(operation == CMD_INSERT || estate->es_select_into) &&
ExecMayReturnRawTuples(planstate))
junk_filter_needed = true;
break;
case CMD_UPDATE:
case CMD_DELETE:
......
......@@ -1387,7 +1387,7 @@ adjust_relid_set(Relids relids, Index oldrelid, Index newrelid)
* Note that this is not needed for INSERT because INSERT isn't inheritable.
*/
static List *
adjust_inherited_tlist(List *tlist, AppendRelInfo *apprelinfo)
adjust_inherited_tlist(List *tlist, AppendRelInfo *context)
{
bool changed_it = false;
ListCell *tl;
......@@ -1396,7 +1396,7 @@ adjust_inherited_tlist(List *tlist, AppendRelInfo *apprelinfo)
int attrno;
/* This should only happen for an inheritance case, not UNION ALL */
Assert(OidIsValid(apprelinfo->parent_reloid));
Assert(OidIsValid(context->parent_reloid));
/* Scan tlist and update resnos to match attnums of child rel */
foreach(tl, tlist)
......@@ -1409,13 +1409,13 @@ adjust_inherited_tlist(List *tlist, AppendRelInfo *apprelinfo)
/* Look up the translation of this column */
if (tle->resno <= 0 ||
tle->resno > list_length(apprelinfo->col_mappings))
tle->resno > list_length(context->col_mappings))
elog(ERROR, "attribute %d of relation \"%s\" does not exist",
tle->resno, get_rel_name(apprelinfo->parent_reloid));
newattno = list_nth_int(apprelinfo->col_mappings, tle->resno - 1);
tle->resno, get_rel_name(context->parent_reloid));
newattno = list_nth_int(context->col_mappings, tle->resno - 1);
if (newattno <= 0)
elog(ERROR, "attribute %d of relation \"%s\" does not exist",
tle->resno, get_rel_name(apprelinfo->parent_reloid));
tle->resno, get_rel_name(context->parent_reloid));
if (tle->resno != newattno)
{
......
......@@ -814,7 +814,7 @@ PostmasterMain(int argc, char *argv[])
{
int opt;
int status;
char *userDoption = NULL;
char *userDoption = NULL;
int i;
char stack_base;
......
......@@ -2230,9 +2230,7 @@ get_with_clause(Query *query, deparse_context *context)
appendContextKeyword(context, "", 0, 0, 0);
}
else
{
appendStringInfoChar(buf, ' ');
}
}
/* ----------
......@@ -3747,8 +3745,8 @@ isSimpleNode(Node *node, Node *parentNode, int prettyFlags)
case T_RowExpr:
case T_CoalesceExpr:
case T_MinMaxExpr:
case T_NullIfExpr:
case T_XmlExpr:
case T_NullIfExpr:
case T_Aggref:
case T_FuncExpr:
case T_PercentileExpr:
......
......@@ -133,7 +133,7 @@ text_to_cstring(const text *t)
if (tunpacked != t)
pfree(tunpacked);
return result;
}
......
......@@ -107,7 +107,7 @@ static int exec_stmt_return(PLpgSQL_execstate *estate,
static int exec_stmt_return_next(PLpgSQL_execstate *estate,
PLpgSQL_stmt_return_next *stmt);
static int exec_stmt_return_query(PLpgSQL_execstate *estate,
PLpgSQL_stmt_return_query *stmt);
PLpgSQL_stmt_return_query *stmt);
static int exec_stmt_raise(PLpgSQL_execstate *estate,
PLpgSQL_stmt_raise *stmt);
static int exec_stmt_execsql(PLpgSQL_execstate *estate,
......@@ -1060,7 +1060,7 @@ exec_stmt_block(PLpgSQL_execstate *estate, PLpgSQL_stmt_block *block)
*/
SPI_restore_connection();
/* Clean up econtext. */
/* Must clean up the econtext too */
exec_eval_cleanup(estate);
/* Look for a matching exception handler */
......@@ -2163,7 +2163,7 @@ static int
exec_stmt_return_query(PLpgSQL_execstate *estate,
PLpgSQL_stmt_return_query *stmt)
{
Portal portal;
Portal portal;
if (!estate->retisset)
ereport(ERROR,
......@@ -2178,12 +2178,12 @@ exec_stmt_return_query(PLpgSQL_execstate *estate,
if (!compatible_tupdesc(estate->rettupdesc, portal->tupDesc))
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("structure of query does not match function result type")));
errmsg("structure of query does not match function result type")));
while (true)
{
MemoryContext old_cxt;
int i;
MemoryContext old_cxt;
int i;
SPI_cursor_fetch(portal, true, 50);
if (SPI_processed == 0)
......@@ -2192,7 +2192,8 @@ exec_stmt_return_query(PLpgSQL_execstate *estate,
old_cxt = MemoryContextSwitchTo(estate->tuple_store_cxt);
for (i = 0; i < SPI_processed; i++)
{
HeapTuple tuple = SPI_tuptable->vals[i];
HeapTuple tuple = SPI_tuptable->vals[i];
tuplestore_puttuple(estate->tuple_store, tuple);
}
MemoryContextSwitchTo(old_cxt);
......@@ -3123,7 +3124,6 @@ exec_stmt_open(PLpgSQL_execstate *estate, PLpgSQL_stmt_open *stmt)
* ----------
*/
query = stmt->query;
if (query->plan == NULL)
exec_prepare_plan(estate, query, stmt->cursor_options);
}
......@@ -3230,7 +3230,6 @@ exec_stmt_open(PLpgSQL_execstate *estate, PLpgSQL_stmt_open *stmt)
}
query = curvar->cursor_explicit_expr;
if (query->plan == NULL)
exec_prepare_plan(estate, query, curvar->cursor_options);
}
......@@ -4170,7 +4169,7 @@ exec_run_select(PLpgSQL_execstate *estate,
int rc;
/*
* generate the plan if needed
* On the first call for this expression generate the plan
*/
if (expr->plan == NULL)
exec_prepare_plan(estate, expr, 0);
......@@ -5034,7 +5033,7 @@ exec_simple_check_plan(PLpgSQL_expr *expr)
if (list_length(spi_plan->plancache_list) != 1)
{
CachedPlanSource *cached_ps;
cached_ps = (CachedPlanSource *) linitial(spi_plan->plancache_list);
if (list_length(cached_ps->plan->stmt_list) != 1)
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册