On Tue, Apr 21, 2026 at 9:26 PM SATYANARAYANA NARLAPURAM
<satyanarlapuram@gmail.com> wrote:
>
> Hi hackers,
>
> expression_tree_mutator_impl() was missing case handlers for
> T_GraphPattern, T_GraphElementPattern, and T_GraphPropertyRef.
> The corresponding expression_tree_walker_impl() already handled
> all three node types, but the mutator did not, causing an
> "unrecognized node type: 106" error whenever a GRAPH_TABLE
> subquery appeared in a HAVING clause.
>
> SELECT 1 FROM hv GROUP BY id
> HAVING (SELECT COUNT(*) FROM GRAPH_TABLE(gh MATCH (a) COLUMNS (a.id AS x))) > 0;
> SET
> ERROR: unrecognized node type: 106
>
> Attached a patch to address this.
Thanks for the report and the patch.
I first thought that the nodes needn't be part of the mutator since
they will be rewritten into some other nodes. But in this case the
mutator is being called from the transformation phase which does not
rewrite these nodes. I also found that range_table_mutator_impl()
invokes MUTATE on RangeTblEntry::graph_table and
RangeTblEntry::graph_table_columns which contain these three nodes in
their trees. So it seems like we forgot to handle these three nodes in
expression_tree_mutator(). From the name of the function, I thought it
only handles expressions (nodes which have Expr as their first
member). In that case adding GraphElementPattern and GraphPattern
should be handled somewhere else. But it seems the function also
handles Node types as well (e.g. List, TableFunc).
GraphPropertyRef has char *elvarname. Only the char * is copied by
FLATCOPY but not the character string it's pointing to. That made me a
bit uncomfortable because the mutated GraphPropertyRef would point to
the old name. But it looks like that's how other node types are
handled in that function. E.g. XmlExpr has member name which is also
FLATCOPY'ed. So we are good.
Why is MUTATE not called on GraphElementPattern::labelexpr and
GraphElementPattern::quantifier?
The test query is placed at the appropriate section in the file. I
would try to fit the query in lesser lines by placing SELECT, FROM,
GROUP BY on the same line. But that's more of a personal style.
--
Best Wishes,
Ashutosh Bapat