index b95cc95e5d9a201949d89d713e0cfa77be6a1a22..11678388fab7cda4067b1b4354854840275793a2 100644 (file)
* Prepare the grpColIdx for the real Agg node first, because we may need
* it for sorting
*/
- if (list_length(rollup_groupclauses) > 1)
- {
- Assert(rollup_lists && llast(rollup_lists));
-
- top_grpColIdx =
- remap_groupColIdx(root, llast(rollup_groupclauses));
- }
+ if (parse->groupingSets)
+ top_grpColIdx = remap_groupColIdx(root, llast(rollup_groupclauses));
/*
* If we need a Sort operation on the input, generate that.
index 842c2aec7e21032084dc160cc72d1f66abb6ccb9..2e12a53d69fd6914a2ff513a0df2a59ebba36c52 100644 (file)
@@ -587,4 +587,27 @@ select array(select row(v.a,s1.*) from (select two,four, count(*) from onek grou
{"(2,0,0,250)","(2,0,2,250)","(2,0,,500)","(2,1,1,250)","(2,1,3,250)","(2,1,,500)","(2,,0,250)","(2,,1,250)","(2,,2,250)","(2,,3,250)","(2,,,1000)"}
(2 rows)
+-- Grouping on text columns
+select sum(ten) from onek group by two, rollup(four::text) order by 1;
+ sum
+------
+ 1000
+ 1000
+ 1250
+ 1250
+ 2000
+ 2500
+(6 rows)
+
+select sum(ten) from onek group by rollup(four::text), two order by 1;
+ sum
+------
+ 1000
+ 1000
+ 1250
+ 1250
+ 2000
+ 2500
+(6 rows)
+
-- end
index 0bffb8531c2c6f757c221d229af1ff9861fcdf07..eeea995f337a279fd32330f9d318e62950e5b431 100644 (file)
select * from (values (1),(2)) v(a) left join lateral (select v.a, four, ten, count(*) from onek group by cube(four,ten)) s on true order by v.a,four,ten;
select array(select row(v.a,s1.*) from (select two,four, count(*) from onek group by cube(two,four) order by two,four) s1) from (values (1),(2)) v(a);
+-- Grouping on text columns
+select sum(ten) from onek group by two, rollup(four::text) order by 1;
+select sum(ten) from onek group by rollup(four::text), two order by 1;
+
-- end