>>>>> "Andres" == Andres Freund <and...@anarazel.de> writes:
Andres> I'd vote for either 0) do nothing or 1). I think the use case Andres> for specifying 64+ (or even 32+) columns in grouping is pretty Andres> darn slim. And as you said, it's not that hard to work around Andres> it if you need it, and that's only going to be in an automated Andres> fashion anyway. If the vote goes with (1), this patch ought to suffice: -- Andrew (irc:RhodiumToad)
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 89a609f..e0eeae0 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -13350,10 +13350,10 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; <function>GROUPING(<replaceable class="parameter">args...</replaceable>)</function> </entry> <entry> - <type>integer</type> + <type>bigint</type> </entry> <entry> - Integer bitmask indicating which arguments are not being included in the current + Bitmask indicating which arguments are not being included in the current grouping set </entry> </row> diff --git a/src/backend/executor/execQual.c b/src/backend/executor/execQual.c index d414e20..70e9c28 100644 --- a/src/backend/executor/execQual.c +++ b/src/backend/executor/execQual.c @@ -3034,10 +3034,10 @@ ExecEvalGroupingFuncExpr(GroupingFuncExprState *gstate, bool *isNull, ExprDoneCond *isDone) { - int result = 0; - int attnum = 0; - Bitmapset *grouped_cols = gstate->aggstate->grouped_cols; - ListCell *lc; + int64 result = 0; + int attnum = 0; + Bitmapset *grouped_cols = gstate->aggstate->grouped_cols; + ListCell *lc; if (isDone) *isDone = ExprSingleResult; @@ -3054,7 +3054,7 @@ ExecEvalGroupingFuncExpr(GroupingFuncExprState *gstate, result = result | 1; } - return (Datum) result; + return Int64GetDatum(result); } /* ---------------------------------------------------------------- diff --git a/src/backend/nodes/nodeFuncs.c b/src/backend/nodes/nodeFuncs.c index 4176393..baa3303 100644 --- a/src/backend/nodes/nodeFuncs.c +++ b/src/backend/nodes/nodeFuncs.c @@ -55,7 +55,7 @@ exprType(const Node *expr) type = ((const Aggref *) expr)->aggtype; break; case T_GroupingFunc: - type = INT4OID; + type = INT8OID; break; case T_WindowFunc: type = ((const WindowFunc *) expr)->wintype; diff --git a/src/backend/parser/parse_agg.c b/src/backend/parser/parse_agg.c index 1e3f2e0..8119af5 100644 --- a/src/backend/parser/parse_agg.c +++ b/src/backend/parser/parse_agg.c @@ -238,10 +238,10 @@ transformGroupingFunc(ParseState *pstate, GroupingFunc *p) List *result_list = NIL; GroupingFunc *result = makeNode(GroupingFunc); - if (list_length(args) > 31) + if (list_length(args) > 63) ereport(ERROR, (errcode(ERRCODE_TOO_MANY_ARGUMENTS), - errmsg("GROUPING must have fewer than 32 arguments"), + errmsg("GROUPING must have fewer than 64 arguments"), parser_errposition(pstate, p->location))); foreach(lc, args)
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers