You can subscribe to this list here.
2010 |
Jan
|
Feb
|
Mar
|
Apr
(4) |
May
(28) |
Jun
(12) |
Jul
(11) |
Aug
(12) |
Sep
(5) |
Oct
(19) |
Nov
(14) |
Dec
(12) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2011 |
Jan
(18) |
Feb
(30) |
Mar
(115) |
Apr
(89) |
May
(50) |
Jun
(44) |
Jul
(22) |
Aug
(13) |
Sep
(11) |
Oct
(30) |
Nov
(28) |
Dec
(39) |
2012 |
Jan
(38) |
Feb
(18) |
Mar
(43) |
Apr
(91) |
May
(108) |
Jun
(46) |
Jul
(37) |
Aug
(44) |
Sep
(33) |
Oct
(29) |
Nov
(36) |
Dec
(15) |
2013 |
Jan
(35) |
Feb
(611) |
Mar
(5) |
Apr
(55) |
May
(30) |
Jun
(28) |
Jul
(458) |
Aug
(34) |
Sep
(9) |
Oct
(39) |
Nov
(22) |
Dec
(32) |
2014 |
Jan
(16) |
Feb
(16) |
Mar
(42) |
Apr
(179) |
May
(7) |
Jun
(6) |
Jul
(9) |
Aug
|
Sep
(4) |
Oct
|
Nov
(3) |
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(4) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
1
(2) |
2
(3) |
3
|
4
|
5
|
6
(2) |
7
(1) |
8
|
9
(4) |
10
|
11
|
12
|
13
|
14
(1) |
15
(1) |
16
(1) |
17
|
18
|
19
|
20
|
21
(1) |
22
|
23
|
24
(2) |
25
|
26
|
27
(2) |
28
(1) |
29
(1) |
30
(22) |
|
|
From: Michael P. <mic...@us...> - 2011-06-27 23:57:33
|
Project "Postgres-XC". The branch, master has been updated via 1401d725b719ac2b6de45ace6e6bfd1a7413bc66 (commit) from 805bb9aeb9aeddc8db1283e4724c108941785e8b (commit) - Log ----------------------------------------------------------------- commit 1401d725b719ac2b6de45ace6e6bfd1a7413bc66 Author: Michael P <mic...@us...> Date: Tue Jun 28 08:41:12 2011 +0900 Fix for bug 3324377: DBT-1 error with varchar This commit makes XC planner a little bit smarter for a query containing literal expression and parent-child expressions in where clauses. For SELECT queries of the type: SELECT * FROM table1,table2 WHERE table1 = 1 AND table2.column = table1.column; XC planner was trying to target more nodes than necessary by not completely analyze the parent-child join conditions. diff --git a/src/backend/pgxc/plan/planner.c b/src/backend/pgxc/plan/planner.c index 52f3a0a..240e669 100644 --- a/src/backend/pgxc/plan/planner.c +++ b/src/backend/pgxc/plan/planner.c @@ -208,7 +208,7 @@ strpos(char *str, char *substr) * True if both lists contain only one node and are the same */ static bool -same_single_node (List *nodelist1, List *nodelist2) +same_single_node(List *nodelist1, List *nodelist2) { return nodelist1 && list_length(nodelist1) == 1 && nodelist2 && list_length(nodelist2) == 1 @@ -1096,46 +1096,6 @@ examine_conditions_walker(Node *expr_node, XCWalkerContext *context) if (!rel_loc_info1) return true; - /* Check if this constant expression is targetting multiple tables */ - if (list_length(context->query->rtable) > 1) - { - ListCell *lc; - RangeTblEntry *save_rte = NULL; - RelationLocInfo *save_loc_info; - - foreach(lc, context->query->rtable) - { - RangeTblEntry *rte = lfirst(lc); - - if (!save_rte) - { - save_rte = rte; - save_loc_info = GetRelationLocInfo(save_rte->relid); - } - else - { - /* - * If there are two distributed tables at least - * among the multiple tables, push down the query to all nodes. - */ - if (save_rte->relid != rte->relid) - { - RelationLocInfo *loc_info = GetRelationLocInfo(rte->relid); - - if (loc_info->locatorType != LOCATOR_TYPE_REPLICATED && - save_loc_info->locatorType != LOCATOR_TYPE_REPLICATED) - return true; - if (loc_info->locatorType != LOCATOR_TYPE_REPLICATED && - save_loc_info->locatorType == LOCATOR_TYPE_REPLICATED) - { - save_rte = rte; - save_loc_info = loc_info; - } - } - } - } - } - /* If hash or modulo partitioned, check if the part column was used */ if (IsHashColumn(rel_loc_info1, column_base->colname) || IsModuloColumn(rel_loc_info1, column_base->colname)) @@ -1361,7 +1321,8 @@ examine_conditions_walker(Node *expr_node, XCWalkerContext *context) if (save_exec_nodes->tableusagetype != TABLE_USAGE_TYPE_USER_REPLICATED) { /* See if they run on the same node */ - if (same_single_node (context->query_step->exec_nodes->nodelist, save_exec_nodes->nodelist)) + if (same_single_node(context->query_step->exec_nodes->nodelist, + save_exec_nodes->nodelist)) return false; } else @@ -1622,7 +1583,7 @@ get_plan_nodes_walker(Node *query_node, XCWalkerContext *context) else { /* Allow if they are both using one node, and the same one */ - if (!same_single_node (from_query_nodes->nodelist, current_nodes->nodelist)) + if (!same_single_node(from_query_nodes->nodelist, current_nodes->nodelist)) /* Complicated */ return true; } @@ -1730,7 +1691,8 @@ get_plan_nodes_walker(Node *query_node, XCWalkerContext *context) * If the query is rewritten (which can be due to rules or views), * ignore extra stuff. Also ignore subqueries we have processed */ - if ((!rte->inFromCl && query->commandType == CMD_SELECT) || rte->rtekind != RTE_RELATION) + if ((!rte->inFromCl && query->commandType == CMD_SELECT) || + rte->rtekind != RTE_RELATION) continue; /* PGXCTODO - handle RTEs that are functions */ @@ -1756,7 +1718,10 @@ get_plan_nodes_walker(Node *query_node, XCWalkerContext *context) if (rel_loc_info->locatorType != LOCATOR_TYPE_HASH && rel_loc_info->locatorType != LOCATOR_TYPE_MODULO) /* do not need to determine partitioning expression */ - context->query_step->exec_nodes = GetRelationNodes(rel_loc_info, 0, UNKNOWNOID, context->accessType); + context->query_step->exec_nodes = GetRelationNodes(rel_loc_info, + 0, + UNKNOWNOID, + context->accessType); /* Note replicated table usage for determining safe queries */ if (context->query_step->exec_nodes) @@ -1765,9 +1730,12 @@ get_plan_nodes_walker(Node *query_node, XCWalkerContext *context) table_usage_type = TABLE_USAGE_TYPE_USER_REPLICATED; context->query_step->exec_nodes->tableusagetype = table_usage_type; - } else if (context->conditions->partitioned_expressions) { + } + else if (context->conditions->partitioned_expressions) + { /* probably we can determine nodes on execution time */ - foreach(lc, context->conditions->partitioned_expressions) { + foreach(lc, context->conditions->partitioned_expressions) + { Expr_Comparison *expr_comp = (Expr_Comparison *) lfirst(lc); if (rel_loc_info->relid == expr_comp->relid) { @@ -1784,7 +1752,9 @@ get_plan_nodes_walker(Node *query_node, XCWalkerContext *context) break; } } - } else { + } + else + { /* run query on all nodes */ context->query_step->exec_nodes = makeNode(ExecNodes); context->query_step->exec_nodes->baselocatortype = @@ -1802,9 +1772,56 @@ get_plan_nodes_walker(Node *query_node, XCWalkerContext *context) /* check for partitioned col comparison against a literal */ else if (list_length(context->conditions->partitioned_literal_comps) > 0) { + bool is_single_node_safe = true; + context->query_step->exec_nodes = NULL; /* + * We may have a literal comparison with a parent-child join + * on a distributed table. In this case choose node targetting the column. + * But first check if it is targetting multiple distributed tables. + */ + if (list_length(context->query->rtable) > 1 && + !context->conditions->partitioned_parent_child) + { + ListCell *lc; + RangeTblEntry *save_rte = NULL; + RelationLocInfo *save_loc_info; + + foreach(lc, context->query->rtable) + { + RangeTblEntry *rte = lfirst(lc); + + if (!save_rte) + { + save_rte = rte; + save_loc_info = GetRelationLocInfo(save_rte->relid); + } + else + { + /* + * If there are two distributed tables at least + * among target tables, push down the query to all nodes. + */ + if (save_rte->relid != rte->relid) + { + RelationLocInfo *loc_info = GetRelationLocInfo(rte->relid); + + if (loc_info->locatorType != LOCATOR_TYPE_REPLICATED && + save_loc_info->locatorType != LOCATOR_TYPE_REPLICATED) + is_single_node_safe = false; + if (loc_info->locatorType != LOCATOR_TYPE_REPLICATED && + save_loc_info->locatorType == LOCATOR_TYPE_REPLICATED) + { + save_rte = rte; + save_loc_info = loc_info; + } + } + } + } + } + + /* * Make sure that if there are multiple such comparisons, that they * are all on the same nodes. */ @@ -1812,17 +1829,22 @@ get_plan_nodes_walker(Node *query_node, XCWalkerContext *context) { Literal_Comparison *lit_comp = (Literal_Comparison *) lfirst(lc); - test_exec_nodes = GetRelationNodes(lit_comp->rel_loc_info, lit_comp->constValue, lit_comp->constType, RELATION_ACCESS_READ); + test_exec_nodes = GetRelationNodes(lit_comp->rel_loc_info, + lit_comp->constValue, + lit_comp->constType, + RELATION_ACCESS_READ); test_exec_nodes->tableusagetype = table_usage_type; - if (context->query_step->exec_nodes == NULL) + if (is_single_node_safe && + context->query_step->exec_nodes == NULL) context->query_step->exec_nodes = test_exec_nodes; else { - if (!same_single_node(context->query_step->exec_nodes->nodelist, test_exec_nodes->nodelist)) - { + if (context->query_step->exec_nodes == NULL || + !is_single_node_safe || + !same_single_node(context->query_step->exec_nodes->nodelist, + test_exec_nodes->nodelist)) return true; - } } } } @@ -1838,7 +1860,10 @@ get_plan_nodes_walker(Node *query_node, XCWalkerContext *context) parent_child = (Parent_Child_Join *) linitial(context->conditions->partitioned_parent_child); - context->query_step->exec_nodes = GetRelationNodes(parent_child->rel_loc_info1, 0, UNKNOWNOID, context->accessType); + context->query_step->exec_nodes = GetRelationNodes(parent_child->rel_loc_info1, + 0, + UNKNOWNOID, + context->accessType); context->query_step->exec_nodes->tableusagetype = table_usage_type; } @@ -1853,7 +1878,8 @@ get_plan_nodes_walker(Node *query_node, XCWalkerContext *context) * same node */ else if (from_query_nodes->tableusagetype == TABLE_USAGE_TYPE_USER_REPLICATED - || (same_single_node(from_query_nodes->nodelist, context->query_step->exec_nodes->nodelist))) + || (same_single_node(from_query_nodes->nodelist, + context->query_step->exec_nodes->nodelist))) return false; else { @@ -2355,8 +2381,8 @@ make_simple_sort_from_sortclauses(Query *query, RemoteQuery *step) * been removed because of duplicate ORDER BY entry. Check original * DISTINCT clause, if expression is there continue iterating. * 3c. DISTINCT and ORDER BY are not compatible, emit error - * 4. DISTINCT and ORDER BY are compatible, if we have remaining items - * in the working copy we should append it to the order by list + * 4. DISTINCT and ORDER BY are compatible, if we have remaining items + * in the working copy we should append it to the order by list */ /* * Create the list of unique DISTINCT clause expressions @@ -2945,8 +2971,8 @@ free_query_step(RemoteQuery *query_step) * * RemoteQuery *innernode - the inner node * RemoteQuery *outernode - the outer node - * List *rtable_list - rtables - * JoinPath *join_path - used to examine join restrictions + * List *rtable_list - rtables + * JoinPath *join_path - used to examine join restrictions * PGXCJoinInfo *join_info - contains info about the join reduction * join_info->partitioned_replicated is set to true if we have a partitioned-replicated * join. We want to use replicated tables with non-replicated @@ -3199,7 +3225,10 @@ GetHashExecNodes(RelationLocInfo *rel_loc_info, ExecNodes **exec_nodes, const Ex constant = (Const *) checkexpr; /* single call handles both replicated and partitioned types */ - *exec_nodes = GetRelationNodes(rel_loc_info, constant->constvalue, constant->consttype, RELATION_ACCESS_INSERT); + *exec_nodes = GetRelationNodes(rel_loc_info, + constant->constvalue, + constant->consttype, + RELATION_ACCESS_INSERT); if (eval_expr) pfree(eval_expr); ----------------------------------------------------------------------- Summary of changes: src/backend/pgxc/plan/planner.c | 149 +++++++++++++++++++++++---------------- 1 files changed, 89 insertions(+), 60 deletions(-) hooks/post-receive -- Postgres-XC |
From: Ashutosh B. <ash...@us...> - 2011-06-27 06:44:54
|
Project "Postgres-XC". The branch, master has been updated via 805bb9aeb9aeddc8db1283e4724c108941785e8b (commit) from ff7be6e332b36fc7aad99876bf107e258264a7f1 (commit) - Log ----------------------------------------------------------------- commit 805bb9aeb9aeddc8db1283e4724c108941785e8b Author: Ashutosh Bapat <ash...@en...> Date: Mon Jun 27 12:05:43 2011 +0530 For every aggregate, we expect that the collection function is such that, it being applied on the transition results from datanode, should produce the same result as that produced by only transition function being applied on all qualifying rows. This condition allows us to apply final function directly on transition result (in case transition phase takes place on coordinator) or collection result (in case transition phase takes place on datanodes and collection phase is applied on the coordinator), producing same aggregation results at the end. This also means that, on a given node (data or coordinator) only one of the transition or collection phases is applied not both. Hence, we don't need to apply collection after transition, when transition phase takes place on coordinator. This also renders aggcollecttype from pg_aggregate useless, hence removed the column aggcollecttype from catalog pg_aggregate. The input and output type of collection phase is aggtranstype. There is no need for separate collecttypeLen and collecttypeByVal members in AggStatePerAggData, that purpose is served by transtypeLen and transtypeByVal diff --git a/src/backend/catalog/pg_aggregate.c b/src/backend/catalog/pg_aggregate.c index f80874d..6971dc1 100644 --- a/src/backend/catalog/pg_aggregate.c +++ b/src/backend/catalog/pg_aggregate.c @@ -54,7 +54,6 @@ AggregateCreate(const char *aggName, List *aggsortopName, Oid aggTransType, #ifdef PGXC - Oid aggCollectType, const char *agginitval, const char *agginitcollect) #else @@ -175,30 +174,25 @@ AggregateCreate(const char *aggName, #ifdef PGXC /* - * Collection function must be of two arguments - * First must be of aggCollectType, second must be of aggTransType - * Return value must be of aggCollectType + * Collection function must be of two arguments, both of type aggTransType + * and return type is also aggTransType */ - fnArgs[0] = aggCollectType; + fnArgs[0] = aggTransType; fnArgs[1] = aggTransType; collectfn = lookup_agg_function(aggcollectfnName, 2, fnArgs, &rettype); - if (rettype != aggCollectType) + if (rettype != aggTransType) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), errmsg("return type of collection function %s is not %s", NameListToString(aggcollectfnName), - format_type_be(aggCollectType)))); + format_type_be(aggTransType)))); #endif /* handle finalfn, if supplied */ if (aggfinalfnName) { -#ifdef PGXC - fnArgs[0] = aggCollectType; -#else fnArgs[0] = aggTransType; -#endif finalfn = lookup_agg_function(aggfinalfnName, 1, fnArgs, &finaltype); } @@ -207,11 +201,7 @@ AggregateCreate(const char *aggName, /* * If no finalfn, aggregate result type is type of the state value */ -#ifdef PGXC - finaltype = aggCollectType; -#else finaltype = aggTransType; -#endif } Assert(OidIsValid(finaltype)); @@ -302,7 +292,6 @@ AggregateCreate(const char *aggName, values[Anum_pg_aggregate_aggtranstype - 1] = ObjectIdGetDatum(aggTransType); #ifdef PGXC values[Anum_pg_aggregate_aggcollectfn - 1] = ObjectIdGetDatum(collectfn); - values[Anum_pg_aggregate_aggcollecttype - 1] = ObjectIdGetDatum(aggCollectType); #endif if (agginitval) values[Anum_pg_aggregate_agginitval - 1] = CStringGetTextDatum(agginitval); diff --git a/src/backend/commands/aggregatecmds.c b/src/backend/commands/aggregatecmds.c index e73464b..6b9f86e 100644 --- a/src/backend/commands/aggregatecmds.c +++ b/src/backend/commands/aggregatecmds.c @@ -139,6 +139,10 @@ DefineAggregate(List *name, List *args, bool oldstyle, List *parameters) ereport(ERROR, (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), errmsg("aggregate cfunc must be specified"))); + if (collectType != transType) + ereport(ERROR, + (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION), + errmsg("aggregate ctype should be same as aggregate stype"))); #endif /* @@ -247,7 +251,6 @@ DefineAggregate(List *name, List *args, bool oldstyle, List *parameters) sortoperatorName, /* sort operator name */ transTypeId, /* transition data type */ #ifdef PGXC - collectTypeId, /* collection data type */ initval, /* initial condition */ initcollect); /* initial condition for collection function */ #else diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c index ae60a76..215ed5f 100644 --- a/src/backend/executor/nodeAgg.c +++ b/src/backend/executor/nodeAgg.c @@ -176,15 +176,9 @@ typedef struct AggStatePerAggData int16 inputtypeLen, resulttypeLen, transtypeLen; -#ifdef PGXC - int16 collecttypeLen; -#endif /* PGXC */ bool inputtypeByVal, resulttypeByVal, transtypeByVal; -#ifdef PGXC - bool collecttypeByVal; -#endif /* PGXC */ /* * Stuff for evaluation of inputs. We used to just use ExecEvalExpr, but @@ -388,6 +382,7 @@ initialize_aggregates(AggState *aggstate, * * Note that when the initial value is pass-by-ref, we must copy it * (into the aggcontext) since we will pfree the collectValue later. + * collection type is same as transition type. */ if (peraggstate->initCollectValueIsNull) pergroupstate->collectValue = peraggstate->initCollectValue; @@ -397,8 +392,8 @@ initialize_aggregates(AggState *aggstate, oldContext = MemoryContextSwitchTo(aggstate->aggcontext); pergroupstate->collectValue = datumCopy(peraggstate->initCollectValue, - peraggstate->collecttypeByVal, - peraggstate->collecttypeLen); + peraggstate->transtypeByVal, + peraggstate->transtypeLen); MemoryContextSwitchTo(oldContext); } pergroupstate->collectValueIsNull = peraggstate->initCollectValueIsNull; @@ -557,22 +552,16 @@ advance_collection_function(AggState *aggstate, if (pergroupstate->noCollectValue) { /* - * collection result has not been initialized + * collection result has not been initialized. This is the first non-NULL + * transition value. We use it as the initial value for collectValue. + * Aggregate's transition and collection type are same * We must copy the datum into result if it is pass-by-ref. We * do not need to pfree the old result, since it's NULL. - * PGXCTODO: in case the transition result type is different from - * collection result type, this code would not work, since we are - * assigning datum of one type to another. For this code to work the - * input and output of collection function needs to be binary - * compatible which is not. So, either check in AggregateCreate, - * that the input and output of collection function are binary - * coercible or set the initial values something non-null or change - * this code */ oldContext = MemoryContextSwitchTo(aggstate->aggcontext); pergroupstate->collectValue = datumCopy(fcinfo->arg[1], - peraggstate->collecttypeByVal, - peraggstate->collecttypeLen); + peraggstate->transtypeByVal, + peraggstate->transtypeLen); pergroupstate->collectValueIsNull = false; pergroupstate->noCollectValue = false; MemoryContextSwitchTo(oldContext); @@ -606,15 +595,15 @@ advance_collection_function(AggState *aggstate, * pfree the prior transValue. But if collectfn returned a pointer to its * first input, we don't need to do anything. */ - if (!peraggstate->collecttypeByVal && + if (!peraggstate->transtypeByVal && DatumGetPointer(newVal) != DatumGetPointer(pergroupstate->collectValue)) { if (!fcinfo->isnull) { MemoryContextSwitchTo(aggstate->aggcontext); newVal = datumCopy(newVal, - peraggstate->collecttypeByVal, - peraggstate->collecttypeLen); + peraggstate->transtypeByVal, + peraggstate->transtypeLen); } if (!pergroupstate->collectValueIsNull) pfree(DatumGetPointer(pergroupstate->collectValue)); @@ -909,51 +898,6 @@ finalize_aggregate(AggState *aggstate, oldContext = MemoryContextSwitchTo(aggstate->ss.ps.ps_ExprContext->ecxt_per_tuple_memory); #ifdef PGXC /* - * PGXCTODO: see PGXCTODO item in advance_collect_function - * this step is needed in case the transition function does not produce - * result consumable by final function and need collection function to be - * applied on transition function results. Usually results by both functions - * should be consumable by final function. - * As such this step is meant only to convert transition results into form - * consumable by final function, the step does not actually do any - * collection. Skipping transitionp means, that the collection - * phase is over and we need to apply final function directly. - */ - if (OidIsValid(peraggstate->collectfn_oid) && !aggstate->skip_trans) - { - FunctionCallInfoData fcinfo; - int saved_numArguments; - InitFunctionCallInfoData(fcinfo, &(peraggstate->collectfn), 2, - (void *) aggstate, NULL); - /* - * copy the initial datum since it might get changed inside the - * collection function - */ - if (peraggstate->initCollectValueIsNull) - fcinfo.arg[0] = peraggstate->initCollectValue; - else - fcinfo.arg[0] = datumCopy(peraggstate->initCollectValue, - peraggstate->collecttypeByVal, - peraggstate->collecttypeLen); - fcinfo.argnull[0] = peraggstate->initCollectValueIsNull; - fcinfo.arg[1] = pergroupstate->transValue; - fcinfo.argnull[1] = pergroupstate->transValueIsNull; - /* - * For collection function we expect only one argument other than the - * running collection result. The numArguments in peraggstate - * corresponds to the number of arguments to the aggregate, which is not - * correct for collection. Hence while applying collection function - * set numArguments to 1 and switch it back once the purpose is served. - */ - saved_numArguments = peraggstate->numArguments; - peraggstate->numArguments = 1; - advance_collection_function(aggstate, peraggstate, pergroupstate, &fcinfo); - peraggstate->numArguments = saved_numArguments; - pergroupstate->transValue = pergroupstate->collectValue; - pergroupstate->transValueIsNull = pergroupstate->collectValueIsNull; - } - - /* * if we skipped the transition phase, we have the collection result in the * collectValue, move it to transValue for finalization to work on */ @@ -1945,14 +1889,14 @@ ExecInitAgg(Agg *node, EState *estate, int eflags) Expr *dummyexpr; /* * for XC, we need to setup the collection function expression as well. - * Use the same function with invalid final function oid, and collection + * Use build_aggregate_fnexpr() with invalid final function oid, and collection * function information instead of transition function information. * PGXCTODO: we should really be adding this step inside * build_aggregate_fnexprs() but this way it becomes easy to merge. */ - build_aggregate_fnexprs(&aggform->aggtranstype, + build_aggregate_fnexprs(&aggtranstype, 1, - aggform->aggcollecttype, + aggtranstype, aggref->aggtype, collectfn_oid, InvalidOid, @@ -1985,11 +1929,6 @@ ExecInitAgg(Agg *node, EState *estate, int eflags) get_typlenbyval(aggtranstype, &peraggstate->transtypeLen, &peraggstate->transtypeByVal); -#ifdef PGXC - get_typlenbyval(aggform->aggcollecttype, - &peraggstate->collecttypeLen, - &peraggstate->collecttypeByVal); -#endif /* PGXC */ /* * initval is potentially null, so don't try to access it as a struct @@ -2019,7 +1958,7 @@ ExecInitAgg(Agg *node, EState *estate, int eflags) peraggstate->initCollectValue = (Datum) 0; else peraggstate->initCollectValue = GetAggInitVal(textInitVal, - aggform->aggcollecttype); + aggtranstype); #endif /* PGXC */ /* diff --git a/src/include/catalog/pg_aggregate.h b/src/include/catalog/pg_aggregate.h index d53a632..5c2103c 100644 --- a/src/include/catalog/pg_aggregate.h +++ b/src/include/catalog/pg_aggregate.h @@ -40,9 +40,6 @@ * aggfinalfn final function (0 if none) * aggsortop associated sort operator (0 if none) * aggtranstype type of aggregate's transition (state) data -#ifdef PGXC - * aggcollecttype type of aggregate's collection (state) data -#endif * agginitval initial value for transition state (can be NULL) #ifdef PGXC * agginitcollect initial value for collection state (can be NULL) @@ -58,8 +55,9 @@ CATALOG(pg_aggregate,2600) BKI_WITHOUT_OIDS regproc aggcollectfn; /* PGXC */ regproc aggfinalfn; Oid aggsortop; - Oid aggtranstype; - Oid aggcollecttype; /* PGXC */ + Oid aggtranstype; /* also serves as the input and output type + * of aggcollectfn + */ text agginitval; /* VARIABLE LENGTH FIELD */ text agginitcollect; /* PGXC, VARIABLE LENGTH FIELD */ } FormData_pg_aggregate; @@ -77,16 +75,15 @@ typedef FormData_pg_aggregate *Form_pg_aggregate; */ #ifdef PGXC -#define Natts_pg_aggregate 9 +#define Natts_pg_aggregate 8 #define Anum_pg_aggregate_aggfnoid 1 #define Anum_pg_aggregate_aggtransfn 2 #define Anum_pg_aggregate_aggcollectfn 3 #define Anum_pg_aggregate_aggfinalfn 4 #define Anum_pg_aggregate_aggsortop 5 #define Anum_pg_aggregate_aggtranstype 6 -#define Anum_pg_aggregate_aggcollecttype 7 -#define Anum_pg_aggregate_agginitval 8 -#define Anum_pg_aggregate_agginitcollect 9 +#define Anum_pg_aggregate_agginitval 7 +#define Anum_pg_aggregate_agginitcollect 8 #endif #ifdef PGXC //#define Natts_pg_aggregate 6 @@ -106,13 +103,13 @@ typedef FormData_pg_aggregate *Form_pg_aggregate; /* avg */ #ifdef PGXC -DATA(insert ( 2100 int8_avg_accum numeric_avg_collect numeric_avg 0 1231 1231 "{0,0}" "{0,0}" )); -DATA(insert ( 2101 int4_avg_accum int8_avg_collect int8_avg 0 1016 1016 "{0,0}" "{0,0}" )); -DATA(insert ( 2102 int2_avg_accum int8_avg_collect int8_avg 0 1016 1016 "{0,0}" "{0,0}" )); -DATA(insert ( 2103 numeric_avg_accum numeric_avg_collect numeric_avg 0 1231 1231 "{0,0}" "{0,0}" )); -DATA(insert ( 2104 float4_accum float8_collect float8_avg 0 1022 1022 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2105 float8_accum float8_collect float8_avg 0 1022 1022 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2106 interval_accum interval_collect interval_avg 0 1187 1187 "{0 second,0 second}" "{0 second,0 second}" )); +DATA(insert ( 2100 int8_avg_accum numeric_avg_collect numeric_avg 0 1231 "{0,0}" "{0,0}" )); +DATA(insert ( 2101 int4_avg_accum int8_avg_collect int8_avg 0 1016 "{0,0}" "{0,0}" )); +DATA(insert ( 2102 int2_avg_accum int8_avg_collect int8_avg 0 1016 "{0,0}" "{0,0}" )); +DATA(insert ( 2103 numeric_avg_accum numeric_avg_collect numeric_avg 0 1231 "{0,0}" "{0,0}" )); +DATA(insert ( 2104 float4_accum float8_collect float8_avg 0 1022 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2105 float8_accum float8_collect float8_avg 0 1022 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2106 interval_accum interval_collect interval_avg 0 1187 "{0 second,0 second}" "{0 second,0 second}" )); #endif #ifdef PGXC //DATA(insert ( 2100 int8_avg_accum numeric_avg 0 1231 "{0,0}" )); @@ -126,14 +123,14 @@ DATA(insert ( 2106 interval_accum interval_collect interval_avg 0 1187 1187 "{0 /* sum */ #ifdef PGXC -DATA(insert ( 2107 int8_sum numeric_add - 0 1700 1700 _null_ "0" )); -DATA(insert ( 2108 int4_sum int8_sum_to_int8 - 0 20 20 _null_ _null_ )); -DATA(insert ( 2109 int2_sum int8_sum_to_int8 - 0 20 20 _null_ _null_ )); -DATA(insert ( 2110 float4pl float4pl - 0 700 700 _null_ "0" )); -DATA(insert ( 2111 float8pl float8pl - 0 701 701 _null_ "0" )); -DATA(insert ( 2112 cash_pl cash_pl - 0 790 790 _null_ _null_ )); -DATA(insert ( 2113 interval_pl interval_pl - 0 1186 1186 _null_ _null_ )); -DATA(insert ( 2114 numeric_add numeric_add - 0 1700 1700 _null_ "0" )); +DATA(insert ( 2107 int8_sum numeric_add - 0 1700 _null_ "0" )); +DATA(insert ( 2108 int4_sum int8_sum_to_int8 - 0 20 _null_ _null_ )); +DATA(insert ( 2109 int2_sum int8_sum_to_int8 - 0 20 _null_ _null_ )); +DATA(insert ( 2110 float4pl float4pl - 0 700 _null_ "0" )); +DATA(insert ( 2111 float8pl float8pl - 0 701 _null_ "0" )); +DATA(insert ( 2112 cash_pl cash_pl - 0 790 _null_ _null_ )); +DATA(insert ( 2113 interval_pl interval_pl - 0 1186 _null_ _null_ )); +DATA(insert ( 2114 numeric_add numeric_add - 0 1700 _null_ "0" )); #endif #ifdef PGXC //DATA(insert ( 2107 int8_sum - 0 1700 _null_ )); @@ -148,26 +145,26 @@ DATA(insert ( 2114 numeric_add numeric_add - 0 1700 1700 _null_ "0" )); /* max */ #ifdef PGXC -DATA(insert ( 2115 int8larger int8larger - 413 20 20 _null_ _null_ )); -DATA(insert ( 2116 int4larger int4larger - 521 23 23 _null_ _null_ )); -DATA(insert ( 2117 int2larger int2larger - 520 21 21 _null_ _null_ )); -DATA(insert ( 2118 oidlarger oidlarger - 610 26 26 _null_ _null_ )); -DATA(insert ( 2119 float4larger float4larger - 623 700 700 _null_ _null_ )); -DATA(insert ( 2120 float8larger float8larger - 674 701 701 _null_ _null_ )); -DATA(insert ( 2121 int4larger int4larger - 563 702 702 _null_ _null_ )); -DATA(insert ( 2122 date_larger date_larger - 1097 1082 1082 _null_ _null_ )); -DATA(insert ( 2123 time_larger time_larger - 1112 1083 1083 _null_ _null_ )); -DATA(insert ( 2124 timetz_larger timetz_larger - 1554 1266 1266 _null_ _null_ )); -DATA(insert ( 2125 cashlarger cashlarger - 903 790 790 _null_ _null_ )); -DATA(insert ( 2126 timestamp_larger timestamp_larger - 2064 1114 1114 _null_ _null_ )); -DATA(insert ( 2127 timestamptz_larger timestamptz_larger - 1324 1184 1184 _null_ _null_ )); -DATA(insert ( 2128 interval_larger interval_larger - 1334 1186 1186 _null_ _null_ )); -DATA(insert ( 2129 text_larger text_larger - 666 25 25 _null_ _null_ )); -DATA(insert ( 2130 numeric_larger numeric_larger - 1756 1700 1700 _null_ _null_ )); -DATA(insert ( 2050 array_larger array_larger - 1073 2277 2277 _null_ _null_ )); -DATA(insert ( 2244 bpchar_larger bpchar_larger - 1060 1042 1042 _null_ _null_ )); -DATA(insert ( 2797 tidlarger tidlarger - 2800 27 27 _null_ _null_ )); -DATA(insert ( 3526 enum_larger enum_larger - 3519 3500 3500 _null_ _null_ )); +DATA(insert ( 2115 int8larger int8larger - 413 20 _null_ _null_ )); +DATA(insert ( 2116 int4larger int4larger - 521 23 _null_ _null_ )); +DATA(insert ( 2117 int2larger int2larger - 520 21 _null_ _null_ )); +DATA(insert ( 2118 oidlarger oidlarger - 610 26 _null_ _null_ )); +DATA(insert ( 2119 float4larger float4larger - 623 700 _null_ _null_ )); +DATA(insert ( 2120 float8larger float8larger - 674 701 _null_ _null_ )); +DATA(insert ( 2121 int4larger int4larger - 563 702 _null_ _null_ )); +DATA(insert ( 2122 date_larger date_larger - 1097 1082 _null_ _null_ )); +DATA(insert ( 2123 time_larger time_larger - 1112 1083 _null_ _null_ )); +DATA(insert ( 2124 timetz_larger timetz_larger - 1554 1266 _null_ _null_ )); +DATA(insert ( 2125 cashlarger cashlarger - 903 790 _null_ _null_ )); +DATA(insert ( 2126 timestamp_larger timestamp_larger - 2064 1114 _null_ _null_ )); +DATA(insert ( 2127 timestamptz_larger timestamptz_larger - 1324 1184 _null_ _null_ )); +DATA(insert ( 2128 interval_larger interval_larger - 1334 1186 _null_ _null_ )); +DATA(insert ( 2129 text_larger text_larger - 666 25 _null_ _null_ )); +DATA(insert ( 2130 numeric_larger numeric_larger - 1756 1700 _null_ _null_ )); +DATA(insert ( 2050 array_larger array_larger - 1073 2277 _null_ _null_ )); +DATA(insert ( 2244 bpchar_larger bpchar_larger - 1060 1042 _null_ _null_ )); +DATA(insert ( 2797 tidlarger tidlarger - 2800 27 _null_ _null_ )); +DATA(insert ( 3526 enum_larger enum_larger - 3519 3500 _null_ _null_ )); #endif #ifdef PGXC //DATA(insert ( 2115 int8larger - 413 20 _null_ )); @@ -194,26 +191,26 @@ DATA(insert ( 3526 enum_larger enum_larger - 3519 3500 3500 _null_ _null_ ) /* min */ #ifdef PGXC -DATA(insert ( 2131 int8smaller int8smaller - 412 20 20 _null_ _null_ )); -DATA(insert ( 2132 int4smaller int4smaller - 97 23 23 _null_ _null_ )); -DATA(insert ( 2133 int2smaller int2smaller - 95 21 21 _null_ _null_ )); -DATA(insert ( 2134 oidsmaller oidsmaller - 609 26 26 _null_ _null_ )); -DATA(insert ( 2135 float4smaller float4smaller - 622 700 700 _null_ _null_ )); -DATA(insert ( 2136 float8smaller float8smaller - 672 701 701 _null_ _null_ )); -DATA(insert ( 2137 int4smaller int4smaller - 562 702 702 _null_ _null_ )); -DATA(insert ( 2138 date_smaller date_smaller - 1095 1082 1082 _null_ _null_ )); -DATA(insert ( 2139 time_smaller time_smaller - 1110 1083 1083 _null_ _null_ )); -DATA(insert ( 2140 timetz_smaller timetz_smaller - 1552 1266 1266 _null_ _null_ )); -DATA(insert ( 2141 cashsmaller cashsmaller - 902 790 790 _null_ _null_ )); -DATA(insert ( 2142 timestamp_smaller timestamp_smaller - 2062 1114 1114 _null_ _null_ )); -DATA(insert ( 2143 timestamptz_smaller timestamptz_smaller - 1322 1184 1184 _null_ _null_ )); -DATA(insert ( 2144 interval_smaller interval_smaller - 1332 1186 1186 _null_ _null_ )); -DATA(insert ( 2145 text_smaller text_smaller - 664 25 25 _null_ _null_ )); -DATA(insert ( 2146 numeric_smaller numeric_smaller - 1754 1700 1700 _null_ _null_ )); -DATA(insert ( 2051 array_smaller array_smaller - 1072 2277 2277 _null_ _null_ )); -DATA(insert ( 2245 bpchar_smaller bpchar_smaller - 1058 1042 1042 _null_ _null_ )); -DATA(insert ( 2798 tidsmaller tidsmaller - 2799 27 27 _null_ _null_ )); -DATA(insert ( 3527 enum_smaller enum_smaller - 3518 3500 3500 _null_ _null_ )); +DATA(insert ( 2131 int8smaller int8smaller - 412 20 _null_ _null_ )); +DATA(insert ( 2132 int4smaller int4smaller - 97 23 _null_ _null_ )); +DATA(insert ( 2133 int2smaller int2smaller - 95 21 _null_ _null_ )); +DATA(insert ( 2134 oidsmaller oidsmaller - 609 26 _null_ _null_ )); +DATA(insert ( 2135 float4smaller float4smaller - 622 700 _null_ _null_ )); +DATA(insert ( 2136 float8smaller float8smaller - 672 701 _null_ _null_ )); +DATA(insert ( 2137 int4smaller int4smaller - 562 702 _null_ _null_ )); +DATA(insert ( 2138 date_smaller date_smaller - 1095 1082 _null_ _null_ )); +DATA(insert ( 2139 time_smaller time_smaller - 1110 1083 _null_ _null_ )); +DATA(insert ( 2140 timetz_smaller timetz_smaller - 1552 1266 _null_ _null_ )); +DATA(insert ( 2141 cashsmaller cashsmaller - 902 790 _null_ _null_ )); +DATA(insert ( 2142 timestamp_smaller timestamp_smaller - 2062 1114 _null_ _null_ )); +DATA(insert ( 2143 timestamptz_smaller timestamptz_smaller - 1322 1184 _null_ _null_ )); +DATA(insert ( 2144 interval_smaller interval_smaller - 1332 1186 _null_ _null_ )); +DATA(insert ( 2145 text_smaller text_smaller - 664 25 _null_ _null_ )); +DATA(insert ( 2146 numeric_smaller numeric_smaller - 1754 1700 _null_ _null_ )); +DATA(insert ( 2051 array_smaller array_smaller - 1072 2277 _null_ _null_ )); +DATA(insert ( 2245 bpchar_smaller bpchar_smaller - 1058 1042 _null_ _null_ )); +DATA(insert ( 2798 tidsmaller tidsmaller - 2799 27 _null_ _null_ )); +DATA(insert ( 3527 enum_smaller enum_smaller - 3518 3500 _null_ _null_ )); #endif #ifdef PGXC //DATA(insert ( 2131 int8smaller - 412 20 _null_ )); @@ -241,8 +238,8 @@ DATA(insert ( 3527 enum_smaller enum_smaller - 3518 3500 3500 _null_ _null_ ) /* count */ /* Final function is data type conversion function numeric_int8 is refernced by OID because of ambiguous defininition in pg_proc */ #ifdef PGXC -DATA(insert ( 2147 int8inc_any int8_sum_to_int8 - 0 20 20 "0" "0" )); -DATA(insert ( 2803 int8inc int8_sum_to_int8 - 0 20 20 "0" "0" )); +DATA(insert ( 2147 int8inc_any int8_sum_to_int8 - 0 20 "0" "0" )); +DATA(insert ( 2803 int8inc int8_sum_to_int8 - 0 20 "0" "0" )); #endif #ifdef PGXC //DATA(insert ( 2147 int8inc_any - 0 20 "0" )); @@ -251,12 +248,12 @@ DATA(insert ( 2803 int8inc int8_sum_to_int8 - 0 20 20 "0" "0" )); /* var_pop */ #ifdef PGXC -DATA(insert ( 2718 int8_accum numeric_collect numeric_var_pop 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2719 int4_accum numeric_collect numeric_var_pop 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2720 int2_accum numeric_collect numeric_var_pop 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2721 float4_accum float8_collect float8_var_pop 0 1022 1022 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2722 float8_accum float8_collect float8_var_pop 0 1022 1022 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2723 numeric_accum numeric_collect numeric_var_pop 0 1231 1231 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2718 int8_accum numeric_collect numeric_var_pop 0 1231 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2719 int4_accum numeric_collect numeric_var_pop 0 1231 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2720 int2_accum numeric_collect numeric_var_pop 0 1231 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2721 float4_accum float8_collect float8_var_pop 0 1022 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2722 float8_accum float8_collect float8_var_pop 0 1022 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2723 numeric_accum numeric_collect numeric_var_pop 0 1231 "{0,0,0}" "{0,0,0}" )); #endif #ifdef PGXC //DATA(insert ( 2718 int8_accum numeric_var_pop 0 1231 "{0,0,0}" )); @@ -269,12 +266,12 @@ DATA(insert ( 2723 numeric_accum numeric_collect numeric_var_pop 0 1231 1231 "{ /* var_samp */ #ifdef PGXC -DATA(insert ( 2641 int8_accum numeric_collect numeric_var_samp 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2642 int4_accum numeric_collect numeric_var_samp 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2643 int2_accum numeric_collect numeric_var_samp 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2644 float4_accum float8_collect float8_var_samp 0 1022 1022 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2645 float8_accum float8_collect float8_var_samp 0 1022 1022 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2646 numeric_accum numeric_collect numeric_var_samp 0 1231 1231 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2641 int8_accum numeric_collect numeric_var_samp 0 1231 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2642 int4_accum numeric_collect numeric_var_samp 0 1231 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2643 int2_accum numeric_collect numeric_var_samp 0 1231 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2644 float4_accum float8_collect float8_var_samp 0 1022 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2645 float8_accum float8_collect float8_var_samp 0 1022 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2646 numeric_accum numeric_collect numeric_var_samp 0 1231 "{0,0,0}" "{0,0,0}" )); #endif #ifdef PGXC //DATA(insert ( 2641 int8_accum numeric_var_samp 0 1231 "{0,0,0}" )); @@ -287,12 +284,12 @@ DATA(insert ( 2646 numeric_accum numeric_collect numeric_var_samp 0 1231 1231 "{ /* variance: historical Postgres syntax for var_samp */ #ifdef PGXC -DATA(insert ( 2148 int8_accum numeric_collect numeric_var_samp 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2149 int4_accum numeric_collect numeric_var_samp 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2150 int2_accum numeric_collect numeric_var_samp 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2151 float4_accum float8_collect float8_var_samp 0 1022 1022 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2152 float8_accum float8_collect float8_var_samp 0 1022 1022 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2153 numeric_accum numeric_collect numeric_var_samp 0 1231 1231 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2148 int8_accum numeric_collect numeric_var_samp 0 1231 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2149 int4_accum numeric_collect numeric_var_samp 0 1231 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2150 int2_accum numeric_collect numeric_var_samp 0 1231 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2151 float4_accum float8_collect float8_var_samp 0 1022 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2152 float8_accum float8_collect float8_var_samp 0 1022 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2153 numeric_accum numeric_collect numeric_var_samp 0 1231 "{0,0,0}" "{0,0,0}" )); #endif #ifdef PGXC //DATA(insert ( 2148 int8_accum numeric_var_samp 0 1231 "{0,0,0}" )); @@ -305,12 +302,12 @@ DATA(insert ( 2153 numeric_accum numeric_collect numeric_var_samp 0 1231 1231 "{ /* stddev_pop */ #ifdef PGXC -DATA(insert ( 2724 int8_accum numeric_collect numeric_stddev_pop 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2725 int4_accum numeric_collect numeric_stddev_pop 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2726 int2_accum numeric_collect numeric_stddev_pop 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2727 float4_accum float8_collect float8_stddev_pop 0 1022 1022 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2728 float8_accum float8_collect float8_stddev_pop 0 1022 1022 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2729 numeric_accum numeric_collect numeric_stddev_pop 0 1231 1231 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2724 int8_accum numeric_collect numeric_stddev_pop 0 1231 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2725 int4_accum numeric_collect numeric_stddev_pop 0 1231 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2726 int2_accum numeric_collect numeric_stddev_pop 0 1231 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2727 float4_accum float8_collect float8_stddev_pop 0 1022 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2728 float8_accum float8_collect float8_stddev_pop 0 1022 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2729 numeric_accum numeric_collect numeric_stddev_pop 0 1231 "{0,0,0}" "{0,0,0}" )); #endif #ifdef PGXC //DATA(insert ( 2724 int8_accum numeric_stddev_pop 0 1231 "{0,0,0}" )); @@ -323,12 +320,12 @@ DATA(insert ( 2729 numeric_accum numeric_collect numeric_stddev_pop 0 1231 1231 /* stddev_samp */ #ifdef PGXC -DATA(insert ( 2712 int8_accum numeric_collect numeric_stddev_samp 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2713 int4_accum numeric_collect numeric_stddev_samp 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2714 int2_accum numeric_collect numeric_stddev_samp 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2715 float4_accum float8_collect float8_stddev_samp 0 1022 1022 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2716 float8_accum float8_collect float8_stddev_samp 0 1022 1022 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2717 numeric_accum numeric_collect numeric_stddev_samp 0 1231 1231 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2712 int8_accum numeric_collect numeric_stddev_samp 0 1231 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2713 int4_accum numeric_collect numeric_stddev_samp 0 1231 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2714 int2_accum numeric_collect numeric_stddev_samp 0 1231 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2715 float4_accum float8_collect float8_stddev_samp 0 1022 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2716 float8_accum float8_collect float8_stddev_samp 0 1022 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2717 numeric_accum numeric_collect numeric_stddev_samp 0 1231 "{0,0,0}" "{0,0,0}" )); #endif #ifdef PGXC //DATA(insert ( 2712 int8_accum numeric_stddev_samp 0 1231 "{0,0,0}" )); @@ -341,12 +338,12 @@ DATA(insert ( 2717 numeric_accum numeric_collect numeric_stddev_samp 0 1231 1231 /* stddev: historical Postgres syntax for stddev_samp */ #ifdef PGXC -DATA(insert ( 2154 int8_accum numeric_collect numeric_stddev_samp 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2155 int4_accum numeric_collect numeric_stddev_samp 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2156 int2_accum numeric_collect numeric_stddev_samp 0 1231 1231 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2157 float4_accum float8_collect float8_stddev_samp 0 1022 1022 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2158 float8_accum float8_collect float8_stddev_samp 0 1022 1022 "{0,0,0}" "{0,0,0}" )); -DATA(insert ( 2159 numeric_accum numeric_collect numeric_stddev_samp 0 1231 1231 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2154 int8_accum numeric_collect numeric_stddev_samp 0 1231 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2155 int4_accum numeric_collect numeric_stddev_samp 0 1231 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2156 int2_accum numeric_collect numeric_stddev_samp 0 1231 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2157 float4_accum float8_collect float8_stddev_samp 0 1022 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2158 float8_accum float8_collect float8_stddev_samp 0 1022 "{0,0,0}" "{0,0,0}" )); +DATA(insert ( 2159 numeric_accum numeric_collect numeric_stddev_samp 0 1231 "{0,0,0}" "{0,0,0}" )); #endif #ifdef PGXC //DATA(insert ( 2154 int8_accum numeric_stddev_samp 0 1231 "{0,0,0}" )); @@ -359,18 +356,18 @@ DATA(insert ( 2159 numeric_accum numeric_collect numeric_stddev_samp 0 1231 1231 /* SQL2003 binary regression aggregates */ #ifdef PGXC -DATA(insert ( 2818 int8inc_float8_float8 int8_sum_to_int8 - 0 20 20 "0" _null_ )); -DATA(insert ( 2819 float8_regr_accum float8_regr_collect float8_regr_sxx 0 1022 1022 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" )); -DATA(insert ( 2820 float8_regr_accum float8_regr_collect float8_regr_syy 0 1022 1022 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" )); -DATA(insert ( 2821 float8_regr_accum float8_regr_collect float8_regr_sxy 0 1022 1022 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" )); -DATA(insert ( 2822 float8_regr_accum float8_regr_collect float8_regr_avgx 0 1022 1022 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" )); -DATA(insert ( 2823 float8_regr_accum float8_regr_collect float8_regr_avgy 0 1022 1022 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" )); -DATA(insert ( 2824 float8_regr_accum float8_regr_collect float8_regr_r2 0 1022 1022 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" )); -DATA(insert ( 2825 float8_regr_accum float8_regr_collect float8_regr_slope 0 1022 1022 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" )); -DATA(insert ( 2826 float8_regr_accum float8_regr_collect float8_regr_intercept 0 1022 1022 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" )); -DATA(insert ( 2827 float8_regr_accum float8_regr_collect float8_covar_pop 0 1022 1022 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" )); -DATA(insert ( 2828 float8_regr_accum float8_regr_collect float8_covar_samp 0 1022 1022 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" )); -DATA(insert ( 2829 float8_regr_accum float8_regr_collect float8_corr 0 1022 1022 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" )); +DATA(insert ( 2818 int8inc_float8_float8 int8_sum_to_int8 - 0 20 "0" _null_ )); +DATA(insert ( 2819 float8_regr_accum float8_regr_collect float8_regr_sxx 0 1022 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" )); +DATA(insert ( 2820 float8_regr_accum float8_regr_collect float8_regr_syy 0 1022 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" )); +DATA(insert ( 2821 float8_regr_accum float8_regr_collect float8_regr_sxy 0 1022 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" )); +DATA(insert ( 2822 float8_regr_accum float8_regr_collect float8_regr_avgx 0 1022 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" )); +DATA(insert ( 2823 float8_regr_accum float8_regr_collect float8_regr_avgy 0 1022 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" )); +DATA(insert ( 2824 float8_regr_accum float8_regr_collect float8_regr_r2 0 1022 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" )); +DATA(insert ( 2825 float8_regr_accum float8_regr_collect float8_regr_slope 0 1022 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" )); +DATA(insert ( 2826 float8_regr_accum float8_regr_collect float8_regr_intercept 0 1022 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" )); +DATA(insert ( 2827 float8_regr_accum float8_regr_collect float8_covar_pop 0 1022 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" )); +DATA(insert ( 2828 float8_regr_accum float8_regr_collect float8_covar_samp 0 1022 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" )); +DATA(insert ( 2829 float8_regr_accum float8_regr_collect float8_corr 0 1022 "{0,0,0,0,0,0}" "{0,0,0,0,0,0}" )); #endif #ifdef PGXC //DATA(insert ( 2818 int8inc_float8_float8 - 0 20 "0" )); @@ -389,9 +386,9 @@ DATA(insert ( 2829 float8_regr_accum float8_regr_collect float8_corr 0 1022 1 /* boolean-and and boolean-or */ #ifdef PGXC -DATA(insert ( 2517 booland_statefunc booland_statefunc - 0 16 16 _null_ _null_ )); -DATA(insert ( 2518 boolor_statefunc boolor_statefunc - 0 16 16 _null_ _null_ )); -DATA(insert ( 2519 booland_statefunc booland_statefunc - 0 16 16 _null_ _null_ )); +DATA(insert ( 2517 booland_statefunc booland_statefunc - 0 16 _null_ _null_ )); +DATA(insert ( 2518 boolor_statefunc boolor_statefunc - 0 16 _null_ _null_ )); +DATA(insert ( 2519 booland_statefunc booland_statefunc - 0 16 _null_ _null_ )); #endif #ifdef PGXC //DATA(insert ( 2517 booland_statefunc - 0 16 _null_ )); @@ -401,14 +398,14 @@ DATA(insert ( 2519 booland_statefunc booland_statefunc - 0 16 16 _null_ _null /* bitwise integer */ #ifdef PGXC -DATA(insert ( 2236 int2and int2and - 0 21 21 _null_ _null_ )); -DATA(insert ( 2237 int2or int2or - 0 21 21 _null_ _null_ )); -DATA(insert ( 2238 int4and int4and - 0 23 23 _null_ _null_ )); -DATA(insert ( 2239 int4or int4or - 0 23 23 _null_ _null_ )); -DATA(insert ( 2240 int8and int8and - 0 20 20 _null_ _null_ )); -DATA(insert ( 2241 int8or int8or - 0 20 20 _null_ _null_ )); -DATA(insert ( 2242 bitand bitand - 0 1560 1560 _null_ _null_ )); -DATA(insert ( 2243 bitor bitor - 0 1560 1560 _null_ _null_ )); +DATA(insert ( 2236 int2and int2and - 0 21 _null_ _null_ )); +DATA(insert ( 2237 int2or int2or - 0 21 _null_ _null_ )); +DATA(insert ( 2238 int4and int4and - 0 23 _null_ _null_ )); +DATA(insert ( 2239 int4or int4or - 0 23 _null_ _null_ )); +DATA(insert ( 2240 int8and int8and - 0 20 _null_ _null_ )); +DATA(insert ( 2241 int8or int8or - 0 20 _null_ _null_ )); +DATA(insert ( 2242 bitand bitand - 0 1560 _null_ _null_ )); +DATA(insert ( 2243 bitor bitor - 0 1560 _null_ _null_ )); #endif #ifdef PGXC //DATA(insert ( 2236 int2and - 0 21 _null_ )); @@ -423,7 +420,7 @@ DATA(insert ( 2243 bitor bitor - 0 1560 1560 _null_ _null_ )); /* xml */ #ifdef PGXC -DATA(insert ( 2901 xmlconcat2 xmlconcat2 - 0 142 142 _null_ _null_ )); +DATA(insert ( 2901 xmlconcat2 xmlconcat2 - 0 142 _null_ _null_ )); #endif #ifdef PGXC //DATA(insert ( 2901 xmlconcat2 - 0 142 _null_ )); @@ -459,7 +456,6 @@ extern void AggregateCreate(const char *aggName, List *aggsortopName, Oid aggTransType, #ifdef PGXC - Oid aggCollectType, const char *agginitval, const char *agginitcollect); #else ----------------------------------------------------------------------- Summary of changes: src/backend/catalog/pg_aggregate.c | 21 +-- src/backend/commands/aggregatecmds.c | 5 +- src/backend/executor/nodeAgg.c | 91 ++---------- src/include/catalog/pg_aggregate.h | 250 +++++++++++++++++----------------- 4 files changed, 147 insertions(+), 220 deletions(-) hooks/post-receive -- Postgres-XC |