提交 be4bebc0 编写于 作者: H Heikki Linnakangas

Rename hasWindFuncs fields in Query and ParseState, to match upstream.

上级 52fdcd7c
......@@ -2973,7 +2973,7 @@ cookConstraint (ParseState *pstate,
ereport(ERROR,
(errcode(ERRCODE_GROUPING_ERROR),
errmsg("cannot use aggregate function in check constraint")));
if (pstate->p_hasWindFuncs)
if (pstate->p_hasWindowFuncs)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("cannot use window function in check constraint")));
......@@ -3082,7 +3082,7 @@ cookDefault(ParseState *pstate,
ereport(ERROR,
(errcode(ERRCODE_GROUPING_ERROR),
errmsg("cannot use aggregate function in default expression")));
if (pstate->p_hasWindFuncs)
if (pstate->p_hasWindowFuncs)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("cannot use window function in default expression")));
......
......@@ -376,7 +376,7 @@ examine_parameter_list(List *parameters, Oid languageOid,
(errcode(ERRCODE_GROUPING_ERROR),
errmsg("cannot use aggregate function in parameter default value")));
if (pstate->p_hasWindFuncs)
if (pstate->p_hasWindowFuncs)
ereport(ERROR,
(errcode(ERRCODE_WINDOWING_ERROR),
errmsg("cannot use window function in parameter default value")));
......
......@@ -8131,7 +8131,7 @@ ATPrepAlterColumnType(List **wqueue,
ereport(ERROR,
(errcode(ERRCODE_GROUPING_ERROR),
errmsg("cannot use aggregate function in transform expression")));
if (pstate->p_hasWindFuncs)
if (pstate->p_hasWindowFuncs)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("cannot use window function in transform expression")));
......
......@@ -2300,7 +2300,7 @@ domainAddConstraint(Oid domainOid, Oid domainNamespace, Oid baseTypeOid,
ereport(ERROR,
(errcode(ERRCODE_GROUPING_ERROR),
errmsg("cannot use aggregate function in check constraint")));
if (pstate->p_hasWindFuncs)
if (pstate->p_hasWindowFuncs)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("cannot use window function in check constraint")));
......
......@@ -1280,7 +1280,7 @@ CQueryMutators::PqueryNormalizeHaving
pqueryNewSubquery->targetList = NIL;
pqueryNewSubquery->hasAggs = false;
pqueryNewSubquery->hasWindFuncs = false;
pqueryNewSubquery->hasWindowFuncs = false;
pqueryNewSubquery->hasSubLinks = false;
ListCell *plc = NULL;
......@@ -1595,7 +1595,7 @@ CQueryMutators::FNeedsWindowPrLNormalization
const Query *pquery
)
{
if (!pquery->hasWindFuncs)
if (!pquery->hasWindowFuncs)
{
return false;
}
......@@ -1759,7 +1759,7 @@ CQueryMutators::PqueryNormalizeWindowPrL
GPOS_ASSERT(gpdb::UlListLength(pqueryNew->targetList) <= gpdb::UlListLength(pquery->targetList));
pqueryNew->hasWindFuncs = false;
pqueryNew->hasWindowFuncs = false;
ReassignSortClause(pqueryNew, pqueryDrdTbl);
return pqueryNew;
......
......@@ -2826,7 +2826,7 @@ _copyQuery(Query *from)
COPY_SCALAR_FIELD(resultRelation);
COPY_NODE_FIELD(intoClause);
COPY_SCALAR_FIELD(hasAggs);
COPY_SCALAR_FIELD(hasWindFuncs);
COPY_SCALAR_FIELD(hasWindowFuncs);
COPY_SCALAR_FIELD(hasSubLinks);
COPY_SCALAR_FIELD(hasDynamicFunctions);
COPY_NODE_FIELD(rtable);
......
......@@ -840,7 +840,7 @@ _equalQuery(Query *a, Query *b)
COMPARE_SCALAR_FIELD(resultRelation);
COMPARE_NODE_FIELD(intoClause);
COMPARE_SCALAR_FIELD(hasAggs);
COMPARE_SCALAR_FIELD(hasWindFuncs);
COMPARE_SCALAR_FIELD(hasWindowFuncs);
COMPARE_SCALAR_FIELD(hasSubLinks);
COMPARE_SCALAR_FIELD(hasDynamicFunctions);
COMPARE_NODE_FIELD(rtable);
......
......@@ -894,7 +894,7 @@ _outQuery(StringInfo str, Query *node)
WRITE_INT_FIELD(resultRelation);
WRITE_NODE_FIELD(intoClause);
WRITE_BOOL_FIELD(hasAggs);
WRITE_BOOL_FIELD(hasWindFuncs);
WRITE_BOOL_FIELD(hasWindowFuncs);
WRITE_BOOL_FIELD(hasSubLinks);
WRITE_BOOL_FIELD(hasDynamicFunctions);
WRITE_NODE_FIELD(rtable);
......
......@@ -3493,7 +3493,7 @@ _outQuery(StringInfo str, Query *node)
WRITE_INT_FIELD(resultRelation);
WRITE_NODE_FIELD(intoClause);
WRITE_BOOL_FIELD(hasAggs);
WRITE_BOOL_FIELD(hasWindFuncs);
WRITE_BOOL_FIELD(hasWindowFuncs);
WRITE_BOOL_FIELD(hasSubLinks);
WRITE_BOOL_FIELD(hasDynamicFunctions);
WRITE_NODE_FIELD(rtable);
......
......@@ -228,7 +228,7 @@ _readQuery(void)
READ_INT_FIELD(resultRelation);
READ_NODE_FIELD(intoClause);
READ_BOOL_FIELD(hasAggs);
READ_BOOL_FIELD(hasWindFuncs);
READ_BOOL_FIELD(hasWindowFuncs);
READ_BOOL_FIELD(hasSubLinks);
READ_BOOL_FIELD(hasDynamicFunctions);
READ_NODE_FIELD(rtable);
......
......@@ -322,7 +322,7 @@ _readQuery(void)
READ_INT_FIELD(resultRelation);
READ_NODE_FIELD(intoClause);
READ_BOOL_FIELD(hasAggs);
READ_BOOL_FIELD(hasWindFuncs);
READ_BOOL_FIELD(hasWindowFuncs);
READ_BOOL_FIELD(hasSubLinks);
READ_BOOL_FIELD(hasDynamicFunctions);
READ_NODE_FIELD(rtable);
......
......@@ -296,7 +296,7 @@ window_planner(PlannerInfo *root, double tuple_fraction, List **pathkeys_ptr)
/* Assert existence of windowing in query. */
Assert(parse->targetList != NIL);
Assert(parse->windowClause != NULL);
Assert(parse->hasWindFuncs);
Assert(parse->hasWindowFuncs);
/* Assert no unsupported stuff */
Assert(parse->setOperations == NULL);
Assert(!parse->hasAggs);
......@@ -1303,7 +1303,7 @@ make_lower_targetlist(Query *parse,
SortClause *dummy;
ListCell *lc;
Assert ( parse->hasWindFuncs );
Assert ( parse->hasWindowFuncs );
/* Start with a "flattened" tlist (having just the vars mentioned in
* the targetlist or the window clause --- but no upper-level Vars;
......@@ -3958,7 +3958,7 @@ Plan *wrap_plan(PlannerInfo *root, Plan *plan, Query *query,
subquery->resultRelation = 0;
subquery->intoClause = NULL;
subquery->hasAggs = false;
subquery->hasWindFuncs = false;
subquery->hasWindowFuncs = false;
subquery->hasSubLinks = false;
subquery->returningList = NIL;
subquery->groupClause = NIL;
......@@ -4084,7 +4084,7 @@ Query *copy_common_subquery(Query *original, List *targetList)
common->resultRelation = 0;
common->utilityStmt = NULL;
common->intoClause = NULL;
common->hasWindFuncs = false;
common->hasWindowFuncs = false;
common->hasSubLinks = false; /* XXX */
common->returningList = NIL;
common->distinctClause = NIL;
......
......@@ -716,7 +716,7 @@ is_simple_subquery(PlannerInfo *root, Query *subquery)
* limiting, or WITH. (XXX WITH could possibly be allowed later)
*/
if (subquery->hasAggs ||
subquery->hasWindFuncs ||
subquery->hasWindowFuncs ||
subquery->groupClause ||
subquery->havingQual ||
subquery->windowClause ||
......
......@@ -809,7 +809,7 @@ transformInsertStmt(ParseState *pstate, InsertStmt *stmt)
errmsg("cannot use aggregate function in VALUES"),
parser_errposition(pstate,
locate_agg_of_level((Node *) qry, 0))));
if (pstate->p_hasWindFuncs)
if (pstate->p_hasWindowFuncs)
ereport(ERROR,
(errcode(ERRCODE_WINDOWING_ERROR),
errmsg("cannot use window function in VALUES")));
......@@ -918,7 +918,7 @@ transformGroupedWindows(Query *qry)
Assert(!PointerIsValid(qry->utilityStmt));
Assert(qry->returningList == NIL);
if ( !qry->hasWindFuncs || !(qry->groupClause || qry->hasAggs) )
if ( !qry->hasWindowFuncs || !(qry->groupClause || qry->hasAggs) )
return qry;
/* Make the new subquery (Q''). Note that (per SQL:2003) there
......@@ -933,7 +933,7 @@ transformGroupedWindows(Query *qry)
subq->resultRelation = 0;
subq->intoClause = NULL;
subq->hasAggs = qry->hasAggs;
subq->hasWindFuncs = false; /* reevaluate later */
subq->hasWindowFuncs = false; /* reevaluate later */
subq->hasSubLinks = qry->hasSubLinks; /* reevaluate later */
/* Core of subquery input table expression: */
......@@ -953,10 +953,10 @@ transformGroupedWindows(Query *qry)
subq->setOperations = NULL;
/* Check if there is a window function in the join tree. If so
* we must mark hasWindFuncs in the sub query as well.
* we must mark hasWindowFuncs in the sub query as well.
*/
if (checkExprHasWindFuncs((Node *)subq->jointree))
subq->hasWindFuncs = true;
subq->hasWindowFuncs = true;
/* Make the single range table entry for the outer query Q' as
* a wrapper for the subquery (Q'') currently under construction.
......@@ -1652,8 +1652,8 @@ transformSelectStmt(ParseState *pstate, SelectStmt *stmt)
if (pstate->p_hasTblValueExpr)
parseCheckTableFunctions(pstate, qry);
qry->hasWindFuncs = pstate->p_hasWindFuncs;
if (pstate->p_hasWindFuncs)
qry->hasWindowFuncs = pstate->p_hasWindowFuncs;
if (pstate->p_hasWindowFuncs)
parseProcessWindFuncs(pstate, qry);
......@@ -1666,7 +1666,7 @@ transformSelectStmt(ParseState *pstate, SelectStmt *stmt)
* If the query mixes window functions and aggregates, we need to
* transform it such that the grouped query appears as a subquery
*/
if (qry->hasWindFuncs && (qry->groupClause || qry->hasAggs))
if (qry->hasWindowFuncs && (qry->groupClause || qry->hasAggs))
transformGroupedWindows(qry);
return qry;
......@@ -1882,7 +1882,7 @@ transformValuesClause(ParseState *pstate, SelectStmt *stmt)
errmsg("cannot use aggregate function in VALUES"),
parser_errposition(pstate,
locate_agg_of_level((Node *) newExprsLists, 0))));
if (pstate->p_hasWindFuncs)
if (pstate->p_hasWindowFuncs)
ereport(ERROR,
(errcode(ERRCODE_WINDOWING_ERROR),
errmsg("cannot use window function in VALUES")));
......@@ -2744,7 +2744,7 @@ transformUpdateStmt(ParseState *pstate, UpdateStmt *stmt)
errmsg("cannot use aggregate function in UPDATE"),
parser_errposition(pstate,
locate_agg_of_level((Node *) qry, 0))));
if (pstate->p_hasWindFuncs)
if (pstate->p_hasWindowFuncs)
ereport(ERROR,
(errcode(ERRCODE_WINDOWING_ERROR),
errmsg("cannot use window function in UPDATE")));
......@@ -2853,7 +2853,7 @@ transformReturningList(ParseState *pstate, List *returningList)
(errcode(ERRCODE_GROUPING_ERROR),
errmsg("cannot use aggregate function in RETURNING")));
if (pstate->p_hasWindFuncs)
if (pstate->p_hasWindowFuncs)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("cannot use window function in RETURNING")));
......@@ -3044,7 +3044,7 @@ CheckSelectLocking(Query *qry)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("SELECT FOR UPDATE/SHARE is not allowed with aggregate functions")));
if (qry->hasWindFuncs)
if (qry->hasWindowFuncs)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("SELECT FOR UPDATE/SHARE is not allowed with window functions")));
......
......@@ -121,7 +121,7 @@ check_call(ParseState *pstate, Node *call)
if (is_agg)
pstate->p_hasAggs = true;
else
pstate->p_hasWindFuncs = true;
pstate->p_hasWindowFuncs = true;
}
/*
......@@ -212,7 +212,7 @@ transformWindowFuncCall(ParseState *pstate, WindowRef *wind,
check_call(pstate, (Node *)wind);
pstate->p_hasWindFuncs = true;
pstate->p_hasWindowFuncs = true;
}
/*
......@@ -995,7 +995,7 @@ void
parseProcessWindFuncs(ParseState *pstate, Query *qry)
{
/* This should only be called if we found window functions */
Assert(pstate->p_hasWindFuncs);
Assert(pstate->p_hasWindowFuncs);
/*
* Window functions must never appear in WHERE or
......
......@@ -708,7 +708,7 @@ transformWindowClause(ParseState *pstate, Query *qry)
/* If there are no window functions in the targetlist,
* forget the window clause.
*/
if (!pstate->p_hasWindFuncs)
if (!pstate->p_hasWindowFuncs)
{
pstate->p_win_clauses = NIL;
qry->windowClause = NIL;
......@@ -2851,7 +2851,7 @@ transformDistinctClause(ParseState *pstate, List *distinctlist,
{
/* We had SELECT DISTINCT */
if (!pstate->p_hasAggs && !pstate->p_hasWindFuncs && *groupClause == NIL)
if (!pstate->p_hasAggs && !pstate->p_hasWindowFuncs && *groupClause == NIL)
{
/*
* MPP-15040
......
......@@ -2803,7 +2803,7 @@ transformRuleStmt(RuleStmt *stmt, const char *queryString,
(errcode(ERRCODE_GROUPING_ERROR),
errmsg("cannot use aggregate function in rule WHERE condition")));
if (pstate->p_hasWindFuncs)
if (pstate->p_hasWindowFuncs)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("cannot use window function in rule WHERE condition")));
......
......@@ -120,7 +120,7 @@ typedef struct Query
IntoClause *intoClause; /* target for SELECT INTO / CREATE TABLE AS */
bool hasAggs; /* has aggregates in tlist or havingQual */
bool hasWindFuncs; /* has window function(s) in target list */
bool hasWindowFuncs; /* has window functions in tlist */
bool hasSubLinks; /* has subquery SubLink */
bool hasDynamicFunctions; /* has functions with unstable return types */
......
......@@ -84,7 +84,7 @@ typedef struct ParseState
Node *p_value_substitute; /* what to replace VALUE with, if any */
bool p_variableparams;
bool p_hasAggs;
bool p_hasWindFuncs;
bool p_hasWindowFuncs;
bool p_hasSubLinks;
bool p_hasModifyingCTE;
bool p_is_insert;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册