add T_GroupingFunc to pgxc_shippability_walker
authorTomas Vondra <[email protected]>
Mon, 16 Jan 2017 00:09:22 +0000 (01:09 +0100)
committerTomas Vondra <[email protected]>
Mon, 16 Jan 2017 00:09:22 +0000 (01:09 +0100)
Planning grouping sets queries with grouping() function failed with

    ERROR:  XX000: unrecognized node type: 307
    LOCATION:  pgxc_shippability_walker, pgxcship.c:1199
    STATEMENT:  select grouping(a, b), count(*) from t1
                group by grouping sets ((a), (b));

We simply inspect arguments of the grouping() function, although
that probably is not necessary - it can only reference grouping
expressions, which are checked as part of other nodes.

src/backend/optimizer/util/pgxcship.c

index a8f3d94d442c76183a24975964b469547dbdc451..bcee7e8d0081de02a4adce0cb776cd0c7ebfcff4 100644 (file)
@@ -1194,6 +1194,16 @@ pgxc_shippability_walker(Node *node, Shippability_context *sc_context)
                }
                break;
 
+               case T_GroupingFunc:
+                       /*
+                        * Let expression tree walker inspect the arguments. Not sure if
+                        * that's necessary, as those are just references to grouping
+                        * expressions of the query (and thus likely examined as part
+                        * of another node).
+                        */
+                       return expression_tree_walker(node, pgxc_shippability_walker,
+                                                                                 sc_context);
+
                default:
                        elog(ERROR, "unrecognized node type: %d",
                                 (int) nodeTag(node));